Skip to content

Commit d137eaa

Browse files
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

‎.changeset/recharts-3-upgrade.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@hyperdx/app": minor
3+
---
4+
5+
chore(charts): upgrade Recharts from 2.13 to 3.x. Reworks chart event handlers
6+
to the Recharts 3 event API (zoom-brush selection, click drill-down), replaces
7+
the histogram's imperative `chart.setState` tooltip-pin hack with the controlled
8+
`active`/`defaultIndex` Tooltip props, updates custom tooltip/shape typings
9+
(`TooltipContentProps`, `BarProps`), and suppresses the browser focus ring that
10+
Recharts 3's default `accessibilityLayer` shows when a chart is clicked.

‎packages/app/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@
8484
"react-grid-layout": "^1.3.4",
8585
"react-hook-form": "^7.43.8",
8686
"react-hotkeys-hook": "^4.3.7",
87+
"react-is": "^19.0.0",
8788
"react-json-tree": "^0.20.0",
8889
"react-markdown": "^10.1.0",
8990
"react-resizable": "^3.0.4",
90-
"recharts": "^2.12.7",
91+
"recharts": "^3.2.1",
9192
"rrweb": "2.0.0-alpha.8",
9293
"sass": "^1.54.8",
9394
"sql-formatter": "^15.7.2",

0 commit comments

Comments
 (0)