当数据被填充时,它会到达行的顶部。有没有任何选项来限制顶部,我需要显示的数字与货币符号。
我需要更改x轴以显示超过上限的内容。它有什么选项吗?

<Bar
data={incomePropertyData}
width={100}
height={450}
options={{
maintainAspectRatio: false,
legend: {
display: true,
fontColor: "#686868",
fontFamily: "kanit, sans-serif",
},
tooltips: {
titleAlign: "center",
titleMarginBottom: 8,
bodyFontFamily: "'Nunito', sans-serif",
callbacks: {
label: function (tooltipItem, data) {
var label =
data.datasets[tooltipItem.datasetIndex].label || "";
if (label) {
label += " : ";
}
label += "₹ " + tooltipItem.yLabel;
return label;
},
},
},
responsive: true,
scales: {
yAxes: [
{
ticks: {
fontFamily: "'Nunito', sans-serif",
fontSize: 14,
},
},
],
yAxes: [
{
ticks: {
fontFamily: "'Nunito', sans-serif",
fontSize: 14,
beginAtZero: true,
callback: function (value, index, values) {
return "₹ " + value;
},
},
},
],
},
}}
/>发布于 2020-04-30 03:28:57
我认为您可以尝试类似于我在这里创建的示例中的内容:https://stackblitz.com/edit/react-boilerplate-scalabw-45793890
您可以在scales: { yAxes : [{max: maxvalue}] }中使用最大值
您只需要添加一个函数,该函数获取最大值并添加"padding“。
我还简化了示例中的代码,因为yAxes和yAxes之间存在重复。
https://stackoverflow.com/questions/61508321
复制相似问题