mamor / phantom-chart-to-png Goto Github PK
View Code? Open in Web Editor NEWSave chart image as a PNG
Save chart image as a PNG
When I try to render a Chart JS or Google chart using phantomjs on the command line or using the PHP example you provided:
phantomjs chartjs.coffee chartjs.png 600 400 line '{"labels":["January","February","March","April","May","June","July"],"datasets":[{"fillColor":"rgba(220, 220, 220, 0.5)","strokeColor":"rgba(220, 220, 220, 1)","pointColor":"rgba(220, 220, 220, 1)","pointStrokeColor":"#fff","data":[65,59,90,81,56,55,40]},{"fillColor":"rgba(151, 187, 205, 0.5)","strokeColor":"rgba(151, 187, 205, 1)","pointColor":"rgba(151, 187, 205, 1)","pointStrokeColor":"#fff","data":[28,48,40,19,96,27,100]}]}' '{"scaleLineWidth":"5"}'
I get the following error:
TypeError: undefined is not a constructor (evaluating 'extensions[ext](this, this.filename)') _load@phantomjs://platform/bootstrap.js:278:24 require@phantomjs://platform/bootstrap.js:311:21 require@phantomjs://platform/bootstrap.js:263:32 global code@phantomjs://code/script.js:7:12
I am using OS X El Capitan, phantomJS installed as an NPM module as you said in the README file.
How can I fix it?
Hello
The command to create chart are working fine, but the code to generate google chart are returning this error:
phantomjs googlecharts.js googlecharts.png 600 400 ComboChart '[["Month","Bolivia","Ecuador","Madagascar","Papua New Guinea","Rwanda","Average"],["2004\/05",165,938,522,998,450,614.6],["2005\/06",135,1120,599,1268,288,682],["2006\/07",157,1167,587,807,397,623],["2007\/08",139,1110,615,968,215,609.4],["2008\/09",136,691,629,1026,366,569.6]]' '{"title":"Monthly Coffee Production by Country","vAxis":{"title":"Cups"},"hAxis":{"title":"Month"},"seriesType":"bars","series":{"5":{"type":"line"}}}'
PHANTOM ERROR: ReferenceError: Can't find variable: $
TRACE:
-> undefined: 3
-> undefined: 20
phantomjs://code/googlecharts.js:19 in onError
How can I solve this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.