react-highcharts icon indicating copy to clipboard operation
react-highcharts copied to clipboard

rangeSelector not setting by default

Open OhCirca opened this issue 10 years ago • 10 comments

Before Submitting an issue please reproduce it in JSBin using this setup: http://qs.js.org/jsbin/react-highcharts?autostart

There is no need to reproduce. Go to the highstocks demo and notice that the rangeSelector wont have one selected until you click. It isn't just not selecting it visually but it ignores any input and defaults to index 1.

OhCirca avatar Oct 25 '16 14:10 OhCirca

Is there any solution to solve this issue?

JosephGu avatar Nov 24 '16 01:11 JosephGu

Would it be the same on just highcharts js?

kirjs avatar Nov 24 '16 02:11 kirjs

I think my issue is the same as OhCirca's. Actually it do set the default to the button which you set in the config at first, but after the data loaded, the navigator in the bottom changed, then the default button lost it's style.

JosephGu avatar Nov 24 '16 02:11 JosephGu

@kirjs I grabbed a demo from highcharts website

http://jsfiddle.net/gh/get/jquery/3.1.1/highslide-software/highcharts.com/tree/master/samples/stock/demo/candlestick-and-volume/

It sets the rangeSelector correctly. Could be related to demo's highcharts being out of date?

JakeHP avatar Dec 12 '16 21:12 JakeHP

@JosephGu @OhCirca I don't think this is an issue with react-highcharts. Try setting the pre-selected range button index to a zoom button with a low zoom. In my case, the rangeSelector default selected zoom button config setting works if the zoom is not too zoomed (e.g. more than like 5 points of data, 5 candlesticks, etc show on chart).

However it suddenly stops working if the zoom is too much.

JakeHP avatar Dec 16 '16 18:12 JakeHP

I apologize for the confusion I may have set with the OP. I was trying to say visually, through styles, 5)3 range selector does now show which selector is selected.

OhCirca avatar Dec 16 '16 18:12 OhCirca

ahh ok. That too.

JakeHP avatar Dec 16 '16 18:12 JakeHP

I'll update the demo to the latest version today, let's see if it's still there

kirjs avatar Mar 18 '17 17:03 kirjs

Closing and there has been no activity in this issue for a while. if this is still relevant, please feel free to reopen

kirjs avatar Oct 13 '19 19:10 kirjs

Found a solution based off of: https://github.com/whawker/react-jsx-highcharts/issues/201#issuecomment-458851074

Basically, instead of using rangeSelector.selected, you can use xAxis.range, like this: xAxis: {range: 30 * 24 * 3600 * 1000 } // 1 month

liplylie avatar Jan 30 '20 23:01 liplylie