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 35 36 37 38 |
def view @graph = open_flash_chart_object(500,250, '/projects/open_flash_chart/candle', true, '/projects/') end def candle a = [] b = [] labels = %w(Mon Tue Wed Thu Fri) a << Candle.new(10,8,6,4) b << Candle.new(10,8,6,4) a << Candle.new(20,15,10,5) b << Candle.new(20,10,15,5) a << Candle.new(20,15,10,5) b << Candle.new(28,24,18,16) a << Candle.new(20,10,15,5) b << Candle.new(10,6,9,4) a << Candle.new(30,5,27,2) b << Candle.new(5,4,2,1) g = Graph.new g.title("Candle", '{font-size:26px;}') g.candle(a, 60, 2, '#c11b01', 'My Company', 12) g.candle(b, 60, 2, '#b0c101', 'Your Company', 12) g.set_tool_tip('#x_legend#<br>High: #high#<br>Open: #open#<br>Close: #close#<br>Low: #low#' ) g.set_x_labels(labels) g.set_x_label_style( 10, '#000000', 0, 1 ); g.set_x_legend( 'Week 1', 12, '#C11B01' ); g.set_y_min( 0 ); g.set_y_max( 30 ); g.set_y_label_steps( 10 ); g.set_y_legend( 'Value', 12, '#C11B01' ); render :text => g.render end |
1 |
<%= @graph %>
|
Back to other graph examples