Skip to content

Wrong hours on x-axis labels if dataset starts at round hours #4111

@Danielvdd1

Description

@Danielvdd1

Description

When the data starts at a round hour, the hours on the datetime x-axis are shifted one hour except for the first label. The labels don't show the correct time, but the tooltip does.

Reproduction Link

https://codepen.io/Danielvdd1/pen/poGaOqz
The codepen contains a few datasets to see the different results.

Expected Behavior

The labels on the x-axis should match with the data.
Example: 9, 10, 11, 12, 13, 14

Actual Behavior

The first label is correct, but the following labels are shifted as if the second label is ignored.
Example: 9, 11, 12, 13, 14, 15
(The tooltip time is correct. It does not match with the x-axis labels.)

Screenshots

Screenshot

Notes

This problem does only occur with rounded hours.
A temporary solution is to subtract 1 millisecond from the first datapoint. (Note: Adding 1 millisecond to the first datapoint will still result in the wrong x-axis labels.)
It can be a problem related to rounding the hours in the labels.

Changing datetimeUTC does not fix the problem. It changes the hours everywhere, on the labels as well as the tooltip. The labels after the first label are still wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions