如何使用fill tr​​ue在react-chart-js-2中隐藏边框

时间:2019-12-16 07:25:12

标签: reactjs charts react-chartjs react-chartist

我们添加了一个包含2个数据集的图形,即填充真实的折线图(面积图)。但是,在一个数据集中,该值变低了,它显示正确,但是我们需要隐藏浮动边框,如下面屏幕中红色块所提到的那样

enter image description here

如果某个数据集的特定点的数据不足,那么我们可以隐藏边框,因此它不应浮动在另一数据集的值中。

1 个答案:

答案 0 :(得分:1)

您可以通过保留display: false

来轻松禁用react-chartjs-2中的辅助数据
const options = {
  scales: {
    yAxes: [
      {
        type: "linear",
        display: true,
        position: "left",
        id: "y-axis-1",
      },
      {
        type: "linear",
        display: false,
        position: "right",
        id: "y-axis-2",
        gridLines: {
            drawOnArea: false,
          },
      },
    ],
  },
}