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
def view
  @graph = open_flash_chart_object(500,250, '/projects/open_flash_chart/hlc', true, '/projects/')     
end
def hlc
  a = []
  labels = %w(Mon Tue Wed Thu Fri Sat Sun)

  a << Hlc.new(48,40,42)
  a << Hlc.new(30,28,28)
  a << Hlc.new(20,10,15)
  a << Hlc.new(50,30,35)
  a << Hlc.new(58,30,50)
  a << Hlc.new(62,33,45)
  a << Hlc.new(30,20,25)

  g = Graph.new
  g.title("HLC", "{font-size: 26px;}")
  g.hlc(a, 60, 2, '#f50505', 'My Company', 12)
  g.set_tool_tip('#x_label#<br>Close: #close#<br>High: #high#<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(70)
  g.set_y_label_steps(10)
  g.set_y_legend('Value', 12, '#c11b01')

  render :text => g.render
end
And this code in the view:
1
<%= @graph %>

Back to other graph examples