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/area_hollow', true, '/projects/')     
end
def area_hollow
  data = []
  labels = []
  31.times do |t|
          temp = Math.sin(t * 0.2) * 1.9
          data << temp
          labels << ((temp * 100).to_i.to_f / 100.0).to_f
  end

  g = Graph.new
  g.title("Area Hollow", "{font-size: 26px;}")
  g.set_data(data)
  g.area_hollow(2,3,25,'#CC3399')
  g.set_x_labels(labels)
  g.set_x_label_style(10, '#9933CC',2,2)
  g.set_x_axis_steps(2)
  g.set_y_min(-2)
  g.set_y_max(2)
  g.set_y_label_steps(4)
  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