Skip to content

Discussion: optional Y-axis range padding (control plot fill without scaling data) #20

Description

@itsdiay

Context

Per CONTRIBUTING, new props need to earn their place — opening this as a discussion before any PR.

Today computeRange hard-codes vertical margin:

const marginFactor = exaggerate ? 0.01 : 0.12

Consumers who want more breathing room (e.g. keep series min/max around the middle 50% of the plot so there is room for growth/decline) currently have to scale or fabricate domain in app code.

Proposal (for discussion)

An optional prop such as rangePadding?: number (fraction of data span added on each side; default stays 0.12 when unset) so apps can choose TradingView-like tight fill vs mid-plot padding without changing their data.

Example: rangePadding={0.5} → data occupies roughly the middle half of the Y-axis (min ≈ 25%, max ≈ 75%).

Why it might earn a prop

  • Common charting need (auto-scale fill factor).
  • Small API surface: one number, default preserves current behavior.
  • Avoids each consumer reinventing Y padding.

Why it might not

  • API surface is intentionally small.
  • Opinionated defaults over flexibility.
  • Apps can already pre-scale values (with tradeoffs for axis labels / formatters).

Happy to adjust or drop this if you’d rather keep padding fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions