sebdigital
Posts: 10
Joined: Tue Sep 06, 2016 4:51 am

Rebase Line chart at 0 on Range change with Cumulative data

Hi there,

I am working on a chart for a client.
I have put it here:
https://jsfiddle.net/hxzruq26/

The client is telling me that when the Range change, it should start all the time back at 0 and rebase the chart. Is it possible?
Also, If you pick a range of 6 Months, the yAxis is not representing the value on line

Thanks in advance for your help :)

Seb
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Rebase Line chart at 0 on Range change with Cumulative data

Hello sebdigital,

Thanks for contacting us with your questions.

Unfortunately there's no such functionality which would make range selector to start form the beginning of available data. You need to implement something like that on your own. You can either create your own buttons or overwrite default range selector behaviour. It can be achieved with setExtremes method which applies new extremes to axes, btw. this method is used under the hood by range selector.
API reference: https://api.highcharts.com/class-refere ... harts.Axis

When it comes to cumulative sum, it works as intended, at least at this moment. It is not written in documentation, but cumulative sum takes into calculations one extra point which is usually located slightly out of range and thus is invisible for user. It works like that to make it possible to draw a line connecting these two points (first visible point and one out of range). Here's an example:
cumulative.png
cumulative.png (10.33 KiB) Viewed 208 times
Without that, connecting line would be drawn incorrectly. Unfortunately, again there is no option to change that behaviour. If you would like to see such functionality then I strongly encourage you to leave your feedback and create feature request on Highcharts github.

Let me know if you have any further questions.
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Stock”