a chart generator service for easy embed collections of charts in emails
npm install chartsa chart generator service for easy embed collections of charts in emails
$ [sudo] npm install charts -g
``$3
just run charts as a service
`
$ charts
`
run chart server on selected port [9999]
`
$ charts 9999
`
then embed your chart image like this, which your will get this img !line
`html

`
Was that easy? We'll take a look at this very href.`
http://localhost:3001/sparkline/300x100/1,4,4,7,5,9,10,10,10,10,10,100,20,12
http://{{host}}/{{solution or solution shorthand}}/{{width}}x{{height}}/{{data}}
`
TIPS: 1x1 means auto-width and auto-height$3
Chart is made to be working with as many client charts solutions as you like. using Theme module, Chart is able to load solutions as a NPM module. So feel free to write your solutions.
Use seed project (the default solution of jquery Sparklines) of Charts are recommended:
`
$ git clone https://github.com/turingou/charts.git
$ cd charts
$ mkdir node_modules/charts-theme-mime
$ cd node_modules/charts-theme-mime
$ charts init
$ vi index.jade
`
then start the dev server`
$ node ../../bin/cli
`then open
http://localhost:3001/mime/300x300/{{yourData}}?preview=true you will see the result$3
Charts using Theme module to support multiple solutions in the backend. All solutions should follow Theme Module Structure:
- charts-theme-mime
- index.jade (or index.html) your chart html page
- package.json (define your
view engine and static path)
- static (it contains your libs and scripts)$3
``javascript
var Charts = require('charts');
var chart = new Charts();
var data = {
width: 300,
height: 300,
data: {
x: [1,2,3,4,5],
y: [10,20,30,40,50]
}
};chart.render('charts-theme-mysolution', data, function(err, html){
if (err) return console.log(err)
console.log(html);
});
chart.capture( 'http://localhost:3001/mysolution/300x300/{{yourData}}', data, function(err, shot) {
console.log(shot);
});
``$3
#### chart#render
#### chart#capture
check this file:
index.js`Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.