How do I dynamically change a data point in Highch

2019-03-25 07:20发布

问题:

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.

回答1:

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/



回答2:

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

 chart.series[0].data[0].update({
                x:20
            }); 


标签: highcharts