Skip to content

Instantly share code, notes, and snippets.

@hersha
Forked from thepleb/Lines.rb
Created November 2, 2012 18:40
Show Gist options
  • Save hersha/4003448 to your computer and use it in GitHub Desktop.
Save hersha/4003448 to your computer and use it in GitHub Desktop.
Line Chart for lazy_high_charts
# In the controller
@lineChart = LazyHighCharts::HighChart.new('graph') do |f|
f.options[:chart][:defaultSeriesType] = "line"
f.options[:title][:text] = "Chart Title"
f.xAxis(:categories=>['Jan', 'Feb', 'March', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
f.series(name: 'This Series', :data=> [1,2,3,4,5,6,7,8,9,10,9,8])
f.series(name: 'That Series', :data=> [10,9,8,7,5,6,7,8,9,10,9,8])
end
# In the view
<%= high_chart('divID', @lineChart) %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment