Created
February 1, 2011 13:55
-
-
Save michelson/805882 to your computer and use it in GitHub Desktop.
examples for lazy high chart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### controllers | |
@time_chart = HighChart.new('chart_tag') do |f| | |
f.chart({:zoomType =>'x', :defaultSeriesType => 'spline'}) | |
f.title(:text => 'Flower Market') | |
f.x_axis({:type =>'datetime'}) | |
f.y_axis({:title => 'flowers'}) | |
chart_begin_js = "Date.UTC(#{@last_x_days[0].year}, #{@last_x_days[0].month-1}, #{@last_x_days[0].day})" | |
f.series(:name => 'violets', :data => generate_numbers(number), :pointInterval => 24*3600*1000) | |
f.series(:name => 'sunflowers', :data => generate_numbers(number), :pointInterval => 24*3600*1000) | |
end | |
@area_time = HighChart.new('chart_tag') do |f| | |
f.title(:text => 'Pollination') | |
f.chart(:defaultSeriesType => "timeseries") | |
f.x_axis({:type => 'datetime', :maxZoom => 14*24*3600*1000}) | |
f.y_axis({:title => {:text => 'Square Miles'}, :min => 0.6, :startOnTicket => false, :showFirstLabel => false}) | |
#f.plot_options({:area => {:lineWidth => 4, :fillColor => {:linearGradient => [0, 0, 0, 300]}}}) | |
f.series(:type => 'area', :name => 'butterflies', :pointInterval => 24*3600*1000*30, :data => generate_numbers(100)) | |
f.series(:type => 'area', :name => 'bees', :pointInterval => 24*3600*1000*30, :data => generate_numbers(100)) | |
end | |
##### views | |
<%= high_chart("my_id5", @time_chart)%> | |
<%- high_chart("my_id6", @area_time) do %> | |
<%= "for (var i = 0; i < options.series.length; i++) | |
options.series[i].pointStart = Date.UTC(2005,10,10);"%> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment