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 |
def view @graph = open_flash_chart_object(500,250, '/projects/open_flash_chart/scatter', true, '/projects/') end def scatter a = [] 30.times do |t| a << Point.new(rand(30) - 5, rand(10) - 5, rand(15) + 4) end g = Graph.new g.title("Scatter Chart", '{font-size: 26px;}') g.scatter(a, 3, '#736aff', 'My Dots', 12) g.set_tool_tip("x:#x_label#<br>y:#val#") g.set_x_offset(false) g.set_y_label_style(10, '#9933cc') g.set_y_label_steps(10) g.set_x_label_style(10, '#9933cc') g.set_x_legend('Something') g.set_y_min(-5) g.set_y_max(5) g.set_x_min(-5) g.set_x_max(25) render :text => g.render end |
1 |
<%= @graph %>
|
Back to other graph examples