HighchartsOnRails
Sexy DSL for using higcharts in RoR
Installation
Add this line to your application's Gemfile:
gem 'highcharts_on_rails'
Add this line to your applications application.js file:
//= require highcharts_on_rails/charts
And then execute:
$ bundle
Or install it yourself as:
$ gem install highcharts_on_rails
Usage
Describing chart
Example
@chart = HighchartsOnRails::HollowPieChart.new do |chart|
chart.title "Browser market share"
chart.subtitle "Random data for random browsers :P"
chart.set_container 'nice'
chart.add_series %w(IE FF Chrome), [1,30,69]
chart.with_labels!
chart.add_json({plotOptions: {pie: {size: "80%", innerSize: "50%"}}})
end
Rendering chart
This couldn't be any simpler. Example for haml view:
= highchart(@chart)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Important
As this gem is still in its early stage, please be advised, that default configurations for different charts may be altered in near future.