Skip to content

[charts] Use the series config to define value types#22693

Merged
alexfauquette merged 10 commits into
mui:masterfrom
sai6855:value-type
Jun 10, 2026
Merged

[charts] Use the series config to define value types#22693
alexfauquette merged 10 commits into
mui:masterfrom
sai6855:value-type

Conversation

@sai6855

@sai6855 sai6855 commented Jun 5, 2026

Copy link
Copy Markdown
Member

closes #21262

@sai6855 sai6855 added typescript type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: charts Changes related to the charts. labels Jun 5, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 5, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-22693--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

Total duration: 1,968.31 ms +103.01 ms(+5.5%) | Renders: 67 (+0) | Paint: 2,876.59 ms +202.83 ms(+7.6%)

Test Duration Renders
SparkLineChart grid of 100 instances 187.77 ms 🔺+36.43 ms(+24.1%) 1 (+0)
BarChartPro with big data amount 50.77 ms 🔺+9.19 ms(+22.1%) 3 (+0)

24 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@sai6855
sai6855 marked this pull request as ready for review June 5, 2026 14:24
Copilot AI review requested due to automatic review settings June 5, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CommonSeriesType to derive callback value types from ChartsSeriesConfig[SeriesType]['valueType'] instead of taking an explicit TValue generic.
  • 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 for valueFormatter.

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.

Comment on lines 12 to 14
export interface RadialLineSeriesType
extends
CommonSeriesType<number | null, 'line'>,
RadialSeriesType,
StackableSeriesType,
CommonLineSeriesType {
extends CommonSeriesType<'line'>, RadialSeriesType, StackableSeriesType, CommonLineSeriesType {
type: 'radialLine';
Comment thread packages/x-charts/src/models/seriesType/config.ts Outdated
sai6855 and others added 2 commits June 5, 2026 20:32
@sai6855
sai6855 requested a review from alexfauquette June 5, 2026 15:49
@sai6855

sai6855 commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

ping @alexfauquette

@alexfauquette alexfauquette left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@alexfauquette
alexfauquette merged commit ed536cc into mui:master Jun 10, 2026
21 checks passed
mbrookes pushed a commit to mbrookes/mui-x that referenced this pull request Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: charts Changes related to the charts. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[charts] Use the series config to define value types

3 participants