我正在尝试制作馅饼甜甜圈,但它不起作用...... http://www.highcharts.com/demo/pie-donut
控制器
@chart_teste5 = LazyHighCharts::HighChart.new('graph') do |f|
f.chart({:defaultSeriesType=>"pie", :margin=> [50, 0, 0, 0]})
f.title({:text => "test"})
f.subtitle({:text => "Inner circle: Your Permissions, Outer circle: Your Friend Permission"})
f.series({
:type => "pie",
:name => "2008",
:size => "45%",
:innerSize => "20%",
:data => [{ :name => "Firefox", :y => 44.2, :color => "#4572A7" },{ :name => "IE", :y => 46.6, :color => "#AA4643" },{ :name => "Chrome", :y => 3.1, :color => "#89A54E" },{ :name => "Safari", :y => 2.7, :color => "#80699B" },{ :name => "Opera", :y => 2.3, :color => "#3D96AE" },{ :name => "Mozilla", :y => 0.4, :color => "#DB843D" }],
:dataLabels=> { :enabled => false }
},{
:type => "pie",
:name => "2010",
:innerSize => "45%",
:data => [{ :name => "Firefox", :y => 45.0, :color => "#4572A7" },{ :name => "IE", :y => 26.8, :color => "#AA4643" },{ :name => "Chrome", :y => 12.8, :color => "#89A54E" },{ :name => "Safari", :y => 8.5, :color => "#80699B" },{ :name => "Opera", :y => 6.2, :color => "#3D96AE" },{ :name => "Mozilla", :y => 0.2, :color => "#DB843D" }],
:dataLabels => { :enabled => true }
})
end
查看
<%= high_chart("my_combine_div", @chart_teste5) %>
错误
wrong number of arguments (2 for 1)
答案 0 :(得分:0)
这是你的代码工作。我希望这有助于
@chart_teste5 = LazyHighCharts::HighChart.new('graph') do |f|
f.chart({:defaultSeriesType=>"pie", :margin=> [50, 0, 0, 0]})
f.title({:text => "test"})
f.subtitle({:text => "Inner circle: Your Permissions, Outer circle: Your Friend Permission"})
f.series({
:type => "pie",
:name => "2008",
:size => "45%",
:innerSize => "20%",
:data => [{ :name => "Firefox", :y => 44.2, :color => "#4572A7" },{ :name => "IE", :y => 46.6, :color => "#AA4643" },{ :name => "Chrome", :y => 3.1, :color => "#89A54E" },{ :name => "Safari", :y => 2.7, :color => "#80699B" },{ :name => "Opera", :y => 2.3, :color => "#3D96AE" },{ :name => "Mozilla", :y => 0.4, :color => "#DB843D" }],
:dataLabels=> { :enabled => false }
}
)
end