没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
www.trustie.net/open_source_projects | 主页 > 开源项目社区 > google-charts-on-rails |
google-charts-on-rails
|
0 | 0 | 18 |
贡献者 | 讨论 | 代码提交 |
Google Charts on RailsThis is a very small wrapper plugin for the wonderful Charts API from Google.
Google Chart API
Installationruby script/plugin install http://google-charts-on-rails.googlecode.com/svn/google_charts_on_rails/
Once installed, start using it directly in your project.
ExampleGoogleChart.pie(10,20,40,30).to_urlwhich creates something like this:
With labels:GoogleChart.pie(['1997',10],['1998',20],['1999',40],['2000',30]).to_url
or as HashGoogleChart.pie_3d_350x150('year 1997'=>10,'year 1998'=>20,'year 1999'=>15,'year 2000'=>55).to_url
Pretty much anything would work:GoogleChart.line_xy
GoogleChart.bar_horizontal_stacked
GoogleChart.bar_vertical_stacked
GoogleChart.bar_horizontal_grouped
GoogleChart.bar_vertical_grouped
GoogleChart.pie
GoogleChart.pie_3d
GoogleChart.venn
GoogleChart.scatter_plotwhich you can marry with the sizeGoogleChart.pie_100x200(10,20,40,30).to_urleven
GoogleChart.100x200_pie(10,20,40,30).to_urlor do as crazy as
GoogleChart.pie_with_size_blah_blah_600x400('year 1997'=>10,'year 1998'=>20,'year 1999'=>15,'year 2000'=>55).to_urlLets do it the old fashioned way:plain initialize
sales_chart = GoogleChart.new
sales_chart.type = :pie
sales_chart.height = 200
sales_chart.width = 150or initialize with size and/or type
sales_chart = GoogleChart.pie_3d_200x150set data
sales_chart.data = [10, 20, 15, 55]change the default colour with the hex code
sales_chart.colors = '346090'get the url for the smaller chart
small_sales_chart_url = sales_chart.to_url
reuse object to change size and set labels for a bigger chart
sales_chart.labels = ['year 1997','year 1998','year 1999','year 2000']
sales_chart.height = 600
sales_chart.width = 350
big_sales_chart_url = sales_chart.to_urlSupportThis software was developed by blj#rubyonrails with guidance from rsl#rubyonrails
If you find it unpleasant, please submit an issue.