indiespirit / react-native-chart-kit

📊React Native Chart Kit: Line Chart, Bezier Line Chart, Progress Ring, Bar chart, Pie chart, Contribution graph (heatmap)
https://expo.io/@indiespirit/react-native-chart-kit
MIT License
2.85k stars 658 forks source link

Is there a way to add a custom background colour and data colour for each circle in the ProgressChart? #684

Closed lovestaco closed 1 year ago

lovestaco commented 1 year ago

This is my graph data

{"background": ["#A7FFA7", "#EFEF8C", "#F39A9A"], "color": ["#007F14", "#9BB500", "#A20D00"], "data": [0.1, 0.1, 0.2], "labels": ["WELL-SPENT", "RECREATION", "UNPRODUCTIVE"]}

This is my ProgressChart

 const chartConfig = {
    backgroundGradientToOpacity: 0.5,
    color: (opacity = 1) => `rgba(26, 255, 146, ${opacity})`,
  };
 <ProgressChart
    data={graphData}
    height={220}
    width={300}
    chartConfig={chartConfig}
/>

Selection_350

I tried this but it just fills in the colour and I'm not able to differentiate bw the background and data of the circle.

const chartConfig = {
    backgroundGradientToOpacity: 0.5,
   color: (opacity = 1, index) => graphData.color[index],
  };

image