我正在使用高图以角度显示图形。在我的情况下,我需要显示带有随机数据的多个图,并且当新数据传递给新图时,先前的图不应反映。 我正在使用以下代码
runData = [320, 330,333,341,346,351];
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: this.runData
}]
});
}
create(1);
runData = [220, 320,333,321,326,251];
create('b');
runData = [120, 310,313,121,126,151];
create('c');
运行时显示错误,例如
ERROR TypeError:
jquery__WEBPACK_IMPORTED_MODULE_3__(...).highcharts is not a
function
at create (chatbox.component.ts:62)