【发布时间】:2019-07-30 04:21:41
【问题描述】:
我有使用 vue 的 chartjs 的 HorizontalBar,我想将比例设置为从零开始,我已经在我的选项中添加了此代码
scales: {
xAxes: [{
stacked: true,
ticks: {
beginAtZero: true,
min: 0,
}
}]
},
scaleBeginAtZero : true,
但它不起作用。
data() {
return {
data: {
labels: this.listLabel,
datasets: [{
label: "Usage",
backgroundColor: "#41946E",
data: this.listData
}]
},
options: {
legend: {
display: false,
},
label:{
display: true
},
scales: {
xAxes: [{
stacked: true,
ticks: {
beginAtZero: true,
min: 0,
}
}]
},
scaleBeginAtZero : true,
}
}
},
我希望它看起来像这样 https://ibb.co/nPfmbDf,但我得到了这样的 https://ibb.co/z7D2tP4,正如你所看到的,设备 5 的值是 10,但它没有显示条形图。
【问题讨论】:
标签: vue.js vue-chartjs