在Highcharts中为一系列动态更改数据

时间:2022-02-17 13:02:09

I have a chart working fine with data in the options, when I leave the data empty for a series and try the below (so I can change the data depending on a click) it doesn't work, any ideas?

我有一个图表可以正常使用选项中的数据,当我将数据留空为一系列并尝试下面(所以我可以根据点击更改数据)它不起作用,任何想法?

options.series[0].data = [35.00,35.91,36.82,37.73,38.64];
var chart = new Highcharts.Chart(options);

2 个解决方案

#1


27  

you can also go with series.setData(). This will allow you to change the entire data of a particular series.

你也可以使用series.setData()。这将允许您更改特定系列的整个数据。

Here is the API link for it.

这是它的API链接。

Hope this will be of use for you.

希望这对你有用。

#2


3  

Eureka - needs nested square brackets so this below works..

尤里卡 - 需要嵌套的方括号,以便下面的工作..

options.series[0].data = [[35.00,35.91,36.82,37.73,38.64]];

#1


27  

you can also go with series.setData(). This will allow you to change the entire data of a particular series.

你也可以使用series.setData()。这将允许您更改特定系列的整个数据。

Here is the API link for it.

这是它的API链接。

Hope this will be of use for you.

希望这对你有用。

#2


3  

Eureka - needs nested square brackets so this below works..

尤里卡 - 需要嵌套的方括号,以便下面的工作..

options.series[0].data = [[35.00,35.91,36.82,37.73,38.64]];