Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select multiple points or markers programmatically in Highcharts?

Tags:

highcharts

How can I select multiple point or marker programmatically like Shift + Click on chart in default case of Highcharts?

like image 875
Mojtaba Avatar asked Mar 11 '15 11:03

Mojtaba


1 Answers

You can select several points programatically using the Point.select function with accumulate set to true. The function signature is (API):

select ([Boolean select], [Boolean accumulate])

select: Boolean. When true, the point is selected. When false, the point is unselected. When null or undefined, the selection state is toggled.

accumulate: Boolean. When true, the selection is added to other selected points. When false, other selected points are deselected. Internally in Highcharts,selected points are accumulated on Control, Shift or Cmd clicking the point.

A example of your code would be:

chart.series[0].data[0].select(true, true);
chart.series[0].data[1].select(true, true);
// ...

See this JSFiddle demonstration of how it can select several points.

like image 173
Halvor Holsten Strand Avatar answered Jan 04 '23 11:01

Halvor Holsten Strand