我有一个 Highchart,其中在options对象下我有事件对象,如下所示。 var options = { chart: { renderTo: 'container', type: 'line', animation: Highcharts.svg, // don't animate in old IE marginRight: 10, events: { load: function() { var series = this.series[0], chart = this; ...// Some Code } }所以我想要的是我需要events动态更新数据并且只加载一次Highcharts。如何使以下部分动态化,以便其中的值动态变化。请记住,Highcharts 容器必须定义并仅加载一次。events: { load: function() { var series = this.series[0], chart = this; ...// Some Code } }
1 回答
qq_遁去的一_1
TA贡献1725条经验 获得超7个赞
官方的 Highcharts 演示之一展示了如何实现它。看看它:
setInterval(function () {
var x = (new Date()).getTime(), // current time
y = Math.random();
series.addPoint([x, y], true, true);
}, 1000);
https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/dynamic-update/
Highcharts 还提供了其他选项来使用新数据更新图表,API:
https://api.highcharts.com/class-reference/Highcharts.Chart#addSeries
https://api.highcharts.com/class-reference/Highcharts.Series#update
https://api.highcharts.com/class-reference/Highcharts.Series#setData
添加回答
举报
0/150
提交
取消