Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts: set 'select' state on a point and maintain it after mouseover?

I'm using Highcharts and trying to set the select state on a point and maintain the state.

I can set the state just fine, like this:

var chart = new Highcharts.Chart(options);
chart.get('b').setState('select');

But the state gets unset when the user mouses over and then out of the point.

Here is a JSFiddle example - try mousing over the red point and observe that it loses its select state: http://jsfiddle.net/o72xgtfm/1/

Shouldn't the state be maintained even after mouseover, given that it's a select state, not hover?

All I want is to set the point as red, and keep it red. Could I perhaps set a custom state that wouldn't be affected by mouseover?

like image 767
Richard Avatar asked Oct 21 '25 21:10

Richard


1 Answers

I managed to fix this eventually by using:

point.select(true, true);

rather than

point.setState('select');

The latter is undocumented, whereas the first seems to be the official way to do things.

Reference: https://api.highcharts.com/class-reference/Highcharts.Point#select

like image 85
Richard Avatar answered Oct 24 '25 12:10

Richard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!