Skip to content

notch8/canvas_exporting

 
 

Repository files navigation

canvas_exporting

Controller action to allow export of CanvasJS chart to png/jpg file.

Installation

Add this line to your application's Gemfile:

gem 'canvas_exporting'

And then execute:

$ bundle

Or install it yourself as:

$ gem install canvas_exporting

Usage

Add canvas_controller.rb and add route post 'canvas/export'.

class CanvasController < ApplicationController
  include CanvasExporting::Exporter

end

Config url /canvas/export for canvas exporting.

OR

Using curl:

Curl::Easy.http_post("http://localhost:3000/canvas/export",
Curl::PostField.content('options', options_JSON.to_s),
Curl::PostField.content('type', 'image/png'),
Curl::PostField.content('callback', cb_js_filename),
Curl::PostField.content('width', '400'),
Curl::PostField.content('outputpath', path_to_image_file),
Curl::PostField.content('filename', image_filename) )

References

https://github.com/bastengao/highcharts_exporting

Contributing

  1. Fork it ( https://github.com/notch8/canvas_exporting/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Highcharts server exporting for Rails

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.5%
  • Ruby 4.6%
  • Other 0.9%