问题描述
目前,折线图的标签和点连接到 rc-slider,随着滑块的拇指移动标签和点移动并相应地显示相应的数据。
我还希望线条的 DOT 像滑块的拇指一样工作(DOT 应该可以在线拖动)
图表和滑块的数据长度相同
在 CustomizedLabel 和 CustomizedDot 函数中,如果图表的数据索引 === 滑块的数据索引,我只是渲染它们
折线图代码
<LineChart data={sliderChartData}>
<XAxis tick={false} dataKey="name" />
<YAxis tick={false} />
<ReferenceLine
y={0}
strokeWidth={2}
stroke={dashedLineColor}
strokeDasharray="3 3"
/>
<Line
type="monotone"
activeDot={false}
dot={<CustomizedDot />}
dataKey="tranchA"
stroke={lightBlueColor}
strokeWidth={4}
>
<LabelList
dataKey="tranchA"
content={renderCustomizedLabelTrancheA}
/>
</Line>
<Line
type="monotone"
activeDot={false}
dot={<CustomizedDot />}
dataKey="tranchB"
stroke={lightBlueColor}
strokeWidth={4}
>
<LabelList
dataKey="tranchB"
content={renderCustomizedLabelTrancheB}
/>
</Line>
</LineChart>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)