使用 onPress 事件是否可以更改条形图的特定条形颜色或样式?
https://github.com/JesperLekland/react-native-svg-charts
任何人,请帮助我。
使用 onPress 事件是否可以更改条形图的特定条形颜色或样式?
https://github.com/JesperLekland/react-native-svg-charts
任何人,请帮助我。
你应该尝试把颜色或样式放在状态,然后在 onPress 中改变它。然后将反映更改:
onPress={()=> this.setState({colors: ['#7b4173', '#a55194', '#ce6dbd', '#de9ed6']})
例如,在 StackedBarChart 中,作为道具插入:
<StackedBarChart
style={{ height: 200 }}
keys={keys}
colors={this.state.colors}
data={data}
showGrid={false}
contentInset={{ top: 30, bottom: 30 }}
/>