-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
31 lines (18 loc) · 790 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var tee=require('./lib/teechart.js'),
Canvas=require('../canvas/lib/canvas.js'),
http = require('http'),
count=0;
http.createServer(function (req, res) {
var canvas = new Canvas(500,300),
chart = new tee.Tee.Chart(canvas);
//chart.panel.transparent = true;
chart.title.text="Node.js and TeeChart";
chart.addSeries(new tee.Tee.Bar([5,3,7,1,2]));
console.log("Drawing Chart");
chart.bounds.set(0,0,500,300);
chart.draw();
console.log("Sending Chart: " +(count++));
res.writeHead(200, {'Content-Type': 'text/html'});
res.end("<html><body><title>TeeChart Node.js node-canvas Example</title><img src='"+canvas.toDataURL()+"'/></body></html>");
}).listen(4242, "127.0.0.1");
console.log('TeeChart Server running at http://127.0.0.1:4242/');