【发布时间】:2019-07-25 22:28:07
【问题描述】:
我有一个来自chart.js 的bar chart 有两个数据集,当数据集中的值彼此相距很远时,它会正常显示。但是当它们彼此靠近时,不会显示来自第二个数据集的值
const options = {
scales: {
xAxes: [{
barPercentage: 0.1,
categoryPercentage: 0.1,
barThickness: 20,
maxBarThickness: 8,
minBarLength: 7,
gridLines: {
offsetGridLines: true
}
}]
}
};
const data = {
datasets: [{
label: '# of applications',
data: [30],
backgroundColor: [
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)'
],
borderWidth: 1
},{
label: '# of interviews',
data: [29],
backgroundColor: [
'rgba(54, 162, 235, 0.2)'
],
borderColor: [
'rgba(54, 162, 235, 1)'
],
borderWidth: 1
}]
}
当我在第一个数据集中放 30 个,在第二个数据集中放 29 个时,我只看到第一个
当我将 30 放入第一个数据集中,将 4 放入第二个数据集时,它工作正常,问题在 9 之后开始(所以 10、11 等)
【问题讨论】:
标签: javascript chart.js bar-chart