2011-12-29 14 views
0

私はrorで作業し、lazy_high_chart gemを使用します。Lazy_high_chart:options.xaxが定義されていないのはなぜですか?

%= high_stock("my_id", @h) do |c| %>  
    <%="options.rangeSelector= {inputEditDateFormat: '%b %e, %Y',buttons: [{type: 'month',count: 1,text: '1m'}, {type: 'month',count: 3,text: '3m'}, {type: 'month',count: 6,text: '6m'}, {type: 'year',count: 1,text: '1y'}, {type: 'all',text: 'All'}]}"%> 
    <%="options.xAxis.events.setExtremes = function() { alert 'ho';}" %> 

<%end %> 

rangeSelector設定はOKですが、私はx軸のイベント(またはxaxis.otherパラメータ)を追加するとき 私は

「はoptions.xAxisが定義されていない」エラーを得た: 私の見解コードがあります宝石のReadmeファイルに

私は非常によく似たexempleを見た: https://github.com/michelson/lazy_high_charts

あなたは私を助けることができますか?事前

+0

お使いのコントローラのコードは次のように見えるんか? – Mark

+0

私は成功しました(この質問の回答を追加しました) ありがとうございました。 – Batty

答えて

1

<%="options.xAxis.events = {}" %> 

を前に:

<%="options.xAxis.events.setExtremes = function() { alert 'ho';}" %> 
0

ありがとうございます、より良い、それは手順に従っていないビューで、コントローラでそれを使うだろう。

https://github.com/michelson/lazy_high_charts

例えばコントローラで 、ビューで

@h = LazyHighCharts::HighChart.new('graph') do |f| 
f.options[:chart][:defaultSeriesType] = "area" 
f.series(:name=>'John', :data=>[3, 20, 3, 5, 4, 10, 12 ,3, 5,6,7,7,80,9,9]) 
f.series(:name=>'Jane', :data=> [1, 3, 4, 3, 3, 5, 4,-46,7,8,8,9,9,0,0,9]) 
end 

、あなたが追加する必要が

<%= high_chart("my_id", @h) %> 
関連する問題