-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Labels
Milestone
Description
Expected Behavior
When a custom tick format callback returns null, that tick should be removed from graph.
Current Behavior
If autoSkip is set to false, null ticks are graphed alongside non-null ticks.

Possible Solution
It looks like null ticks are getting filtered out in _autoSkip (line 7492):
if (shouldSkip && i !== tickCount - 1 || helpers.isNullOrUndef(tick.label)) {
// leave tick in place but make sure it's not displayed (#4635)
delete tick.label;
}
If the null check were applied outside of the autoskip filter, it might fix the issue.
Steps to Reproduce (for bugs)
JSFiddle: https://jsfiddle.net/elibyrd/mxcervrt/
- Create a custom tick format that returns null on at least one tick
- Set autoSkip=false on same axis
Context
We have a dynamic chart that graphs one variable over the course of several hours, in minute increments. We want to manually set the x axis to tick every hour, which autoSkip interferes with.
Environment
- Chart.js version: 2.7.0
Note: this wasn't an issue in version 2.6.0 - we encountered it when trying to upgrade to 2.7.0 to take advantage of some new features in 2.7.