function drawGraph($scope) {
//console.log("in draw graph");
//console.log(graphName);
//console.log($scope.chartCategories);
//console.log($scope.chartSeries);
$scope.chartConfig = {
chart: {
type: 'spline',
animation: Highcharts.svg, // don't animate in old IE
marginRight: 10,
events: {
load: function () {
// set up the updating of the chart each second
var series = this.series[0];
setInterval(function () {
var x = (new Date()).getTime(), // current time
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 () {
// 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;
}())
}]
}
}
一切都很好。图表正在创建等,但是唯一的问题是图表没有动态变化,即我认为图表:{}中的加载事件未执行或某事,因为它甚至没有登录控制台。请帮助我。同样的东西在这里运行
看起来像是highcharts-ng中的错误。请参阅相关主题:https : //github.com/pablojim/highcharts-ng/search?q=load&type=Issues&utf8=%E2%9C%93
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句