HTML code:
<canvas id="chart" style="width:100%;"></canvas>
JavaScript code:
var colors = ["#FF6384", "#36A2EB", "#4BC0C0", "#FFFF66", "#FF99FF"];
// Create time series
var ts4 = new TimeSeries(1, {labelText: "Sens 1"});
var ts5 = new TimeSeries(2, {labelText: "Sens 2"});
var ts6 = new TimeSeries(3, {labelText: "Sens 3"});
// Randomly add data points every 2s
setInterval(function () {
//TimeSeries 1
var color = colors[Math.floor(Math.random() * 5)];
ts1.append(new DataSample( {ts: new Date().getTime(), color:color, value: Math.random() * 2000} ));
//TimeSeries 2
color = colors[Math.floor(Math.random() * 5)];
ts2.append(new DataSample( {ts: new Date().getTime(), color:color, value: Math.random() * 2000} ));
//TimeSeries 3
color = colors[Math.floor(Math.random() * 5)];
ts3.append(new DataSample( {ts: new Date().getTime(), color:color, value: Math.random() * 2000} ));
}, 2000);
// Find the canvas
var canvas = document.getElementById('chart');
// Create the chart
var defaultOptions = {};
var isRealTime = true;
var chart = new HorizontalChart(defaultOptions, isRealTime);
chart.addTimeSeries(ts1, ts2, ts3);
chart.streamTo(canvas);