Skip to content

implement customPalette prop across all chart components#147

Merged
abhithesys merged 9 commits into
mainfrom
Refactor-charts-theme-palette
Jul 3, 2025
Merged

implement customPalette prop across all chart components#147
abhithesys merged 9 commits into
mainfrom
Refactor-charts-theme-palette

Conversation

@i-subham23

Copy link
Copy Markdown
Contributor

Add support for custom color palettes in all chart components, allowing users to override default theme colors with brand-specific or custom color schemes.

Changes:

  • Add customPalette?: string[] prop to all chart component interfaces
  • Update color distribution logic to prioritize customPalette over theme
  • Add customPalette to argTypes in all story files
  • Create CustomPalette stories demonstrating usage
  • Update documentation to mention customPalette feature
  • Ensure consistent implementation across:
    • AreaChart
    • BarChart
    • LineChart
    • PieChart
    • RadarChart
    • RadialChart

The customPalette prop overrides the theme prop when provided, giving users full control over chart colors while maintaining the existing theme system as fallback.

Usage:
<ChartComponent
data={data}
categoryKey="month"
customPalette={["#FF6B6B", "#4ECDC4", "#45B7D1"]}
// theme prop is ignored when customPalette is provided
/>

Add support for custom color palettes in all chart components, allowing users to override default theme colors with brand-specific or custom color schemes.

Changes:
- Add customPalette?: string[] prop to all chart component interfaces
- Update color distribution logic to prioritize customPalette over theme
- Add customPalette to argTypes in all story files
- Create CustomPalette stories demonstrating usage
- Update documentation to mention customPalette feature
- Ensure consistent implementation across:
  - AreaChart
  - BarChart
  - LineChart
  - PieChart
  - RadarChart
  - RadialChart

The customPalette prop overrides the theme prop when provided, giving users full control over chart colors while maintaining the existing theme system as fallback.

Usage:
<ChartComponent
  data={data}
  categoryKey="month"
  customPalette={["#FF6B6B", "#4ECDC4", "#45B7D1"]}
  // theme prop is ignored when customPalette is provided
/>
import { Card } from "../../../Card";
import { AreaChart, AreaChartProps } from "../AreaChart";

const customColorPalette = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use ocean instead

@abhithesys
abhithesys merged commit 542b4a3 into main Jul 3, 2025
3 checks passed
@abhithesys
abhithesys deleted the Refactor-charts-theme-palette branch July 3, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants