Skip to content

[charts] Apply axis colorMap to radial bar fill#22800

Merged
JCQuintas merged 6 commits into
mui:masterfrom
JCQuintas:feat/radial-bar-colormap
Jun 19, 2026
Merged

[charts] Apply axis colorMap to radial bar fill#22800
JCQuintas merged 6 commits into
mui:masterfrom
JCQuintas:feat/radial-bar-colormap

Conversation

@JCQuintas

Copy link
Copy Markdown
Member

Motivation

The radialBar series already defined a color processor (getColor), but useRadialBarPlotData never invoked it — it assigned seriesItem.color directly. As a result a colorMap set on the rotation or radius axis was silently ignored and every bar fell back to the series color.

Changes

  • Invoke the radial bar color processor per series in useRadialBarPlotData, mirroring useBarPlotData in the cartesian BarChart. The band axis colorMap now colors each bar.
  • Add a "Coloring each bar" docs section to the radial bars page with a health-dashboard demo (HealthRadialBarChart) where each metric ring uses an ordinal colorMap on the radiusAxis.

In layout='horizontal' the band categories live on the radiusAxis, so an 'ordinal' color map there paints each concentric ring independently.

The radialBar color processor was defined but never invoked, so a colorMap
on the rotation or radius axis was ignored and every bar used the series
color. Call the processor in useRadialBarPlotData, mirroring BarChart, so
the band axis colorMap colors each bar.

Add a 'Coloring each bar' docs section with a health dashboard demo.
@JCQuintas JCQuintas self-assigned this Jun 12, 2026
@JCQuintas JCQuintas added scope: charts Changes related to the charts. docs Improvements or additions to the documentation. type: bug It doesn't behave as expected. 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 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 🔺+9B(0.00%) 🔺+10B(+0.01%)
@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: 2,282.97 ms 🔺+439.52 ms(+23.8%) | Renders: 63 (+0)

Test Duration Renders
Heatmap: 100x100 grid 834.13 ms 🔺+283.34 ms(+51.4%) 2 (+0)
CandlestickChart with big data amount (webgl renderer) 244.84 ms 🔺+44.64 ms(+22.3%) 5 (+0)
RangeBarChart with big data amount 95.29 ms 🔺+21.17 ms(+28.6%) 2 (+0)
BarChartPro with big data amount 52.17 ms 🔺+9.79 ms(+23.1%) 2 (+0)
LineChartPro with big data amount and zoomed in (with marks) 37.35 ms 🔺+9.44 ms(+33.8%) 2 (+0)

…and 5 more (+16 within noise) — details

Metric alarms

Test Metric Change
Heatmap: 100x100 grid bench:paint 🔺 +350.65 ms
RangeBarChart with big data amount bench:paint 🔺 +34.30 ms
LineChartPro with big data amount and zoomed in (with marks) bench:paint 🔺 +13.99 ms
HeatmapPremium: 100x100 grid (webgl renderer) bench:paint 🔺 +8.48 ms
RadialBarChart stacked with multiple series bench:paint 🔺 +6.52 ms
RadialLineChart with big data amount bench:paint 🔺 +9.82 ms
RadarChart with many axes and multiple series bench:paint 🔺 +4.57 ms
SparkLineChart grid of 100 instances bench:paint 🔺 +88.29 ms

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

@JCQuintas JCQuintas force-pushed the feat/radial-bar-colormap branch from bb10c9a to ad3b494 Compare June 12, 2026 11:40
@JCQuintas JCQuintas marked this pull request as ready for review June 17, 2026 11:53
@JCQuintas JCQuintas requested a review from alexfauquette as a code owner June 17, 2026 11:53
@JCQuintas JCQuintas closed this Jun 17, 2026
@JCQuintas JCQuintas reopened this Jun 17, 2026
@JCQuintas JCQuintas marked this pull request as draft June 17, 2026 12:22
@JCQuintas JCQuintas marked this pull request as ready for review June 17, 2026 12:35
Comment on lines +39 to +46
## Coloring each bar

Set a `colorMap` on the band axis to give each category its own color.
With `layout='horizontal'` the band categories sit on the `radiusAxis`, so an `'ordinal'` color map there paints each concentric ring independently.

The demo below uses this to build a health dashboard where every metric ring tracks progress toward its goal.

{{"demo": "HealthRadialBarChart.js", "bg": "outline"}}

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.

This section of the docs let me think only the band axis can have a color map

Might be better to link to the bar charts docs section about colorMap saying that x/y axes are replaced by rotation/radius

https://mui.com/x/react-charts/bars/#color-scale

@JCQuintas JCQuintas enabled auto-merge (squash) June 19, 2026 09:46
@JCQuintas JCQuintas merged commit 8c6d8ca into mui:master Jun 19, 2026
21 checks passed
@JCQuintas JCQuintas deleted the feat/radial-bar-colormap branch June 19, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. scope: charts Changes related to the charts. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants