Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to change particular index of BarChart Bar Color using react native?

$
0
0

In my scenario, I am using react-native-svg-chart to displaying BarChart with only BarChart data. Here, general fill colour for BarChart I given in render. Now, I want to achieve bar-chart last index bar should show red colour. How to achieve this in render logic like below.

<BarChart              style={Styles.chartStyle}              data={props.data}              numberOfTicks={props.numberOfTicks}              spacingInner={12}              spacingOuter={12}              contentInset={Styles.verticalContentInset}              gridMax={props.yMax}              gridMin={0}              svg={{ fill: props.data.length -1 ? 'red' : 'green'}} // How to make it here, array of last index data only green color?</BarChart>

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>