我把lazy_high_charts在Gemfile中,跑了捆綁,沒有護欄摹lazy_high_charts:安裝懶惰的高圖表導軌,什麼是「my_id」?在<%= high_chart( 「my_id4」,@chart)%>
這樣做了所有必要的東西,這是我的控制器看起來像
class UsersController < ApplicationController
def show
@user = User.find(:last)
@h = LazyHighCharts::HighChart.new('graph') do |f|
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
end
end
這是我的觀點看起來像
<%= high_chart("my_id4", @h) %>
這是我的佈局看起來像
<title>Dashboard</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'highcharts' %>
<!--[if IE]> <%= javascript_include_tag 'excanvas.compiled' %> <![endif]-->
<%= csrf_meta_tag %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
我在一個總的損失,我看不到任何東西,當我去到圖表是應該出現在highchart
什麼是「my_id4」的說法(「my_id4」,@h)的網址
我用highcharts JavaScript沒有任何寶石。 highcharts採用一個參數,該參數是容納圖表的容器的名稱。我猜「my_id4」是容器的名稱。在你的視圖中添加一個ID爲「my_id4」的div並查看結果。 – mohamagdy 2012-03-17 18:04:21
感謝,幫助了我很多,我想明白了 似乎id標記wasnt需要,或者它只是在那裏指向一個特定的div github的官方文檔是不正確的,我在軌道3.1 .4和它說,javascript包括標籤不需要在佈局,但它,包括,並且它的工作 – qwexar 2012-03-18 09:54:44
然後,我的答案幫助你?如果是,請告訴我將其移至問題的答案以幫助其他查看您問題的人獲得答案,並在此後接受答案=)。 – mohamagdy 2012-03-18 13:07:04