[charts] Use the series config to define value types#22693
Conversation
Deploy previewBundle size
PerformanceTotal duration: 1,968.31 ms +103.01 ms(+5.5%) | Renders: 67 (+0) | Paint: 2,876.59 ms +202.83 ms(+7.6%)
24 tests within noise — details Check out the code infra dashboard for more information about this PR. |
There was a problem hiding this comment.
Pull request overview
This PR updates the charts series TypeScript model so that the “value type” used by series callbacks (notably valueFormatter and series-level color callbacks) is derived from ChartsSeriesConfig[SeriesType]['valueType'], aligning the public types with the central series configuration (closes #21262).
Changes:
- Refactors
CommonSeriesTypeto derive callback value types fromChartsSeriesConfig[SeriesType]['valueType']instead of taking an explicitTValuegeneric. - Updates all series type definitions (community/pro/premium) to use the new
CommonSeriesType<'seriesKey'>shape. - Adjusts series config typing (notably pie’s
valueType) and updates generated API JSON type strings forvalueFormatter.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/x-charts/src/models/seriesType/scatter.ts | Migrates scatter series typing to the new CommonSeriesType<'scatter'> form. |
| packages/x-charts/src/models/seriesType/radar.ts | Migrates radar series typing to the new CommonSeriesType<'radar'> form. |
| packages/x-charts/src/models/seriesType/pie.ts | Migrates pie series typing to the new CommonSeriesType<'pie'> form. |
| packages/x-charts/src/models/seriesType/line.ts | Migrates line series typing to the new CommonSeriesType<'line'> form. |
| packages/x-charts/src/models/seriesType/bar.ts | Migrates bar series typing to the new CommonSeriesType<'bar'> form. |
| packages/x-charts/src/models/seriesType/common.ts | Redefines CommonSeriesType to derive value/callback types from ChartsSeriesConfig. |
| packages/x-charts/src/models/seriesType/config.ts | Updates valueType definitions (incl. pie) and aligns scatter series color typing. |
| packages/x-charts/src/internals/getSeriesColorFn.ts | Updates helper typings to use SeriesColor<TValue> with config-derived constraints. |
| packages/x-charts-pro/src/models/seriesType/heatmap.ts | Migrates heatmap series typing to the new CommonSeriesType<'heatmap'> form. |
| packages/x-charts-pro/src/FunnelChart/funnel.types.ts | Migrates funnel series typing to the new CommonSeriesType<'funnel'> form. |
| packages/x-charts-premium/src/models/seriesType/rangeBar.ts | Migrates rangeBar series typing to the new CommonSeriesType<'rangeBar'> form. |
| packages/x-charts-premium/src/models/seriesType/radialLine.ts | Migrates radialLine series typing (note: one key mismatch called out in comments). |
| packages/x-charts-premium/src/models/seriesType/radialBar.ts | Migrates radialBar series typing to the new CommonSeriesType<'radialBar'> form. |
| packages/x-charts-premium/src/models/seriesType/ohlc.ts | Migrates ohlc series typing to the new CommonSeriesType<'ohlc'> form. |
| packages/x-charts-premium/src/models/seriesType/mapShape.ts | Migrates mapShape series typing to the new CommonSeriesType<'mapShape'> form. |
| docs/pages/x/api/charts/scatter-series.json | Updates API JSON type string for valueFormatter to reflect config-derived value typing. |
| docs/pages/x/api/charts/radar-series.json | Updates API JSON type string for valueFormatter. |
| docs/pages/x/api/charts/pie-series.json | Updates API JSON type string for valueFormatter. |
| docs/pages/x/api/charts/line-series.json | Updates API JSON type string for valueFormatter. |
| docs/pages/x/api/charts/funnel-series.json | Updates API JSON type string for valueFormatter. |
| docs/pages/x/api/charts/bar-series.json | Updates API JSON type string for valueFormatter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export interface RadialLineSeriesType | ||
| extends | ||
| CommonSeriesType<number | null, 'line'>, | ||
| RadialSeriesType, | ||
| StackableSeriesType, | ||
| CommonLineSeriesType { | ||
| extends CommonSeriesType<'line'>, RadialSeriesType, StackableSeriesType, CommonLineSeriesType { | ||
| type: 'radialLine'; |
Co-authored-by: Alexandre Fauquette <[email protected]> Signed-off-by: sai chand <[email protected]>
|
ping @alexfauquette |
Signed-off-by: sai chand <[email protected]> Co-authored-by: Alexandre Fauquette <[email protected]>
closes #21262