Javascript examples for highcharts:Chart Configuration
Multiple Dynamic charts
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* ww w . j a v a 2 s . c om*/ var create = function(id){ $(document.body).append("<div id='c"+id.toString()+"'></div>"); $('#c'+id.toString()).highcharts({ chart: { type: 'spline', animation: Highcharts.svg, // don't animate in old IE marginRight: 10, }, title: { text: 'Live random data' }, xAxis: { type: 'datetime', tickPixelInterval: 150 }, yAxis: { title: { text: 'Value' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: function () { return '<b>' + this.series.name + '</b><br/>' + Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' + Highcharts.numberFormat(this.y, 2); } }, legend: { enabled: false }, exporting: { enabled: false }, series: [{ name: 'Random data', data: (function () { // generate an array of random data var data = [], time = (new Date()).getTime(), i; for (i = -19; i <= 0; i += 1) { data.push({ x: time + i * 1000, y: Math.random() }); } return data; }()) }] }); } create(1); create(2); create(3); setInterval(function(){ for(var i=1;i<Highcharts.charts.length;i++){ var chart = Highcharts.charts[i]; var series = chart.series[0]; var x = (new Date()).getTime(), y = Math.random(); series.addPoint([x,y], true, true); } },1000); } </script> </head> <body> <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.4.min.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> </body> </html>