我正在尝试用chartjs建立一个条形图,在相邻的酒吧之间应该没有空间。我的问题是,我不摆脱边界条之间: Bars with bordersChartjs无边界条形图
这是我的配置:在你的数据集
new Chart($('#weekly-availabilities-chart'), {
type: 'bar',
data: {
labels: ...,
datasets: [
{
backgroundColor: 'rgba(153, 193, 72, 0.4)',
label: 'label a',
borderWidth: 0,
data: dataset_1
}, {
backgroundColor: 'rgba(13, 39, 73, 0.4)',
label: 'label b',
borderWidth: 0,
data: dataset_2
}
]
},
options: {
scales: {
xAxes: [
{
barPercentage: 1,
categoryPercentage: 1,
gridLines: {
display: false
}
}
],
yAxes: [
{
stacked: true,
gridLines: {
color: 'rgba(0,0,0,0.05)'
},
ticks: {
beginAtZero: true,
max: 40
}
}
]
}
}
});
检查此https://jsfiddle.net/07pzys9t/2/ –