Skip to content

feat(bar): add per-bar colors support#406

Merged
hdcodedev merged 1 commit intomainfrom
feat/bar-chart-per-bar-colors
Mar 21, 2026
Merged

feat(bar): add per-bar colors support#406
hdcodedev merged 1 commit intomainfrom
feat/bar-chart-per-bar-colors

Conversation

@hdcodedev
Copy link
Copy Markdown
Member

@hdcodedev hdcodedev commented Mar 21, 2026

Why

Fixes #139

Bar charts currently support only a single bar color, which limits visual differentiation for multi-series-like categorical data and demos.

Summary

This change adds optional per-bar color support to BarChartStyle and rendering, while preserving existing behavior when custom colors are not provided. It validates that the provided color list matches the source data size and surfaces a chart error when mismatched. In compact dense mode, colors are remapped to the bucket center bars so rendered bars keep deterministic color selection. Demo fixtures, screenshot coverage, and UI/unit tests were updated for the new behavior.

Changes

  • Add barColors: List<Color> to BarChartStyle and BarChartDefaults.style(...)
  • Validate barColors count against data points and show mismatch error
  • Render per-bar colors with fallback to default barColor
  • Map source colors to compact-density buckets using center indices
  • Add tests and screenshot references for custom per-bar colors

Release/Changeset

Notes/Risk

  • None

@github-actions
Copy link
Copy Markdown
Contributor

✅ Test Summary

Modules

  • ✅ Charts: 227 tests completed
  • ✅ Android screenshot: 104 tests completed

CI Behavior

  • ⚪ CI behavior (total): 0 tests completed

Overall

  • ✅ Total: 331 tests completed successfully

@hdcodedev hdcodedev merged commit d6658da into main Mar 21, 2026
5 of 6 checks passed
@hdcodedev hdcodedev deleted the feat/bar-chart-per-bar-colors branch March 21, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi colored Bars

1 participant