So, I have this rickshaw line chart set up on my html script:
var data = [];
var graph = new Rickshaw.Graph( {
element: document.querySelector("#chart"),
width: 1000,
height: 100,
renderer: 'line',
series: [{
color: 'red',
data: data
}]
});
graph.render();
And on my node server I have data, structured as an object with x and y properties, streaming in from a mobile phone through a socket:
var rawData = io
.of('/swift')
.on('connection', function (socket) {
console.log('new connection');
socket.on('message', function (data, fn) {
fn('woot');
console.log(data);
});
socket.emit('node.js', {
"hello": "from node"
});
});
But what I am unsure about is, how do I populate my data array (in the html) with the incoming data objects?