function drawGraph($scope) {
// Customized graph drawing function
$scope.chartConfig = {
chart: {
type: 'spline',
animation: Highcharts.svg,
marginRight: 10,
events: {
load: function () {
// Updates the chart every second
var series = this.series[0];
setInterval(function () {
var x = (new Date()).getTime(),
y = Math.random();
series.addPoint([x, y], true, true);
console.log(x + y);
}, 1000);
}
}
},
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 () {
// generates 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;
}())
}]
}
}
The chart is created successfully but it does not dynamically change as expected. The load event in chart:{} might not be executing properly or something similar, as there is no logging in the console. Assistance required. The same issue can be observed Here