Skip to content

[BUG] Wrong time unit chosen for labels (hours instead of date with hours) #5277

Description

@gkemp94

I'm creating several charts, most with time axis, and I've noticed that chartjs has an odd way of picking it's labeling. Generally the information on the x-Axis isn't ideal for the data range. The following example is an example of a small dataset with data over 6 days plotted on an x-axis. The data labels produced are in the format of 12AM etc.

I understand that forcing a unit is one way to fix these, but we have zoom & pan plugins and want the data labels to be dynamic and select different labels based on the range of the x-axis.

https://codepen.io/gkemp94/pen/KQyELW?editors=1111

Expected Behavior

The x-axis labels to suit the range.

Current Behavior

Time values i.e. 12AM/12PM mark days vs. the dates themselves i.e. 12-07-2017 etc.

Possible Solution

I'd be happy to hear suggestions as to additional ways to fix this that don't include editing the source code. But if other people also experience the same issues, then maybe the code that picks the type of labels need to be refined?

Steps to Reproduce (for bugs)

https://codepen.io/gkemp94/pen/KQyELW?editors=1111

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions