gpt4 book ai didi

Recharts:如何格式化垂直实线(将鼠标悬停在数据点上时)?

转载 作者:行者123 更新时间:2023-12-04 10:57:53 27 4
gpt4 key购买 nike

Recharts 文档描述了如何在悬停期间格式化数据点的样式以及工具提示。

然而,在悬停期间,文档中似乎没有描述出现的垂直实线(除非我遗漏了它)。

是否有允许格式化该行的 Prop ?

(如果你不知道我在说什么,那是我示例图片中“Nov-14”上方的垂直实线)

这是我的折线图和结果:

                     <ResponsiveContainer>
<LineChart data={this.props.data} margin={{ top: 5, right: 30, left: 20, bottom: 5 }}>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" tickFormatter={xFormatter}/>
<YAxis dataKey="value" tickFormatter={yFormatter}/>
<Tooltip />
<Line type="monotone" dataKey="value" stroke="#4F80E4" strokeWidth={2}/>
</LineChart>
</ResponsiveContainer>

最佳答案

您需要编辑光标 :)

<Tooltip cursor={false}/>

//题外话:既然你用了recharts,你能不能也看看我的问题Is there a way to set Background Color of XAxis

关于Recharts:如何格式化垂直实线(将鼠标悬停在数据点上时)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59064480/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com