GithubHelp home page GithubHelp logo

nozpheratu / phantomjs-google-charts-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pstephan1187/phantomjs-google-charts

0.0 2.0 0.0 165 KB

A PantomJS module for creating Google charts SVG/HTML server side and using without a client.

License: GNU General Public License v2.0

JavaScript 100.00%

phantomjs-google-charts-ruby's Introduction

PhantomJS-Google-Charts-Ruby

PhantomJS-Google-Charts is a script that turns Google Charts charts into SVG on the server side.

https://github.com/pstephan1187/PhantomJS-Google-Charts

This is a fork of PhantomJS-Google-Charts that:

  1. is designed to use the same data syntax that Google shows in its documentation

  2. is designed to be called from Ruby using the PhantomJS gem:

https://github.com/colszowka/phantomjs-gem

###Usage

Call trigger.js from Ruby like this:

data = {"type" => "PieChart", "options" => {"title" => "Type of Fruit Eaten", "width" => "400", "height" => "300", "is3D" => true, "pieSliceText" => "value"}, "theData" => [['Task', 'Hours per Day'], ['Work', 11], ['Eat', 2], ['Commute', 2], ['Watch TV', 2], ['Sleep', 7]]}.to_json
require 'tempfile'
file = Tempfile.new(['a', '.txt'], "#{Rails.root}/tmp")
file.write(data)
File.chmod(444, file.path)
file.rewind
Phantomjs.run("./path/to/trigger.js", file.path)

This will generate the example pie chart from Google's documentation:

https://developers.google.com/chart/interactive/docs/gallery/piechart

phantomjs-google-charts-ruby's People

Contributors

snoblenet avatar pstephan1187 avatar

Watchers

James Cloos avatar Cyle H avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.