DLS-761/fix xaxis#728
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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
BaseAxisPropsand introducedefaultXAxisProps/defaultYAxisProps(X defaults tonice: false, Y tonice: true). - Make
getTickValuesandtoScaledPointshonoraxis.data(verbatim numeric ticks; iteration capped atxData.length). - Replace
OVERFLOW_NEGATIVE_MARGINwithOVERFLOW_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.
40ecfae to
21bd45a
Compare
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>
21bd45a to
3eab5c4
Compare
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>
3c9b30a to
093e187
Compare
Signed-off-by: Simon Bruneaud <simon.bruneaud@ledger.fr>
Signed-off-by: Simon Bruneaud <simon.bruneaud@ledger.fr>
06ff07c to
a13eb3b
Compare
|



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