有谁知道Chart JS为什么会浪费图形空间?为什么它不占用图表的整个宽度?
图表位于引导容器中>如果这会产生影响吗?
这是我的代码:
<canvas id="mostPopularProductionApps" width="100" height="150"></canvas>
使用Javascript:
barChartCreator(prodChart, prodLabels, prodData, '# Heorku AddOns', 'Number of AddOns Per Applications');
barChartCreator: function(DOMLocation, labels, data, label, title) {
var createdChart = new Chart(DOMLocation, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: label,
data: data,
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(255, 255, 255, 1)',
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
},
title: {
display: true,
text: title
}
}
});
return createdChart;
},