使高图表像 Ruby 那样工作,支持 Rails 5.X/4.X/3.X 以及其他 Ruby Web 框架
This gem provides a simple and extremely flexible way to use HighCharts from ruby code. Tested on Ruby on Rails, Sinatra and Nanoc, but it should work with others too. Highcharts is not free for commercial use, so make sure you have a valid license to use Highcharts. VERSION ChangeLog
To install it, you just need to add it to your Gemfile:
gem 'lazy_high_charts'
edge version on trial
gem 'lazy_high_charts' --pre
then run
bundle install
and make sure to get the latest version (unless you'd like an older version for some reason)
rake highcharts:update
and add this in the application.js
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require turbolinks
//= require highcharts/highcharts
//= require highcharts/highcharts-more
//= require highcharts/highstock
to install it.
…
high_chart_globals is optional. Use it to set the global options of all charts that are currently displayed on the page. More info here.
When your series has no data and you want to display a message using Highcharts' noData feature (Highcarts doc) you have to include the no-data-to-display.js file like so:
//= require highcharts/highcharts
//= require highcharts/highcharts-more
//= require highcharts/modules/no-data-to-display
You can then set the actual message that is displayed like so:
@chart = LazyHighCharts::HighChart.new('graph') do |f|
f.options[:lang] = { noData: "My beautiful noData message" }
f.title(text: nil)
f.series([])
end
To update to the current highcharts.js directly from http://code.highcharts.com/", you can always run
rake highcharts:update
And HC will be copied to your vendor/assets directory on your app
If you use rails 2.3.x or 3.0.x or 3.1.x, please use versions less than 1.3.3.
We're open to any contribution. It has to be tested properly though.
Thanks for all contributors
暂无开放 Issues,或尚未同步最近议题。