在 Nivo @nivo/ResponsiveLine 中添加平行于 x 轴的简单目标线

问题描述

试图让这条与 x 轴平行的灰线作为目标的标记(在 y 轴的 67%)。

enter image description here

解决方法

你可以放置一个标记道具,如:

markers={[
    {
        axis: 'y',value: 520,legend: 'TEST',lineStyle: {
            stroke: 'red',},textStyle: {
            fill: 'red',]}

该值决定了marker的位置,你可以根据你传递的数据进行计算。