chartjs 中的简单条形图似乎没有显示重复的标签。它有点混乱图。请查看下面的图片。
我想知道是否可以显示所有标签,即使它有重复。这可以用简单的条形图吗?没有堆叠。
以下是示例代码:
var MONTHS = ["January", "January", "April", "April", "May", "June"];
var dataset = [{
label: "Test",
type: 'bar',
backgroundColor: barBgColor,
borderColor: barBorderColor,
borderWidth: 1,
data: [1,2,3,4,3,5]
}];
var barChartData = {
labels: MONTHS,
datasets: dataset
};
var barOptions = {
borderWidth: 2,
responsive: true,
legend: {
position: 'bottom',
},
title: {
display: true,
text: chart_data.dataset.label + ' Chart'
},
scales: {
yAxes: [{
scaleLabel: {
display: true,
labelString: chart_data.unit,
fontStyle: "italic"
}
}],
xAxes: [{
gridLines: {
display: false
}
}]
}
}
this.graph = new Chart(ctx, {
type: 'bar',
data: barChartData,
options: barOptions
});