-
-
Notifications
You must be signed in to change notification settings - Fork 237
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 change line color #8
Comments
Never mind i did not read the documentation in https://react-charts.js.org/#/story/custom-styles |
I just noticed that i cant change the default color is there any way to change it? for example in a pie chart with 1 Series and i want to change the default color.. |
Here's how I added styled to my chart:
I found the docs super confusing and over complicated so I hope this helps. |
Okay so after spending a lot of time searching and experimenting with the chart because the Docs and API wasn't helping at all, I discovered a very simple way to change the default color of the line/column chart, without using the const data = React.useMemo( () => [ { label: 'Series 1', data: [ { primary: 'Oct', secondary: 10 }, ], color: '#1f77b4' }, { label: 'Series 2', data: [ { primary: 'Oct', secondary: 5 }, ], color: '#ff7f0e' }, { label: 'Series 3', data: [ { primary: 'Oct', secondary: 7 }, ], color: '#ffff4d' } ], [] ) hope this helps. |
For those trying to do this in v3.0.0 with a bar graph or something you can use <Chart
options={{
defaultColors: [ '#00ccff', '#008800', '#ddaacc', /*Array of colors*/ ],
data,
primaryAxis,
secondaryAxes,
}}
/> |
Can I use it with line or area charts? Also can you please tell which index represents which element? I want to set the fill, points, line colors |
First of all thank you for the react chart. Help me a lot in my project. This is not really an issue i just want to know how to change the line color.
Thanks
The text was updated successfully, but these errors were encountered: