2010-03-30 108 views
3

当我把这个在我的基础应用html.haml文件:插件未安装成功

= javascript_include_tag :defaults, 'jquery-1.3.2.min', 'highcharts' 
<!--[if IE]> 
javascript_include_tag 'excanvas.compiled' 
<![endif]--> 
%script{:type => "text/javascript"} 
$(document).ready(function() { 
= yield :javascripts 
}); 

我得到一个图的文字说明是应该在视觉上出现:

$(文件).ready(函数(){var chart = new Highcharts.Chart({chart:{margin:[50,30,0,30],renderTo:'pie-chart-container'},credits:{text:'数据由NETMARKETSHARE提供,启用:true,href:'http://marketshare.hitslink.com/browser ... px?qprid = 3'},图例:{style:{left:'auto',right:'50px',top:'75px',bottom:' auto'},layout:'vertical'},plotOptions:{pie:{dataLabels:{color: 'white',enabled:true,formatter:function(){if(this.y> 15)return this.point.name; },style:{font:'10pt Helvetica',textShadow:'#000000 1px 1px 2px'}}}},series:[{type:'pie',data:[{y:3.57,identifier:'applewebkit',名称:'Safari'},{y:22.32,切片:true,标识符:'gecko',名称:'Firefox'},{y:56.9,标识符:'msie',名称:'Internet Explorer'},{y :17.21,name:'Other'}]},subtitle:{text:'January 2010'},title:{text:'Browser Market Share'},tooltip:{formatter:function(){return“”+ this .point.name +“:”+ this.y +“%”; }},xAxis:{title:{text:''}},yAxis:{title:{text:''}}}); });

+0

尝试'耙highcharts_rails:安装--trace'得到完整的错误跟踪 这样比复制/粘贴我们都可以在github上看到的文件列表更有帮助 – 2010-03-30 18:01:54

+0

好吧,我更新了它 – JohnMerlino 2010-03-30 18:28:48

回答

0

您需要将该脚本放置在布局或其他一些erb文件中。

application.js没有被解析,所以你不能在它使用内嵌的红宝石(或任何其他文件驻留在public目录

+0

那么,那但是图表仍然没有渲染,它似乎与ruby数组和JavaScript试图解释它有关系 – JohnMerlino 2010-04-01 22:25:48

+0

你有什么错误吗?你使用Firefox和Firebug (或类似),以便您可以查看来自Javascript的任何错误? – 2010-04-02 00:43:47

2

我建议通过在github项目上提交问题联系项目所有者。

+0

借调:有其他人有相同问题的搜索结果 – corprew 2010-03-30 18:14:19