【问题标题】:Add space between point of the chart and of the border chart in react-chartjs-2在 react-chartjs-2 中的图表点和边框图表点之间添加空格
【发布时间】:2020-08-06 12:50:34
【问题描述】:

我的图表:

<div style={{height: '100%', marginTop:'-20px'}}>
   <Line data={data} options={options} />
</div>

图表选项:

const options = {
  scales:{
    yAxes:[{
      scaleLabel:{
        display: true,
      }
    }]
  }
};

现在我有这种情况,第二个点停在上边界。我该如何解决这个问题?

【问题讨论】:

    标签: javascript reactjs chart.js react-chartjs-2


    【解决方案1】:

    您可以在 y 轴上定义ticks.max,如下所示:

    yAxes:[{
      ticks:{
        min: 0,
        max: 100 // or whatever value that suits you
      }
    }]
    

    【讨论】: