New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect ticks on datetime axis type while using global.timezone #7432

Closed
Denyllon opened this Issue Nov 20, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@Denyllon
Contributor

Denyllon commented Nov 20, 2017

Expected behaviour

Ticks on xAxis should be created basing on processed points values.

Actual behaviour

There are ticks of the day before real point datetime on xAxis.

Live demo with steps to reproduce

JSFiddle

Affected browser(s)

All browsers

Workaround

JSFIddle
Positioning ticks basing on series x values, when the chart is loaded.

@droiddk

This comment has been minimized.

Show comment
Hide comment
@droiddk

droiddk commented Nov 20, 2017

+1

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Dec 4, 2017

Collaborator

Ticks on xAxis should be created basing on processed points values.

That is not how the datetime axis works - it is designed to look at the min and max range and then lay out time ticks according to tickPixelInterval. To add one-to-one ticks, use a category axis instead.

Nevertheless, there seems to be a bug here since the datetime axis lays out the ticks on 23:00 instead of midnight: http://jsfiddle.net/highcharts/1h1tc8o2/1/

Collaborator

TorsteinHonsi commented Dec 4, 2017

Ticks on xAxis should be created basing on processed points values.

That is not how the datetime axis works - it is designed to look at the min and max range and then lay out time ticks according to tickPixelInterval. To add one-to-one ticks, use a category axis instead.

Nevertheless, there seems to be a bug here since the datetime axis lays out the ticks on 23:00 instead of midnight: http://jsfiddle.net/highcharts/1h1tc8o2/1/

@TorsteinHonsi TorsteinHonsi added the Bug label Dec 4, 2017

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Dec 4, 2017

Collaborator

It looks like the problem only applies when the first data point is October 29 - using any other date will make the tick fall on midnight. http://jsfiddle.net/highcharts/1h1tc8o2/2/

Collaborator

TorsteinHonsi commented Dec 4, 2017

It looks like the problem only applies when the first data point is October 29 - using any other date will make the tick fall on midnight. http://jsfiddle.net/highcharts/1h1tc8o2/2/

@droiddk

This comment has been minimized.

Show comment
Hide comment
@droiddk

droiddk Dec 4, 2017

Hi Torstein

I came to the same conclusion, I did a lot of testing:
https://jsfiddle.net/droiddk/rk7txu31/
https://jsfiddle.net/droiddk/mLLfm9vy/
https://jsfiddle.net/droiddk/qm0yaLLp/
https://jsfiddle.net/droiddk/rgxx23q0/

I came up with this fix:
https://jsfiddle.net/droiddk/4pqwd413/

Maybe the issue is related to the DST-change when using global "timezone" and "getTimezoneOffset".

Kind Regards

droiddk commented Dec 4, 2017

Hi Torstein

I came to the same conclusion, I did a lot of testing:
https://jsfiddle.net/droiddk/rk7txu31/
https://jsfiddle.net/droiddk/mLLfm9vy/
https://jsfiddle.net/droiddk/qm0yaLLp/
https://jsfiddle.net/droiddk/rgxx23q0/

I came up with this fix:
https://jsfiddle.net/droiddk/4pqwd413/

Maybe the issue is related to the DST-change when using global "timezone" and "getTimezoneOffset".

Kind Regards

@DamianoPantani

This comment has been minimized.

Show comment
Hide comment
@DamianoPantani

DamianoPantani Dec 6, 2017

The same thing is with navigator. Setting minTickInterval somewhat fixes main xAxis' labels but not in navigator's case:

https://jsfiddle.net/rgxx23q0/7/

DamianoPantani commented Dec 6, 2017

The same thing is with navigator. Setting minTickInterval somewhat fixes main xAxis' labels but not in navigator's case:

https://jsfiddle.net/rgxx23q0/7/

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Dec 11, 2017

Collaborator

I found the bug, it seems to happen only when the data min and the computed (extended) axis min falls on different sides of the DST crossover. Demo with the fix applied: http://jsfiddle.net/highcharts/1h1tc8o2/3/

@DamianoPantani I suspect your case is different because you set useUTC to false. So the X axis labels display differently depending on where in the world the user is.

Collaborator

TorsteinHonsi commented Dec 11, 2017

I found the bug, it seems to happen only when the data min and the computed (extended) axis min falls on different sides of the DST crossover. Demo with the fix applied: http://jsfiddle.net/highcharts/1h1tc8o2/3/

@DamianoPantani I suspect your case is different because you set useUTC to false. So the X axis labels display differently depending on where in the world the user is.

@droiddk

This comment has been minimized.

Show comment
Hide comment
@droiddk

droiddk Dec 11, 2017

Hi Torstein

Yes that fixes the bug. Thanks!

Regards

droiddk commented Dec 11, 2017

Hi Torstein

Yes that fixes the bug. Thanks!

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment