甘特图没有显示。使用google_visualr

时间:2016-04-13 13:00:05

标签: google-visualization

我按照安装步骤here

进行了操作

控制器代码

def index
def days_to_milli(days)
  days * 24 * 60 * 60 * 1000;
end
data_table = GoogleVisualr::DataTable.new
data_table.new_column('string', 'Task ID')
data_table.new_column('string', 'Task Name')
data_table.new_column('string', 'Resource')
data_table.new_column('date'  , 'Start Date')
data_table.new_column('date'  , 'End Date')
data_table.new_column('number', 'Duration')
data_table.new_column('number', 'Percent Complete')
data_table.new_column('string', 'Dependencies')
data_table.add_rows(
  [ ['Research' , 'Find sources'        , nil       , Date.parse("2015-1-1"), Date.parse("2015-1-5")  , nil               , 100 , nil],
    ['Write'    , 'Write paper'         , 'write'   , nil                   , Date.parse("2015-1-9")  , days_to_milli(3)  , 25  , 'Research, Outline'],
    ['Cite'     , 'Create bibliography' , 'write'   , nil                   , Date.parse("2015-1-7")  , days_to_milli(1)  , 20  , 'Research'],
    ['Complete' , 'Hand in paper'       , 'complete', nil                   , Date.parse("2015-1-10") , days_to_milli(1)  , 0   , 'Cite, Write'],
    ['Outline'  , 'Outline paper'       , 'write'   , nil                   , Date.parse("2015-1-6")  , days_to_milli(1)  , 100 , 'Research']
  ]
)
@chart = GoogleVisualr::Interactive::GanttChart.new(data_table, { version: "1.1", height: 275 })
end

视图有:

<div id='chart'></div>
  <%= render_chart @chart, 'chart' %>

但我无法弄清楚它为什么不显示。

它没有显示错误:

Started GET "/tasks" for 127.0.0.1 at 2016-04-13 21:02:30 +0300`
Processing by TasksController#index as HTML
Rendered tasks/index.html.erb within layouts/application (2.3ms)
Completed 200 OK in 430ms (Views: 419.9ms | ActiveRecord: 0.0ms)

0 个答案:

没有答案