feat(charts): let LineChart pin the y-axis ceiling - #67
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new optional yAxisMax prop to the LineChart component, allowing users to pin the y-axis ceiling. The feedback suggests using the nullish coalescing operator (yAxisMax ?? undefined) when assigning this value to the ECharts configuration to safely handle null values and ensure proper auto-scaling fallback.
Percentage charts read wrong when the axis scales to the data — 59% usage fills the frame like 100% would. An optional yAxisMax pins the ceiling; unset keeps the adaptive axis.
A series with gaps can carry isolated points no line segment reaches; callers mark them with per-item symbols and flip showSymbol on the series, which the shared line config used to override.
99cf559 to
58c8762
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new yAxisMax prop to the LineChart component and its type definitions, allowing users to pin the y-axis ceiling. It also updates the series mapping to preserve individual item showSymbol configurations. The reviewer suggested a minor cleanup to remove a redundant nullish coalescing operator (?? undefined) when setting the max property on the y-axis, as yAxisMax is already typed as optional.
Two small LineChart capabilities, both driven by metric charts that plot
ratio and sparse time series.
yAxisMax
A new
yAxisMaxprop pins the y-axis ceiling. Ratio charts (hit rate,usage ratio) need a fixed 0–100 axis: with auto-scaling, a series
hovering at 59% fills the frame and reads as saturation. The value is
passed through as
yAxis.max ?? undefined, so a null from an untypedcaller falls back to ECharts' auto-scaling.
Per-series showSymbol
Series data can now opt back into symbol rendering: the shared line
config sets
showSymbol: false, and previously overrode anyseries-provided value. A series with gaps can carry isolated points no
line segment reaches (e.g. a single sample from one traffic burst on a
wide time window) — the caller marks those points with per-item
symbol/symbolSizeand setsshowSymbolon the series, and theyrender instead of existing only in the hover tooltip. Continuous series
are unaffected.
Both are additive; existing callers see no behavior change.