Skip to content
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

[BUG] Null ticks are graphed when autoSkip=false #4794

Closed
elibyrd opened this issue Sep 25, 2017 · 2 comments
Closed

[BUG] Null ticks are graphed when autoSkip=false #4794

elibyrd opened this issue Sep 25, 2017 · 2 comments

Comments

@elibyrd
Copy link

elibyrd commented Sep 25, 2017

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.
screenshot-jsfiddle net 2017-09-25 16-14-35-384

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/

  1. Create a custom tick format that returns null on at least one tick
  2. 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.
@benmccann
Copy link
Contributor

Thanks for reporting. I've sent a PR to fix this

@etimberg
Copy link
Member

Fixed in #4795

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

No branches or pull requests

4 participants