Open Flash Chart

About:-

Using open flash chart you can represent your data in the form of different type of graphs.

Install Files:-

For languages other than Ruby:-
Open the .zip file and copy the open-flash-chart.swf to the root folder of your web server and copy the folder ofc-library to the root directory. Set the permissions of this folder and the .php files inside it so they will run correctly.

For Ruby on Rails:-

• script/plugin install http://svn.pullmonkey.com/plugins/trunk/open_flash_chart/
• Move the open_flash_chart.swf file into your RAILS_ROOT/public directory
• Move the swfobject.js file into your RAILS_ROOT/public/javascripts directory
• Create a controller and a view as in my examples below.

The Code:-

Code setting:-
The code depends on the type of chart you want to display. You just need to embed the classes of open flash chart into your scripting language code.
Here is some sample code for ROR:-
In Controller just make an object of open_flash_chart_object. Also make an object of BarOutLine class to make a bar of specific color. Then make an object of Graph class to set the x,y axis and labels.

Here is some sample code for controller:-

def view

@graph = open_flash_chart_object(500,250, '/projects/open_flash_chart/bar_chart', true, '/projects/')

end

def bar_chart

bar = BarOutline.new(50, '#9933CC', '#8010A0') //A bar class object
bar.key("Page VIEWS", 10)
10.times do |t|
bar.data << rand(7) + 3 // Iterate for 10 bars
end

g = Graph.new // Graph class object
g.title("BAR CHART", "{font-size: 15px;}") // Set the title
g.data_sets << bar //Insert bar data into graph
g.set_x_labels(%w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct))
g.set_x_label_style(10, '#9933CC', 0,2)
g.set_x_axis_steps(2)
g.set_y_max(10)
g.set_y_label_steps(4)
g.set_y_legend("OPENF LADF", 12, "#736AFF")
render :text => g.render //Render data stored in object

end

In View you just need need to display the object of open_flash_chart_object

Here is some sample code for view: - <%= @graph %>