Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use different color in pie chart ?thank you #470

Closed
Ai01 opened this issue Jan 21, 2017 · 6 comments
Closed

how to use different color in pie chart ?thank you #470

Ai01 opened this issue Jan 21, 2017 · 6 comments

Comments

@Ai01
Copy link

Ai01 commented Jan 21, 2017

2017-01-21 5 10 54

@aseemevari
Copy link

aseemevari commented Jan 22, 2017

Hi,

There is a example in the Recharts examples section that demonstrates your requirements,
http://recharts.org/#/en-US/examples/PieChartWithPaddingAngle

Basically you take each Cell component and fill with your desired color

<Pie
          data={data} 
          cx={120} 
          cy={200} 
          innerRadius={60}
          outerRadius={80} 
          fill="#8884d8"
          paddingAngle={5}
        >
        	{
          	data.map((entry, index) => <Cell fill={COLORS[index % COLORS.length]}/>)
          }
        </Pie>

@Ai01
Copy link
Author

Ai01 commented Jan 22, 2017

thank you very much!

@ebartan
Copy link

ebartan commented May 17, 2022

thanks, man save my day.

@CaledoniaProject
Copy link

Are you planning to add a builtin color palate array in the future?

@ckifer
Copy link
Member

ckifer commented May 7, 2023

@CaledoniaProject I doubt it. We may add one default color or color array so it's better than black by default, but d3-scale-chromatic works well for this in general outside of recharts.

@twi05
Copy link

twi05 commented Jun 23, 2023

Thanks a lot for this!

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

No branches or pull requests

7 participants