Socket
Book a DemoInstallSign in
Socket

phantom_graph

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phantom_graph

0.0.4
bundlerRubygems
Version published
Maintainers
1
Created
Source

= PhantomGraph

PhantomGraph helps complex process to generate javascript charts to image or pdf without requesting or rendering view to the application. PhantomGraph is pure server-side process by using phantomjs and suitable for background process. It is lighweight solution for wkhtmltopdf alternative.

= Installation

gem 'phantom_graph'

or gem install 'phantom_graph'

Do not forget to install phantomjs

See http://phantomjs.org/download.html on how to install phatomjs

= How To Use

add initialize file to "config/initializers/phantom_graph.rb"

  PhantomGraph.configure do |config|
  
    # default: `which phantomjs` or `bundle exec which phantomjs`
    config.phantomjs = "/usr/local/bin/phantomjs"
  
    # default: false
    config.logger = true
    
    # Some javascript plugins are included in Gem
    # if you override please change configuration below
    
    # config.highcharts_convert_path = "/path/app/js/highcharts-convert.js"
    # config.highcharts_theme_path = "/path/app/js/highcharts-theme.js"
    # config.highcharts_path = "/path/app/js/highcharts.js"
    # config.highstock_path = "/path/app/js/highstock.js"
    # config.jquery_path = "/path/app/js/jquery.js"
  end

=== For more samples of json string or file please check:
    * highchart json, please check: http://www.highcharts.com/demo/
    * highstock json, please check: http://www.highcharts.com/stock/demo

==== Highchart
    # sample script: spec/phantom_graph/convert/highchart_spec.rb
    options = {image_file_path: "#{Rails.root}/tmp", filename: "output.png"}
    callback_json = "customCallback"
    highchart = PhantomGraph::Convert::Highchart.new(json_str, options, callback_json)
    highchart.result

==== Highstock
    # sample script: spec/phantom_graph/convert/higstock_spec.rb
    options = {image_file_path: "/path/project/public", filename: "report.pdf"}
    highstock = PhantomGraph::Convert::Highstock.new(json_str, options, callback_json)
    highstock.result

==== Outputs: PDF, SVG, PNG, JPG

===== Default options for Highstock and Highchart:
    {width:              1200, 
     scale:              0.5, 
     constr:             "Chart", 
     json_file_path:     "/tmp", 
     image_file_path:    "/tmp", 
     filename:           nil,
     callback_file_path: "/tmp"
    }


= TODO
1. Add Google Chart Module
2. Add Custom Theme Support
3. Add Synchronous Processor

FAQs

Package last updated on 27 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.