Skip to content

Instantly share code, notes, and snippets.

@ayosec
Created October 17, 2012 14:48
Show Gist options
  • Save ayosec/3905924 to your computer and use it in GitHub Desktop.
Save ayosec/3905924 to your computer and use it in GitHub Desktop.
PhantomJS to generate charts

Usage

$ phantomjs render-google-chart.js > output.svg
$ eog output.svg

Output

Resultado

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var url = "http://www.netmagazine.com/files/tutorials/demos/2012/05/create-beautiful-data-visualisations-with-the-svg-google-charts-api/demo/demo.html";
var page = require('webpage').create();
page.viewportSize = { width: 1024, height: 600 };
page.open(url, function () {
var svg = page.evaluate(function() {
return document.querySelector("svg").parentNode.innerHTML.replace(/<\/svg>.*/i, "</svg>");
});
console.log(svg);
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment