feat(highlight): Add support to configure dimmed (unhighlight) colors for Bar and Partition charts#2774
Conversation
- Add dimmed property to RectStyle and ArcStyle interfaces - Define barFill and arcFill in LIGHT_DIMMED_COLORS and DARK_DIMMED_COLORS - Implement dimmed.fill color rendering in buildBarStyle function - Use reference equality to detect unhighlighted state (geometryStateStyle === sharedStyle.unhighlighted) - Update all theme variants (light, dark, legacy, amsterdam) with dimmed configurations - Add dimmed opacity (0.25) to legacy and amsterdam themes for consistency - Update bar.test.ts to include sharedStyle parameter - Enhance Storybook stories with more series for testing dimming behavior - Add useDimmedColors control to sunburst story for arc testing - Add TODO comments in partition chart renderer for future arc dimming implementation Subject to visual review and calibration of shade values.
Option B: Hybrid Approach - SVG overlay (HighlighterFromHover) for direct slice hover - Canvas dimming for legend hover (consistent with bar/line/area charts) Implementation: - Add highlightedLegendPath to partition chart canvas renderer props - Pass legend path through rendering pipeline to all three renderers - Calculate highlighted quads using highlightedGeoms utility - Apply dimmed.fill colors in renderSectors and renderRectangles - Remove HighlighterFromLegend component (no longer needed) - Keep HighlighterFromHover for immediate slice hover feedback - Update sunburst story to use theme's default dimmed colors Benefits: - Minimally invasive - no architectural changes to hover highlighting - Consistent dimming behavior across all chart types - Better performance (no SVG overlay for legend interactions) - Single source of truth for legend dimming
… renderers The legend hover wasn't working because: 1. highlightedGeoms needs legendStrategy and flatLegend from settings 2. Dimmed fill color needs to come from theme.arcSeriesStyle, not style.arcSeriesStyle (ShapeViewModel.style is Theme['partition'], not the full theme) Changes: - Add legendStrategy and flatLegend to partition canvas renderer props - Add arcSeriesStyle from theme to props - Pass all three through to renderPartitionCanvas2d and other renderers - Use arcSeriesStyle.arc.dimmed.fill instead of style.arcSeriesStyle - Call highlightedGeoms with proper legendStrategy and flatLegend settings
Added controls to test different shade colors for dimmed/unhighlighted states: 1. New Story: Stylings -> Dimmed Colors (27_dimmed_colors.story.tsx) - Permanent feature for users to configure dimmed colors - Shows mixed chart types (bars + lines + areas with points) - Provides shade selection for all XY chart types 2. Enhanced: Legend -> Piechart (10_sunburst.story.tsx) - Added shade color selector for partition charts - Supports all partition layouts (sunburst, treemap, mosaic, waffle) - Allows testing different opacity levels 3. Enhanced: Interactions -> Bar Clicks (1_bar_clicks.story.tsx) - Added shade color selector for bar charts - Allows comparison with existing series Shade Options: - Light mode: shade30 @ 15% to 50% (default: 35%) - Dark mode: shade60 @ 15% to 50% (default: 35%) - 5% increment intervals for fine-tuning This allows visual review and calibration of dimmed colors across all chart types as mentioned in GitHub issue elastic#2416.
… for testing shade/alpha combinations. The story offers: - Test different shade colors from EUI Borealis palette (shade15-shade145) - Test different alpha/opacity values (10%-100% in 5% increments) - See dimmed effect on both partition charts (sunburst/treemap) and XY charts (bar/line/area) - View real-time info panel showing current dimmed color and hovered series
|
buildkite test this |
- Fix LegendPath import path (from state/actions/legend) - Fix LegendStrategy import path (from layout/utils/highlighted_geoms) - Add AnimationState import in canvas_renderers - Add proper type guards for dimmed.fill to handle union type - Update Jest snapshots for bar rendering tests
Revert the test-only additions to 1_bar_clicks.story.tsx and 10_sunburst.story.tsx to avoid VRT baseline changes. The dedicated 27_dimmed_highlight_style.story.tsx serves the testing purpose.
|
buildkite update vrt |
|
buildkite test this |
|
buildkite build this |
|
Thank you @awahab07 for putting this together, I finally got time to look at it and it works great! I think we just have a couple of things to settle before proceeding:
Thanks again Abdul! |
Default shades have been updated to reflect these values.
I've kept them as before.
This should be tackled in #2514, as a follow-up, as mentioned in. But could be evaluated/discussed to see if a separate on-the-fly border should be implemented just for highlight/unhighlight purposes. |
|
buildkite update vrt |
|
buildkite test this |
…-state-style-for-partition-charts-and-barcharts # Conflicts: # e2e/screenshots/legend_stories.test.ts-snapshots/legend-stories/should-all-values-in-stacked-chart-with-filtered-series-nick-chrome-linux.png # e2e/screenshots/legend_stories.test.ts-snapshots/legend-stories/should-render-legend-action-on-mouse-hover-chrome-linux.png
|
buildkite update vrt |
markov00
left a comment
There was a problem hiding this comment.
There are a couple of points that requires changes: missing waffle implementation and also the fixing some missing colorVariant checks
packages/charts/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts
Outdated
Show resolved
Hide resolved
packages/charts/src/chart_types/xy_chart/renderer/canvas/points.ts
Outdated
Show resolved
Hide resolved
packages/charts/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts
Outdated
Show resolved
Hide resolved
packages/charts/src/chart_types/partition_chart/renderer/canvas/partition.tsx
Show resolved
Hide resolved
- Remove `PartitionDimmedStyle.stroke` prop - Use `getColorFromVariant` in renderered for dimmed fill colors - Add dimming for Waffle renderer - Conver waffle legend dimming with an e2e
…n dimmiing is defined by `{ opacity: number }` (same as line/area/point renderers handle that).
|
buildkite update vrt |
markov00
left a comment
There was a problem hiding this comment.
Thanks for the changes, looks good to me now.
Please just verify why a test includes a font change
...test.ts-snapshots/metric/should-render-metric-with-value-in-middle-position-chrome-linux.png
Show resolved
Hide resolved
mariairiartef
left a comment
There was a problem hiding this comment.
LGTM! 🚀 I've tested it and I didn't find any issues, thanks for addressing the comments
|
buildkite update vrt |
# [71.4.0](v71.3.0...v71.4.0) (2026-03-31) ### Bug Fixes * **legend:** avoid re-rendering ([#2646](#2646)) ([0ca3289](0ca3289)) * **legend:** keep legend values visible when hiding series in list layout ([#2807](#2807)) ([c5089f5](c5089f5)) ### Features * **highlight:** Add support to configure dimmed (unhighlight) colors for Bar, Partition, Waffle and Flame charts ([#2774](#2774)) ([b39e24d](b39e24d)), closes [#ECF1F9](https://github.com/elastic/elastic-charts/issues/ECF1F9) [#384861](https://github.com/elastic/elastic-charts/issues/384861) * **metric:** Add ability to vertically align the metrics values to the middle of the chart ([#2783](#2783)) ([54ca7cb](54ca7cb)) * **theme:** set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500 ([#2802](#2802)) ([fbb8834](fbb8834))
## Summary This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@elastic/charts](https://github.com/elastic/elastic-charts) | dependencies | minor | [`71.3.0` -> `71.4.0`](elastic/elastic-charts@v71.3.0...v71.4.0) | ### Release Notes # [71.4.0](elastic/elastic-charts@v71.3.0...v71.4.0) (2026-03-31) ### Bug Fixes * **legend:** avoid re-rendering ([#2646](elastic/elastic-charts#2646)) ([0ca3289](elastic/elastic-charts@0ca3289)) * **legend:** keep legend values visible when hiding series in list layout ([#2807](elastic/elastic-charts#2807)) ([c5089f5](elastic/elastic-charts@c5089f5)) ### Features * **highlight:** Add support to configure dimmed (unhighlight) colors for Bar, Partition, Waffle and Flame charts ([#2774](elastic/elastic-charts#2774)) ([b39e24d](elastic/elastic-charts@b39e24d)), closes [#ECF1F9](https://github.com/elastic/elastic-charts/issues/ECF1F9) [#384861](https://github.com/elastic/elastic-charts/issues/384861) * **metric:** Add ability to vertically align the metrics values to the middle of the chart ([#2783](elastic/elastic-charts#2783)) ([54ca7cb](elastic/elastic-charts@54ca7cb)) * **theme:** set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500 ([#2802](elastic/elastic-charts#2802)) ([fbb8834](elastic/elastic-charts@fbb8834)) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Abdul Zahid <awahab07@yahoo.com>
## Summary This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@elastic/charts](https://github.com/elastic/elastic-charts) | dependencies | minor | [`71.3.0` -> `71.4.0`](elastic/elastic-charts@v71.3.0...v71.4.0) | ### Release Notes # [71.4.0](elastic/elastic-charts@v71.3.0...v71.4.0) (2026-03-31) ### Bug Fixes * **legend:** avoid re-rendering ([elastic#2646](elastic/elastic-charts#2646)) ([0ca3289](elastic/elastic-charts@0ca3289)) * **legend:** keep legend values visible when hiding series in list layout ([elastic#2807](elastic/elastic-charts#2807)) ([c5089f5](elastic/elastic-charts@c5089f5)) ### Features * **highlight:** Add support to configure dimmed (unhighlight) colors for Bar, Partition, Waffle and Flame charts ([elastic#2774](elastic/elastic-charts#2774)) ([b39e24d](elastic/elastic-charts@b39e24d)), closes [#ECF1F9](https://github.com/elastic/elastic-charts/issues/ECF1F9) [#384861](https://github.com/elastic/elastic-charts/issues/384861) * **metric:** Add ability to vertically align the metrics values to the middle of the chart ([elastic#2783](elastic/elastic-charts#2783)) ([54ca7cb](elastic/elastic-charts@54ca7cb)) * **theme:** set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500 ([elastic#2802](elastic/elastic-charts#2802)) ([fbb8834](elastic/elastic-charts@fbb8834)) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Abdul Zahid <awahab07@yahoo.com>


Summary
Unhighlighted series in bar and partition charts now display a neutral dimmed color instead of reduced opacity, matching the existing behavior in line and area charts.
When hovering over a legend item or series, unhighlighted elements render with a solid neutral gray color:
#ECF1F9) at 100% opacity#384861) at 100% opacityThis provides better visual distinction and consistency across all chart types.
245829_neautral_color_for_unhighlighted_chart_items.mov
Details
Theme Configuration
blueGrey110(#384861) toPRIMITIVE_COLORSandshade110toSEMANTIC_COLORSinbase_colors.tsto align with the latest EUI Borealis paletteLIGHT_DIMMED_COLORS.barFillandarcFillto use solidshade15(#ECF1F9)DARK_DIMMED_COLORS.barFillandarcFillto use solidshade110(#384861)Storybook
Issues
Implements the feature required by elastic/kibana#245829.
Checklist
:xy,:partition):interactions,:axis)closes #123,fixes #123)packages/charts/src/index.tslightanddarkthemes