我正在尝试运行高图线图,它不是用JS编写的触发事件。此图表显示在Ionic Android Simulator中。我添加了几个控制台日志,以显示我的代码在哪里工作。有关如何解决此问题的任何想法?在这里,我试图通过为地图系列生成实时数据来模拟实时图表。我在这里使用Jquery不确定角度是否会导致问题。
这是我的代码
$scope.chartConfig4= { chart: {
type: 'spline',
animation: Highcharts.svg, // don't animate in old IE
marginRight: 10,
events: {
load: function () {
console.log("This is not getting logged!");
// 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);
}, 1000);
}
}
},
title: {
text: null
},
xAxis: {
title: {
text: 'UTC Time'
},
type: 'datetime',
tickPixelInterval: 150
},
yAxis: {
title: {
text: 'Users (In Thousands)'
},
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: 'Users',
data: (function () {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
i;
console.log("This works fine!");
for (i = -19; i <= 0; i += 1) {
data.push({
x: time + i * 1000,
y: Math.random()
});
}
return data;
}())
}]}
<div ng-controller="starter">
<highchart id="chart4" config="chartConfig4" ></highchart>
</div>
问题是,当我使用highcharts显示这个角度指令时,实时模拟不起作用。图表显示没有实时的实时迷你。