Skip to content

feat: add dual y-axis support to CartesianChart#182

Open
abenitesDC wants to merge 3 commits intocloudscape-design:mainfrom
abenitesDC:feat/cartesian-dual-axis
Open

feat: add dual y-axis support to CartesianChart#182
abenitesDC wants to merge 3 commits intocloudscape-design:mainfrom
abenitesDC:feat/cartesian-dual-axis

Conversation

@abenitesDC
Copy link
Copy Markdown

Summary

  • Add yAxis?: number to cartesian series types so series can reference which Y axis they belong to
  • Accept yAxis as a single object or [primary, secondary] tuple in CartesianChartProps
  • Auto-set opposite: true on the secondary axis when using the tuple form
  • Pass yAxis through all series transform functions (line, column, scatter, threshold, error bar)
  • All changes are backward compatible — existing single-axis usage is unaffected

Test plan

  • TypeScript compilation passes (tsc --noEmit)
  • All 12 cartesian-chart-series unit tests pass (9 existing + 3 new)
  • Documenter snapshots updated
  • Prettier and ESLint pass with no new warnings
  • Demo page added at 01-cartesian-chart/dual-axis-chart

@abenitesDC abenitesDC requested a review from a team as a code owner March 9, 2026 07:19
@abenitesDC abenitesDC requested review from gethinwebster and removed request for a team March 9, 2026 07:19
@vamgan
Copy link
Copy Markdown

vamgan commented Mar 18, 2026

We wanted something like this! Thanks for implementing it.

Anthony Benites and others added 3 commits March 30, 2026 12:55
Allow CartesianChart to render two Y axes by passing a tuple to the
yAxis prop. The second axis is automatically set to opposite (right side).
Series can reference the secondary axis with yAxis: 1.

Changes:
- Add yAxis?: number to BaseCartesianSeriesOptions
- Accept yAxis as single or [primary, secondary] tuple in CartesianChartProps
- Pass yAxis through all series transform functions
- Auto-set opposite: true on the secondary axis
- Add unit tests and demo page
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.

3 participants