[charts] Add radial bar overview demo with custom overlays#22776
Merged
Conversation
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
Comment on lines
+11
to
+12
| const CURRENT_COLOR = '#1976d2'; | ||
| const PREVIOUS_COLOR = '#d32f2f'; |
Member
There was a problem hiding this comment.
might be clearer
Suggested change
| const CURRENT_COLOR = '#1976d2'; | |
| const PREVIOUS_COLOR = '#d32f2f'; | |
| const COLOR_2025 = '#1976d2'; | |
| const COLOR_2013 = '#d32f2f'; |
| scaleType: 'linear', | ||
| min: 0, | ||
| max: 10, | ||
| minRadius: 130, |
Member
There was a problem hiding this comment.
I assume this will get transformed into a percentage after PR merged :)
| } from '../dataset/europeanYouthTrust'; | ||
|
|
||
| function TrustTooltipContent() { | ||
| const item = useItemTooltip(); |
Member
There was a problem hiding this comment.
I'm surprised you're using the item and not the axis tooltip. The tooltip content is about both 2013 and 2025. Not only the bar item (2025 values)
Comment on lines
+197
to
+201
| <Stack | ||
| spacing={0.75} | ||
| sx={{ position: 'absolute', top: 8, left: 8, pointerEvents: 'none' }} | ||
| > | ||
| {items.map((item) => ( |
Member
Comment on lines
+250
to
+272
| /** | ||
| * Reads the polar scales through chart hooks and exposes helpers to place | ||
| * custom SVG relative to the chart center. Returns `null` before the scales | ||
| * are ready. | ||
| */ | ||
| export function usePolarGeometry() { | ||
| const { left, top, width, height } = useDrawingArea(); | ||
| const rotationAxis = useRotationAxis(); | ||
| const radiusAxis = useRadiusAxis(); | ||
|
|
||
| if (!rotationAxis || !radiusAxis) { | ||
| return null; | ||
| } | ||
|
|
||
| return { | ||
| cx: left + width / 2, | ||
| cy: top + height / 2, | ||
| angleScale: rotationAxis.scale, | ||
| bandwidth: rotationAxis.scale.bandwidth(), | ||
| radiusScale: radiusAxis.scale, | ||
| point: (radius, angle) => [radius * Math.sin(angle), -radius * Math.cos(angle)], | ||
| }; | ||
| } |
Member
There was a problem hiding this comment.
Look like a nice helper hook
| <RadialBarChart | ||
| dataset={europeanYouthTrust} | ||
| height={600} | ||
| margin={{ top: 24, bottom: 24, left: 24, right: 24 }} |
Member
There was a problem hiding this comment.
mbrookes
pushed a commit
to mbrookes/mui-x
that referenced
this pull request
Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
Adds an overview demo to the Radial Bars docs page, showcasing the
RadialBarChartwith custom SVG overlays.The demo visualizes average trust in others across Europe (Eurostat
ilc_pw03, population aged 16+) between 2013 and 2025, inspired by The European Correspondent's infographic:Details
childrenand read the polar scales through the publicuseRotationAxis/useRadiusAxis/useDrawingAreahooks (sharedusePolarGeometryhelper) — no internals.dataset/europeanYouthTrust.ts.