[英]Is there a way to change the fill of a Cell in a Bar Chart on Hover? - Recharts
I currently render the chart like this:我目前这样渲染图表:
<BarChart width={868} height={40} data={data}
margin={{top:0, bottom: 10, left:0, right:0}} barSize={5}>
<Tooltip
labelStyle={{ textAlign: 'left' }}
cursor={{fill: "blue"}}
position={{ x: this.state.mouseX - 20, y:-5 }}
/>
<Bar dataKey="blocks"
onMouseOver={e => this.getMouseX(e)} >
{
data.map((entry, index) => {
const result = entry.result > 4 ? TRASH : NO_TRASH;
return <Cell fill={result} key={index}/>;
})
}
</Bar>
</BarChart>
Is there a way to change the cell/bar color, not cursor when you hover the bar?当你 hover 酒吧时,有没有办法改变单元格/栏颜色,而不是 cursor?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.