高图更新绘图选项

Bry*_*ger 2 javascript highcharts

我有一个要求,我需要在高图表上来回更改 connectNulls 。

很遗憾chart.options.plotOptions.series.update({ connectNulls: true });

结果是

(索引):73 未捕获的类型错误:chart.options.plotOptions.series.update 不是(索引):73 处的函数

这是小提琴。

http://jsfiddle.net/d5dbt221/3/

ewo*_*den 7

您正在访问不存在的元素。

要设置单个系列,connectNulls您可以执行以下操作(其中 0 是系列索引):

chart.series[0].update({ connectNulls: true});
Run Code Online (Sandbox Code Playgroud)

工作示例: http: //jsfiddle.net/ewolden/d5dbt221/9/

或者,如果想设置所有系列:

chart.update({ plotOptions: { series: {connectNulls: true }}});
Run Code Online (Sandbox Code Playgroud)

工作示例: http ://jsfiddle.net/ewolden/d5dbt221/11/