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

Is there any way to make line transparent for a particular data? #711

Open
farhan960 opened this issue Oct 21, 2023 · 1 comment
Open

Is there any way to make line transparent for a particular data? #711

farhan960 opened this issue Oct 21, 2023 · 1 comment

Comments

@farhan960
Copy link

farhan960 commented Oct 21, 2023

I want to make a line color transparent whenever the data is 0. Is there any way to do that?

<LineChart
                    height={220}
                    withDots={false}
                    yAxisInterval={1}
                    xLabelsOffset={2}
                    withShadow={false}
                    width={widthPixel(323)}
                    withVerticalLines={false}
                    style={styles.chartStyle}
                    withHorizontalLabels={false}
                    withVerticalLabels={true}
                    data={{
                        labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
                        // labels: graphData?.xAxis ? graphData?.xAxis : [],
                        datasets: [{ data: [13, 14, 15, 16, 0, 11, 10] }]
                    }}
                    chartConfig={{
                        fillShadowGradient: "red",
                        decimalPlaces: 2,
                        backgroundColor: colors.white,
                        backgroundGradientTo: colors.white,
                        backgroundGradientFrom: colors.white,
                        color: (opacity = 2) => `brown`,
                        labelColor: () => colors.greyText,
                        style: { fillShadowGradient: colors.accentBlue },
                        propsForLabels: { fontFamily: fontFamily.appTextBold, fontSize: fontPixel(14), dx: widthPixel(5) }
                    }}
                    getDotColor={(dataPoint, dataPointIndex) => 'orange'}
 />
@farhan960 farhan960 changed the title getDotColor prop not working Is there any way to make line transparent for a particular data? Oct 21, 2023
@tobiyas09
Copy link

Add the rgba color with opacity to your dataset

datasets: [{
  data: [13, 14, 15, 16, 0, 11, 10],
  color: () => 'rgba(0,0,255,0.3)',
}]

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

2 participants