jquery - 无法以角度显示多个高图?
问题描述
我正在使用 highcharts 以角度显示图形。在我的场景中,我需要显示多个带有随机数据的图表,并且以前的图表不应该反映新数据何时传递给新图表..我正在使用下面的代码
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)
解决方案
推荐阅读
- django - 使用docker将django应用程序部署到heroku时在哪里运行collectstatic?
- python - 在 Docker 中未找到导入错误,但在本地运行时未找到
- java - Hibernate/Spring 框架:配置文件中数据库的路径
- javascript - 使用filereader读取本地TXT文件
- javascript - 失去对有条件出现的输入的关注 - Angular 7
- git - 更新 gitattributes 后,我可以使用 Git 批量更改行尾吗?
- r - 模块化 Shiny 应用程序:CSV 和图表模块
- xamarin.forms - Xamarin.Forms - 如何访问 /data/user/0/com.companyname.notes/files/.local/share/
- html - 在图上添加悬停效果
- google-maps - 步骤 Google API 中的过境详细信息问题