Skip to content

[charts] Support percentage values for radial axis minRadius/maxRadius - #22803

Merged
JCQuintas merged 6 commits into
mui:masterfrom
JCQuintas:feat/radial-axis-percentage-radius
Jun 16, 2026
Merged

JCQuintas merged 6 commits into
mui:masterfrom
JCQuintas:feat/radial-axis-percentage-radius

Conversation

@JCQuintas

Copy link
Copy Markdown
Member

Summary

The radius axis minRadius and maxRadius props now accept percentage strings (for example '40%') in addition to numbers and pixel strings (50, '50px').

Percentages resolve against the available radius — half the smallest side of the drawing area — so the radial extent scales with the chart. This makes radial charts responsive to their container size: a percentage hole keeps its proportion while a pixel hole stays a fixed size.

Implementation

  • minRadius / maxRadius types widened from number to number | string.
  • Resolution goes through the existing getPercentageValue helper (the one the Gauge uses), keeping behavior and error messages consistent across the package.
  • No change to defaults: minRadius → 0, maxRadius → available radius.

Docs

New Radius extent section under the radius axis, with a showcase demo comparing fixed pixel vs percentage radius across two chart sizes.

// Fixed: 50px hole no matter the chart size
<radiusAxis minRadius={50} />

// Responsive: hole is always 40% of the available radius
<radiusAxis minRadius="40%" />

The `minRadius` and `maxRadius` props of the radius axis now accept
percentage strings (for example `'40%'`) in addition to numbers and
pixel strings. Percentages are resolved against the available radius
(half the smallest side of the drawing area), making radial charts
responsive to container size.

Values are resolved via the existing `getPercentageValue` helper, so
behavior and error messages stay consistent with the Gauge component.
@JCQuintas
JCQuintas requested a review from alexfauquette as a code owner June 12, 2026 10:33
@JCQuintas JCQuintas self-assigned this Jun 12, 2026
@JCQuintas JCQuintas added scope: charts Changes related to the charts. type: new feature Expand the scope of the product to solve a new problem. labels Jun 12, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Deploy preview

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 🔺+44B(+0.01%) 🔺+20B(+0.02%)
@mui/x-charts-pro 🔺+44B(+0.01%) 🔺+25B(+0.02%)
@mui/x-charts-premium 🔺+44B(+0.01%) 🔺+30B(+0.02%)
@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,910.73 ms -275.43 ms(-12.6%) | Renders: 67 (+0)

Test Duration Renders
LineChart with big data amount (with marks) 78.70 ms ▼-20.90 ms(-21.0%) 2 (+0)
SankeyChart with big data amount 8.75 ms ▼-2.84 ms(-24.5%) 2 (+0)

24 tests within noise — details


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

Comment thread packages/x-charts/src/models/axis.ts Outdated
* The maximal radius.
* Can be a number (in pixels), a pixel string (for example `'80px'`), or a percentage string
* (for example `'80%'`) relative to the available radius (half the smallest side of the drawing area).
* @default The available radius (half the smallest side of the drawing area).

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.

Isn't that simpler?

Suggested change
* @default The available radius (half the smallest side of the drawing area).
* @default '100%'

Comment on lines +17 to +20
<Stack
direction="row"
sx={{ gap: 2, alignItems: 'center', justifyContent: 'center' }}
>

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.

Would need to add a breaking point to swhich to column layout

Image

@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.

Nice follow up 👍

Just left small docs improvement suggestion

@JCQuintas
JCQuintas enabled auto-merge (squash) June 16, 2026 09:25
@JCQuintas
JCQuintas disabled auto-merge June 16, 2026 09:53
@JCQuintas
JCQuintas merged commit af33aac into mui:master Jun 16, 2026
20 of 21 checks passed
@JCQuintas
JCQuintas deleted the feat/radial-axis-percentage-radius branch June 16, 2026 09:54
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: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants