fix: disable autoSkip when stepSize is explicitly set#12237
Open
Sonali-Sharma-tech wants to merge 1 commit intochartjs:masterfrom
Open
fix: disable autoSkip when stepSize is explicitly set#12237Sonali-Sharma-tech wants to merge 1 commit intochartjs:masterfrom
Sonali-Sharma-tech wants to merge 1 commit intochartjs:masterfrom
Conversation
When a user sets ticks.stepSize, they expect every tick to be shown at that exact interval. However, autoSkip (enabled by default) can still hide ticks, forcing users to manually set autoSkip: false. This adds a check to skip the autoSkip logic when stepSize is set, since an explicit step size implies the user wants all ticks visible. Fixes chartjs#4048
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
ticks.stepSizeis set,autoSkip(enabled by default) can still hide ticks — contradicting the user's explicit step size configuration. Users currently have to manually setautoSkip: falsealongsidestepSize, which is unintuitive.This fix adds a
!tickOpts.stepSizecheck to the autoSkip condition incore.scale.js, so that autoSkip is automatically disabled when stepSize is explicitly set.Reproduction
Before fix: Some ticks are hidden by autoSkip despite
stepSize: 1After fix: All ticks are shown at the specified interval
Changes
src/core/core.scale.js— added!tickOpts.stepSizeguard to autoSkip conditiontest/specs/scale.linear.tests.js— added test verifying all ticks are visible when stepSize is setBackward compatibility
autoSkip: falsestill works as beforestepSizeis set (autoSkip is skipped automatically)Fixes #4048