Repository navigation
Commit d137eaa
authored
chore(charts): upgrade Recharts from 2.13 to 3.x (#2610)
## Why
Bumps `recharts` from `2.13.3` to `3.x` (`^3.2.1`). Recharts 3 is a major release that rewrote the library's internal state management. This upgrade keeps us on a maintained major and unblocks features that only exist in 3.x (portals, auto-width axes, per-axis tooltips), while preserving all existing chart behavior.
This branch is intentionally scoped to **only** the dependency upgrade. (The unrelated drill-down menu work that previously shared this worktree has been moved to its own branch.)
[Recharts v3 Migration Guide](https://github.com/recharts/recharts/wiki/3.0-migration-guide)
## What changed
Recharts 3 removed `CategoricalChartState` (the `chartX` / `chartY` / `activePayload` fields) from chart event handlers, and removed the imperative `chart.setState` escape hatch. The chart components were updated to the new API with behavior preserved:
- **`HDXMultiSeriesTimeChart`** — event handlers now derive the click/drag position from `activeCoordinate` (falling back to the native event's `offsetX`) and rebuild the drill-down per-series payload from `graphResults`. Zoom-brush selection and the click drill-down popover are unchanged from a user's perspective.
- **`DBHistogramChart`** — the `chart.setState` tooltip-pin hack is replaced with the controlled `active` / `defaultIndex` `Tooltip` props. Click-to-pin, click-again-to-unpin, and Esc-to-unpin all still work.
- **`PropertyComparisonChart`** — custom tooltip/shape typings updated to the renamed `TooltipContentProps`; the clicked bar is now selected via `activeLabel` + a `chartData` lookup.
- **`app.scss`** — hides the browser focus ring that Recharts 3's default `accessibilityLayer` paints when a chart is clicked. Charts remain keyboard-focusable; only the visual outline is suppressed.
- **`package.json` / `yarn.lock`** — `recharts@^3.2.1` and `react-is@^19.0.0` (added to the app to satisfy recharts' peer requirement under React 19).
## Testing
I have done a lot of testing on this, but we have lots of charts and lots of edge cases. Please check charts generally, specific things that were refactored below
- **Time chart**: hover tooltip (values, previous-period, nearest-series bolding), zoom-brush drag, click drill-down popover, reset zoom — on Search histogram + dashboard tiles, in both line and stacked-bar modes.
- **Histogram** (Services dashboard): hover tooltip, click-to-pin / unpin, Esc to unpin.
- **Property comparison** (Search → Delta analysis): bar colors, hover percentages, click-to-select.
- **Focus ring**: clicking any chart shows no blue outline; keyboard Tab + arrow-key navigation still works.
- Smoke-check pie tiles, number-tile sparklines, pattern-trend inline bars (syncId cursor sync), and alert reference lines.
- `CaptureActiveDot` nearest-series bolding depends on recharts' internal render order; it type-checks and works in dev but is worth an explicit look on a multi-series line chart.
- `connectNulls` null handling changed in 3.x (nulls treated as 0 when enabled) — verify series with gaps render as before.1 parent a33686e commit d137eaa
13 files changed
Lines changed: 667 additions & 230 deletions
File tree
- .changeset
- packages/app
- src
- __tests__
- components
- __tests__
- styles
- tests/e2e/page-objects
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
0 commit comments