Skip to content

DLS-761/fix xaxis#728

Merged
gamegee merged 9 commits into
mainfrom
dls-/761/fix-xaxis
Jun 2, 2026
Merged

DLS-761/fix xaxis#728
gamegee merged 9 commits into
mainfrom
dls-/761/fix-xaxis

Conversation

@gamegee
Copy link
Copy Markdown
Collaborator

@gamegee gamegee commented May 29, 2026

Signed-off-by: Simon Bruneaud simon.bruneaud@ledger.fr

Copilot AI review requested due to automatic review settings May 29, 2026 15:16
@gamegee gamegee requested a review from a team as a code owner May 29, 2026 15:16
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ldls Ready Ready Preview, Comment Jun 1, 2026 3:21pm
ldls-react-native Ready Ready Preview, Comment Jun 1, 2026 3:21pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns the chart libraries by consolidating axis config (scaleType/data/domain) and visual props into a single BaseAxisProps type, adds an opt-out nice boolean threaded through getNumericScale, derives X ticks from axis.data when provided, caps line projection to xData.length, and reworks the SVG overflow buffer to use a position: relative offset instead of negative margins. Mirror changes are applied to both ui-react-visualization.

Changes:

  • Move axis scale/domain config onto BaseAxisProps and introduce defaultXAxisProps/defaultYAxisProps (X defaults to nice: false, Y to nice: true).
  • Make getTickValues and toScaledPoints honor axis.data (verbatim numeric ticks; iteration capped at xData.length).
  • Replace OVERFLOW_NEGATIVE_MARGIN with OVERFLOW_OFFSET (relative-positioned shift) and enlarge SVG width/height by the buffer.

Reviewed changes

Copilot reviewed 56 out of 56 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
libs/*/utils/types.ts Drop AxisConfigProps/AxisBounds; consume BaseAxisProps/AxisBounds from Components/Axis.
libs/*/utils/ticks/ticks.ts(+test) Derive ticks from axis.data; tests for numeric/string/explicit precedence.
libs/*/utils/scales/scales.ts(+test) Add nice opt-out to getNumericScale; tests for both branches.
libs/*/utils/domain/domain.ts Switch types to BaseAxisProps.
libs/*/Components/Axis/Axis.types.ts Add AxisBounds + scale/domain/nice fields on BaseAxisProps.
libs/*/Components/Axis/Axis.constants.ts New file with default X/Y axis props (and tick constants in React).
libs/*/Components/Axis/index.ts New barrel exposing types/constants.
libs/ui-react-visualization/.../XAxis/YAxis Re-source tick constants from Axis.constants.
libs/*/Components/CartesianChart/utils.ts Replace negative-margin offset with OVERFLOW_OFFSET.
libs/*/Components/CartesianChart/CartesianChart.tsx Enlarge SVG by buffer; apply offset; pass full axis to context.
libs/*/Components/CartesianChart/types.ts xAxis/yAxis typed as Partial<BaseAxisProps>.
libs/*/Components/CartesianChart/context/useBuildChartContext.ts(+test) Thread nice into buildScale; new tests for default and opt-out.
libs/*/Components/LineChart/types.ts xAxis/yAxis simplified to XAxisProps/YAxisProps.
libs/*/Components/LineChart/LineChart.tsx Apply defaultXAxisProps/defaultYAxisProps; pass full configs to chart and axes.
libs/*/Components/LineChart/LineChart.stories.tsx New/updated stories exercising numeric/string axis data.
libs/*/Components/Line/utils.ts(+test) Cap iteration at xData.length; new unit tests.
libs/*/Components/ReferenceLine/utils.ts, Scrubber/utils.ts Re-typed to BaseAxisProps.
libs/ui-rnative-visualization/.../Scrubber/{types,ScrubberProvider}.tsx Forward optional style to apply OVERFLOW_OFFSET to wrapping View.
apps/app-sandbox-rnative/.../LineCharts.tsx Add horizontal padding; drop fixed width; shorten heights.
.nx/version-plans/*.md New version plans documenting the changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/ui-rnative-visualization/src/lib/Components/Axis/Axis.constants.ts Outdated
Comment thread libs/ui-react-visualization/src/lib/Components/CartesianChart/CartesianChart.tsx Outdated
Comment thread libs/ui-rnative-visualization/src/lib/Components/Axis/Axis.constants.ts Outdated
Comment thread libs/ui-react-visualization/src/lib/Components/Axis/XAxis/XAxis.tsx Outdated
gamegee and others added 4 commits June 1, 2026 14:30
Consolidate axis configuration onto a single `BaseAxisProps` type and add a
`nice` boolean (default `true` on both axes). Set `nice: false` to keep the
domain exactly as provided and have data fill the plot area
boundary-to-boundary. Default behavior is unchanged; this is a pure additive
opt-out.

Co-authored-by: Cursor <cursoragent@cursor.com>
When `xAxis.data` is provided without explicit `ticks`, `buildTicksData` now
derives ticks from the data itself (numeric values for numeric data, indices
for string data) instead of falling back to `scale.ticks()`. This removes
d3-invented intermediate ticks (e.g. `1, 3` for `[0, 2, 4]`, or `0.5, 1.5`
between `'Jan', 'Feb', 'Mar'`).

Also exports `getTickValues`, `getTickPosition`, and `getTickLabel` so the
existing test suite — which was importing them — actually exercises them.

Co-authored-by: Cursor <cursoragent@cursor.com>
… points than axis labels

When `xAxis.data` is provided (e.g. month labels), the X domain is sized to
`data.length - 1`. Series points beyond that length used to be projected past
the right edge of the drawing area, so a 14-point series on an 8-month axis
would leak past the last label.

`toScaledPoints` now caps iteration at `xData.length` when axis data is
provided, treating the axis as authoritative for the X domain. Series with
the same length as the axis are unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
Group the nice opt-out, tick-value source-of-truth, and line/area clipping
changes into a single patch version plan for @ledgerhq/lumen-ui-react-visualization.

Co-authored-by: Cursor <cursoragent@cursor.com>
gamegee and others added 2 commits June 1, 2026 15:29
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Simon Bruneaud <simon.bruneaud@ledger.fr>
Signed-off-by: Simon Bruneaud <simon.bruneaud@ledger.fr>
Signed-off-by: Simon Bruneaud <simon.bruneaud@ledger.fr>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

@zel-kass zel-kass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gamegee gamegee merged commit 0950649 into main Jun 2, 2026
23 checks passed
@gamegee gamegee deleted the dls-/761/fix-xaxis branch June 2, 2026 14:53
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