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

Cannot change fillShadow on ProgressChart #715

Open rook218 opened 10 months ago

rook218 commented 10 months ago

I've been experimenting with this all morning. None of the fillShadow... props have any effect on ProgressChart. I'm trying to get my actual data to be brighter than the underlying line, because right now there is an issue with contrast where it's difficult for a user to see how much is filled at a quick glance.

I want the opacity of the data-filled portion of the ring to be around 0.2, while I want the opacity of the fill shadow to be about 0.9. The default is more like 0.4 vs 0.6

I'm not sure if there's something I'm not understanding about the API, but I would have expected the fillShadow... props to fix this, but they have no effect at all. If I am misunderstanding this then I will update the documentation with this info when someone corrects me.

    const chartData: ProgressChartData = {
        colors: [theme.colors.error],
        data: [percentOfMonthly]
    }
    const chartConfig: ChartConfig = {
        color: (opacity = 1) => hexToRgb(theme.colors.primary, opacity), // changing the opacity default arg also has no effect
        backgroundGradientFrom: theme.colors.background,
        backgroundGradientTo: theme.colors.background,
        // None of these properties have any effect at all
        fillShadowGradientFrom: 'rgb(255, 255, 255)',
        fillShadowGradientTo: 'rgb(255, 255, 255)',
        fillShadowGradient: 'rgb(255, 255, 255)',
        fillShadowGradientOpacity: 0.5,
        fillShadowGradientFromOpacity: 0.5,
        fillShadowGradientFromOffset: 0.5,
        fillShadowGradientToOpacity: 0.5,
        fillShadowGradientToOffset: 0.5,
    }
        ...
        ...
        ...
        <ProgressChart
            chartConfig={chartConfig}
            data={chartData}
            width={50}
            height={50}
            radius={18}
            strokeWidth={6}
            hideLegend
        />
rook218 commented 10 months ago

I will note that I get the same behavior with values in different color formats. There is no effect with using 'rgb(255, 255, 255)', '#FFF' or '#FFFFFF'