Chart.js! With Rails!
This gem provides:
- Chart.js
The chartjs-rails gem will follow these version guidelines:
patch version bump = updates to chartjs-rails, and patch-level updates to Chart.js
minor version bump = minor-level updates to Chart.js
major version bump = major-level updates to Chart.js and updates to Rails which may be backwards-incompatible
Add this line to your application's Gemfile:
gem 'chartjs-rails'
And then execute:
$ bundle
Or install it yourself as:
$ gem install chartjs-rails
The Chart.js files will be added to the asset pipeline and available for you to use. Add these lines to app/assets/javascripts/application.js:
//= require chart
This gem adds a single generator: chartjs:install. Running the generator will copy Chart.js to the public/javascripts directory.
This gem will also hook into the Rails configuration process, adding Chart.js to the javascript files included by the javascript_include_tag(:defaults) call. While this gem contains the minified and un-minified versions of Chart.js, only the minified versions will be included in the :defaults when Rails is run in production or test mode (un-minified versions will be included when Rails is run in development mode).
To invoke the generator, run:
rails generate chartjs:install #--ui to enable Chart.js
You're done!
- 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 a new Pull Request
- Nick Downie, for creating the Chart.js library.
- The jquery-rails gem developers for inspiration.
Copyright Sasha Gerrand, released under the MIT License.