Skip to content

Bad ticks with time scale #2964

Description

Some date of mine are graphed using a line graph and a time scale. I end up with this graph:

screenshot

As you can see, the July tick is missing.

The related code in scale.time.js seems to be:

if (roundedEnd.diff(me.lastTick, me.tickUnit, true) !== 0) {
     // Do not use end of because we need me to be in the next time unit
     me.lastTick = me.getMomentStartOf(me.lastTick.add(1, me.tickUnit));
}

Patching it to:

if (roundedEnd.diff(this.lastTick, this.tickUnit, true) >= 0) {
     // Do not use end of because we need this to be in the next time unit
     this.lastTick = this.getMomentStartOf(this.lastTick.add(1, this.tickUnit));
} else if (roundedEnd.diff(this.lastTick, this.tickUnit, true) < 0) {
     this.lastTick = roundedEnd;
}

gave me the expected graph.

JsFiddle showing the issue: https://jsfiddle.net/Regisc/kbdn6dpp/

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