在 react-chartjs-2 的图表点和边框图表点之间添加 space
Add space between point of the chart and of the border chart in react-chartjs-2
我的图表:
<div style={{height: '100%', marginTop:'-20px'}}>
<Line data={data} options={options} />
</div>
图表选项:
const options = {
scales:{
yAxes:[{
scaleLabel:{
display: true,
}
}]
}
};
现在我遇到这种情况,第二个点停在上边界。我该如何解决这个问题?
您可以在 y-axis 上定义 ticks.max
如下:
yAxes:[{
ticks:{
min: 0,
max: 100 // or whatever value that suits you
}
}]
我的图表:
<div style={{height: '100%', marginTop:'-20px'}}>
<Line data={data} options={options} />
</div>
图表选项:
const options = {
scales:{
yAxes:[{
scaleLabel:{
display: true,
}
}]
}
};
现在我遇到这种情况,第二个点停在上边界。我该如何解决这个问题?
您可以在 y-axis 上定义 ticks.max
如下:
yAxes:[{
ticks:{
min: 0,
max: 100 // or whatever value that suits you
}
}]