问题在Highchart脚本中有空白图形

我按照http://www.highcharts.com/demo/column-basic/skies中的步骤操作,问题是我的控制器到我的Highchart图形的值显示为空白(未显示我的值)

在我的桌子http://sqlfiddle.com/#!2/b7347/5 ,我在我的控制器中使用

|policies| ID POLICY_NUM DATE_INI CATEGORY_ID 1 1234 2013-01-10 1 2 5678 2013-01-10 2 3 3444 2013-02-10 1 4 4577 2013-02-10 2 |categories| ID NAME 1 Life 2 Vehicles 

这是我的控制器

 def report @jan_life =Policy.find_by_sql("select count(*) as total from policies Inner join categories ON categories.id =category_id WHere category_id = 1 AND date_ini BETWEEN '2013-01-01' AND '2013-01-31'") @jan_vehi =Policy.find_by_sql("select count(*) as total from policies Inner join categories ON categories.id =category_id WHere category_id = 2 AND date_ini BETWEEN '2013-01-01' AND '2013-01-31'") @feb_life =Policy.find_by_sql("select count(*) as total from policies Inner join categories ON categories.id =category_id WHere category_id = 1 AND date_ini BETWEEN '2013-02-01' AND '2013-02-28'") @feb_vehi =Policy.find_by_sql("select count(*) as total from policies Inner join categories ON categories.id =category_id WHere category_id = 2 AND date_ini BETWEEN '2013-02-01' AND '2013-02-28'") end 

这是我的看法

 ##### To Disable prototype ##### Array.prototype.reduce = undefined; ##### To show High Chart Code ####  ##### Values from my controller , actually is working ####  #it shows 1 value according with the info  #it shows 1 value according with the info  #it shows 1 value according with the info  #it shows 1 value according with the info #### This code is HighChart image ####   
$(function () { $('#container').highcharts({ chart: { type: 'column' }, title: { text: 'Monthly Average Rainfall' }, subtitle: { text: 'Source: WorldClimate.com' }, xAxis: { categories: [ 'Jan', 'Feb' ] }, yAxis: { min: 0, title: { text: 'Rainfall (mm)' } }, tooltip: { headerFormat: '{point.key}', pointFormat: '' + '', footerFormat: '
{series.name}: {point.y:.1f} mm
', shared: true, useHTML: true }, plotOptions: { column: { pointPadding: 0.0, borderWidth: 0 } }, series: [{ name: 'Life', data: @jan_life[0].try(:total) %>, } , { name: 'Vehicles', data: @feb_life[0].try(:total) %> }] }); });

我做错了什么? 显示空白似乎没有通过参数

这是我应该拥有的高清代码视图http://jsfiddle.net/ajEF2/ 。

但我不想写值,我想使用我的控制器中的值来显示我的报告图像

请有人帮我这个吗?

我真的很感激帮助

情侣:

1.)您是否错过了数据分配中的<%=

  series: [{ name: 'Life', data: **<%=** @jan_life[0].try(:total) %>, } , { name: 'Vehicles', data: **<%=** @feb_life[0].try(:total) %> }] 

2.)我已经做了一段时间,但是不会<%= @feb_life[0].try(:total) %>产生一个值? 你最终得到:

  series: [{ name: 'Life', data: 1 } , { name: 'Vehicles', data: 1 }] 

data属性必须是数组。 尝试:

  series: [{ name: 'Life', data: [<%=@jan_life[0].try(:total) %>] //note the brackets. } , { name: 'Vehicles', data: [<%=@feb_life[0].try(:total) %>] }]