3๐
1๐
This fixes it
works for most versions, including in react.js
import {Chart} from "chart.js"
Chart.defaults.datasets.bar.barThickness = 73;
//also try barPercentage, maxBarThickness
1๐
use this as example
var ctx = document.getElementById("my_chart").getContext("2d");
new Chart(ctx, {
type: 'bar',
data: {
labels: ["Jan", "Feb", "Mar", "Apr"],
datasets: [{
label: "Title on top",
data: [10, 80, 56, 60],
backgroundColor: "#1491e5",
barThickness: 30 //<---- here important
}]
},
options: {
maintainAspectRatio: false//<---- here important
}
});
Source:stackexchange.com