Note: Version 2 of Open Flash Chart is available. Examples for version 2 are here.
Back to other graph examples
The Graph:
The Code:
This code in the controller:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
def view @graph = open_flash_chart_object(600,300, '/projects/open_flash_chart/null_data', true, '/projects/') end def null_data g = Graph.new g.set_x_label_style(10, '#9933CC') g.set_y_label_steps(8) g.set_y_min(0) g.set_y_max(40000) dates = (Date.civil(2007,2,19) .. Date.civil(2007,3,4)).map(&:to_s) g.set_x_labels(dates) data = [] dates.size.times do |x| if x.modulo(3) == rand(3) data << 'null' else data << rand(40000) end end g.set_data(data) g.line_hollow(2, 4, '0x80a033', 'Bounces', 10) g.set_x_label_style( 10, '#CC3399', 2 ); g.set_title("Null Data Example", '{font-size: 14px; color: #CC3399}') g.set_tool_tip("#val#") render :text => g.render end |
1 |
<%= @graph %>
|
Back to other graph examples