Skip to content

fix: disable autoSkip when stepSize is explicitly set#12237

Open
Sonali-Sharma-tech wants to merge 1 commit intochartjs:masterfrom
Sonali-Sharma-tech:fix/autoskip-stepsize
Open

fix: disable autoSkip when stepSize is explicitly set#12237
Sonali-Sharma-tech wants to merge 1 commit intochartjs:masterfrom
Sonali-Sharma-tech:fix/autoskip-stepsize

Conversation

@Sonali-Sharma-tech
Copy link
Copy Markdown

Summary

When ticks.stepSize is set, autoSkip (enabled by default) can still hide ticks — contradicting the user's explicit step size configuration. Users currently have to manually set autoSkip: false alongside stepSize, which is unintuitive.

This fix adds a !tickOpts.stepSize check to the autoSkip condition in core.scale.js, so that autoSkip is automatically disabled when stepSize is explicitly set.

Reproduction

options: {
  scales: {
    y: {
      ticks: {
        stepSize: 1  // expects every tick, but autoSkip hides some
      }
    }
  }
}

Before fix: Some ticks are hidden by autoSkip despite stepSize: 1
After fix: All ticks are shown at the specified interval

Changes

  • src/core/core.scale.js — added !tickOpts.stepSize guard to autoSkip condition
  • test/specs/scale.linear.tests.js — added test verifying all ticks are visible when stepSize is set

Backward compatibility

  • No breaking changes — explicitly setting autoSkip: false still works as before
  • Only affects behavior when stepSize is set (autoSkip is skipped automatically)

Fixes #4048

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specifiying a fixedStepSize for ticks should set autoSkip to false

1 participant