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/bar_3d', true, '/projects/')     
end
def bar_3d
  bar_red = Bar3d.new(75, '#D54C78')
  bar_red.key('2006', 10)
  bar_blue = Bar3d.new(75, '#3334AD')
  bar_blue.key('2007', 10)

  10.times do |t|
          bar_red.data << rand(3) + 2
          bar_blue.data << rand(4) + 5
  end

  g = Graph.new
  g.title("3D Bar Chart", "{font-size:20px; color: #FFFFFF; margin: 5px;background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}")
  g.data_sets << bar_red
  g.data_sets << bar_blue

  g.set_x_axis_3d(12)
  g.set_x_axis_color('#ffffff', '#fDB5C7')
  g.set_y_axis_color('#ffffff', '#fDB5C7')

  g.set_x_labels(%w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct))
  g.set_y_max(10)
  g.set_y_label_steps(5)
  g.set_y_legend("OPEN FLASH CHART", 12, "#736AFF")
  render :text => g.render
end
And this code in the view:
1
<%= @graph %>

Back to other graph examples