0
我目前正在Rails應用程序上編寫一個紅寶石,我使用懶惰的高圖表寶石來顯示一些圖表。但是,我無法在一個頁面上顯示兩張圖。看起來後者圖覆蓋了第一個圖,因此第二個圖是唯一顯示的圖。如果單獨放置這兩個圖形都會顯示。如何在一個頁面上顯示這兩個圖形?使用懶惰高圖表在一個頁面上顯示多個圖表
這是我的控制器上
@performance_chart = LazyHighCharts::HighChart.new('graph') do |f|
f.title(:text => "Team Performance")
f.xAxis(:categories => @x_axis)
f.series(:name => @team.name, :yAxis => 0, :data => @performance)
f.series(:name => "Top Scores for " + @team.division.name.capitalize[0...-1] + " Division", :yAxis => 0, :data => @top_scores)
f.series(:name => "Averaged Scores for "+ @team.division.name.capitalize[0...-1] + " Division", :yAxis => 0, :data => @average_scores)
f.yAxis [
{:title => {:text => "Quiz Scores", :margin => 70} }
]
f.chart({:defaultSeriesType=>"line"})
end
#bar graph for individual team members
@member_chart = LazyHighCharts::HighChart.new('column') do |f|
f.title(:text => "Population vs GDP For 5 Big Countries [2009]")
f.xAxis(:categories => ["United States", "Japan", "China", "Germany", "France"])
f.series(:name => "GDP in Billions", :yAxis => 0, :data => [14119, 5068, 4985, 3339, 2656])
f.series(:name => "Population in Millions", :yAxis => 1, :data => [310, 127, 1340, 81, 65])
f.yAxis [
{:title => {:text => "GDP in Billions", :margin => 70} },
{:title => {:text => "Population in Millions"}, :opposite => true},
]
f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)
f.chart({:defaultSeriesType=>"column"})
end
這是對我的看法
<div = class"row">
<div class="card">
<%= high_chart("some_id", @performance_chart) %>
</div>
</div>
<div class="row">
<div class="card">
<%= high_chart("some_id", @member_chart) %>
</div>
</div>