so I want to draw two lines on my chart, I gave each line a different color using color
. I want to give each line a different shadow as well. However by changing withShadow
, it will either true
for both or false
for both, cannot each for each. I wish I could use the shadow for one dataset and not the other or have it of different color for each.
<LineChart
data={{
labels: dataDayOfWeek,
datasets: [
{
data: dataValueNew,
color: `rgba(25, 255, 12, 1)`,
},
{
data: dataValueOld,
color: `rgba(25, 255, 12, 0)`,
withShadow: false, //this did not work
},
],
}}
/>;
There's a pretty simple feature for it. It took me also, an hour to figure out it.
The chartConfig has a field called, useShadowColorFromDataSet -> Boolean Here's the documentation - https://github.com/indiespirit/react-native-chart-kit
Just declare that in the chartConfig and then use the Color field in datasets and you'll be done.
Here's a sample code snippet ->
Well, it was always present in the docs. Which teaches, that always read the docs properly. It took me an hour to figure it out.