Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @lazybrandv = LazyHighCharts::HighChart.new('graph') do |f|
- f.options[:chart][:defaultSeriesType] = "pie"
- f.options[:title][:text] = "Top Brands by Volume"
- @piedata=[]
- @brands.each do |brand|
- @piedata.push [Brand.find(brand.brand_id).name, brand.avg_score.to_f]
- end
- @piedata = @piedata.sort_by(&:last).reverse
- @piedata = @piedata.each_with_index.to_a.map! { |(brand, score), index| brand = "#{index+1}: #{brand}", score }
- f.series(:data=>@piedata)
- end
Add Comment
Please, Sign In to add comment