nicolas.suero
Posts: 1
Joined: Thu May 25, 2023 1:39 am

xAxis min updated when loading series

Hello Highcharts team,

I have noticed that updating the chart with series, results in the xAxis.min date being updated, even though I have already defined a min. My expectation is that after defining the min value for xAxis, the min value should remain unchanged and only get modified if the series data is out of the boundaries defined.

See the steps below to reproduce the issue and the jsfiddle example

http://jsfiddle.net/z6jxesq3/1/

1. Define chart options with xAxis.type='datetime' and xAxis.min = 1677206700000 // Feb 24 2023 15:45:00 GMT+1300
2. Load the chart with options but no series data
3. Click the Load data button and load the series. The series first data point in the series is at 1677207599000 (Feb 24 2023 15:59:59 GMT+1300). Please note that this data point is within the interval defined in the xAxis.min -- xAxis.max
4. Click 'All' in the zoom selectors and examine the chart subtitle containing xAxis.min and xAxis.max

Expected
The min value displayed in the subtitle is Feb 24 2023 15:45:00 GMT+1300, corresponding to 1677206700000

Actual
The min value displayed in the subtitle is Feb 24 2023 15:00:00 GMT+1300

Comments
- If the first data point of the series is at 1677207600000 (one second after), the chart works as expected
- Decreasing the amount of data point in the series also fixes the problem

Could you help me understand what is the problem here?

Cheers,
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: xAxis min updated when loading series

Welcome to our forum and thanks for contacting us with your question!

You need to keep in mind that chart.xAxis.min and navigator.xAxis min is not always the same, especially when you update the chart with the data that was not there on chart load.

In this case, navigator.xAxis.min is set to Feb 24 2023 15:00:00 GMT+1300 when you update the series data, so apart from setting chart.xAxis.min you also need to set navigator.xAxis.min to 1677206700000 // Feb 24 2023 15:45:00 GMT+1300.

I prepared a demo for you:
Demo: http://jsfiddle.net/BlackLabel/2ct6kus3/

Let me know if you have any further questions!
Best regards
Jakub

Return to “Highcharts Stock”