jespergranbo
Posts: 9
Joined: Mon May 17, 2021 1:18 pm

Dynamic extremes by rangeSelector click

Hi, I have this chart https://jsfiddle.net/mck0rpv2/

and with the code:
chart: {
events: {
load: function () {
const xAxis = this.xAxis[0];
xAxis.setExtremes(xAxis.dataMin, xAxis.dataMin + xAxis.max - xAxis.min);
}
}
},
I set the extremes to the start of the chart instead of the end of the chart with date. Although when i press any date below 1y in range selector the lowest date raises, instead i want the highest date to go down and the lowest date to stay at the lowest date. Is there anyway to fix this? Or is there a simpler way to make the rangeselector use the first date instead of the last?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Dynamic extremes by rangeSelector click

Hi jespergranbo,

Thanks for contacting us with your question.

We do not have such option available in our api. However, there are things that you can use to achieve something like that, for example buttons.event.click.
Demo: https://jsfiddle.net/BlackLabel/kr04v3tp/1/

The demo doesn't cover all possible cases (for example when max + range is bigger than dataMax)

Other options that you might find helpful are offsetMax and offsetMin.

This question has been asked any times before and if you think that we should implement something like that, then I highly encourage you to create a feature request and leave your feedback here: https://github.com/highcharts/highchart ... new/choose

Let me know if that was what you were looking for!
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”