thanks for your patience. I don't know if anyone is using the plugin, opened a googlegroup, feel free to post any question
open-flash-chart-lazy@googlegroups.comI want to know if you are using this plugin, please email me pedro.visintin [[at]] gmail com
Open Flash Chart Lazy now requires Mhash
gem sources -a http://gems.github.com
sudo gem install peterpunk-mhashThis is helpful to set the parameters as methods.
Before you have to set:
#previous version
bar_chart.y_axis[:min]=0
bar_chart.y_axis[:max]=1000
bar_chart.y_axis[:steps]=100With the new version, is compatible with previous but if you fill confortable you can set the values as standard methods. But remember that some non-standard name parameters as "grid-colour" will still be setted as previous ["grid-colour"]
#new version
bar_chart.y_axis.min=0
bar_chart.y_axis.max=1000
bar_chart.y_axis[:steps]=100
# or
bar_chart.y_axis.steps=100Also the new beta version of Open Flash Chart Alpha8 is now embbeded.
Enjoy
Is a ruby library to use open_flash_chart2 movie to show charts in your application. Is compatible with Ruby on Rails and Sinatra (this sample is built on sinatra).
The code not reproduce all the objects of the ofc library, just the minimal to get it configured and working as easy as possible.
Was designed to make simple to use and extend.
All of the charts are based on a helper object called Serie
A serie could be created with an array or hash, and the series could be time based or label based.
Is the most simple serie, could be a hash or array
#label based
data=[['funky',200],['punky',300],['jazzy',120]]
serie = OpenFlashChartLazy::Serie.new(data)You can define a start date and a number of periods (months by now)
#time based
data=[['2008-1',200],['2008-2',300],['2008-3',120]]
serie = OpenFlashChartLazy::Serie.new(data,{:start_time=>Time.mktime(2008,1,1),:items=>4}) income = [["tv",40000],["internet",10000],["magazines",50000],["other",40000]]
bar_chart = OpenFlashChartLazy::Bar3d.new("Income")
topics=OpenFlashChartLazy::Serie.new(income,{:title=>"Media"})
bar_chart.add_serie(topics)
bar_chart.bg_colour="#FFFFFF"
bar_chart.x_axis.colour="#808080"
bar_chart.x_axis["grid-colour"]="#A0A0A0"
# add this setting here because will be placed first to work
bar_chart.x_axis["3d"]=10
bar_chart.y_axis.colour="#808080"
bar_chart.y_axis["grid-colour"]="#A0A0A0"
bar_chart.y_axis.min=0
bar_chart.y_axis.max=80000
bar_chart.y_axis.steps=25000
#adding tip an color to a bar
bar_chart.elements.last.values[2]={"top"=> income[2][1], "colour"=> "#D54C78",:tip=>"look here"}
bar_chart.to_jsonThe data of Bar 3d Graph
penetration = [["tv",40],["internet",10],["magazines",50]]
pie_chart = OpenFlashChartLazy::Pie.new("Media")
serie=OpenFlashChartLazy::Serie.new(penetration)
pie_chart.add_serie(serie)
pie_chart.title.text="My Chocolate Pie"
pie_chart.title.style="{background-color:#000000;color:#ffffff;font-size:20px;}"
pie_chart.bg_colour="#FFFFFF"
pie_chart.elements[0][:alpha]=0.6
pie_chart.elements[0][:stroke]=20
pie_chart.elements[0][:border]=40
pie_chart.to_jsonThe data of Pie Graph
income = [["tv",40000],["internet",10000],["magazines",50000],["other",40000]]
bar_chart = OpenFlashChartLazy::Bar.new("Income")
topics=OpenFlashChartLazy::Serie.new(income,{:title=>"Media"})
bar_chart.add_serie(topics)
bar_chart.x_axis.labels.rotate="vertical"
bar_chart.bg_colour="#FFFFFF"
bar_chart.x_axis.colour="#808080"
bar_chart.x_axis["grid-colour"]="#A0A0A0"
bar_chart.x_axis.stroke=1
bar_chart.y_axis.colour="#808080"
bar_chart.y_axis.stroke=1
bar_chart.y_axis["grid-colour"]="#A0A0A0"
bar_chart.y_axis.min=0
bar_chart.y_axis.max=80000
bar_chart.y_axis.steps=25000
bar_chart.to_jsonThe data of Bar Graph
line_graph = OpenFlashChartLazy::Line.new("Progress")
active_users=OpenFlashChartLazy::Serie.new([["2008-1",100],["2008-2",150],["2008-3",189],["2008-4",300],["2008-5",430],["2008-6",450],["2008-7",556]],{:title=>"Active",:start_date=>Time.mktime(2008,1,1),:items=>8})
users=OpenFlashChartLazy::Serie.new([["2008-1",1000],["2008-2",1150],["2008-3",2189],["2008-4",2543],["2008-5",2800],["2008-6",3231],["2008-7",3429]],{:title=>"Registered",:start_date=>Time.mktime(2008,1,1),:items=>8})
line_graph.add_serie(active_users)
line_graph.add_serie(users)
line_graph.x_axis.labels.rotate="vertical"
line_graph.bg_colour="#FFFFFF"
line_graph.x_axis.colour="#808080"
line_graph.x_axis["grid-colour"]="#A0A0A0"
line_graph.x_axis.stroke=0.5
line_graph.y_axis.colour="#808080"
line_graph.y_axis.stroke=0.5
line_graph.y_axis["grid-colour"]="#A0A0A0"
line_graph.to_jsonThe data of Line Graph