How do I dynamically change a data point in Highch

2019-03-25 06:54发布

I'm trying to change a point in an existing series. From looking at the API, I've been trying the following:

chart.series[0].data[0].y = 43;
chart.redraw();

I'm sure I'm missing something simple but I can't figure it out. Thanks for your help.

标签: highcharts
2条回答
乱世女痞
2楼-- · 2019-03-25 07:37

You can't just set the value. chart.series[0].data[0] returns a point object, which you can then use it's 'update' method to change it's values.

chart.series[0].data[0].update(y += 10); 

You can see an example here: http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/members/point-update-column/

查看更多
Root(大扎)
3楼-- · 2019-03-25 07:45

Well it works properly for both coordinates: http://jsfiddle.net/PsBh7/

 chart.series[0].data[0].update({
                x:20
            }); 
查看更多
登录 后发表回答