Skip to content

YAxis interval={0} does not force display of all ticks when using custom ticks array #6699

@MaxGhenis

Description

@MaxGhenis

Description

When using a custom ticks array with interval={0} on YAxis, Recharts still skips some ticks rather than displaying all of them.

Expected Behavior

Setting interval={0} should force Recharts to display ALL ticks specified in the ticks array, without skipping any.

Actual Behavior

Even with interval={0}, some ticks are skipped. In my case, a ticks array of [-35, -25, -15, -5, 0, 5, 15, 25, 35] displays as [-35, -25, -15, -5, 5, 15, 25, 35] - missing the 0 tick.

Minimal Reproduction

<YAxis
  domain={[-35, 35]}
  interval={0}
  ticks={[-35, -25, -15, -5, 0, 5, 15, 25, 35]}
/>

Environment

  • Recharts version: 3.2.x
  • React version: 18.2.x

Workaround

Using domain bounds that are multiples of the tick interval (e.g., [-40, 40] with interval 10) ensures 0 appears naturally in the tick sequence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions