Can someone told me how to modify bar width in Chartjs 2 bar charts. There is nothing about it in the documentation.
https://github.com/nnnick/Chart.js/tree/v2.0-dev/docsI don't know what to do.
For version 2.4.0 barThickness - Manually set width of each bar in pixels. If not set, the bars are sized automatically.
options = {
scales: {
xAxes: [{
barThickness : 73
}]
}
}
For me, trying 2.0 beta, what worked was to set the barPercentage on the xAxes scale option.
This is what I used:
var options = {
data: chartData,
type: "bar",
options: {
scales: {
xAxes: [{ barPercentage: 0.5 }]
}
}
};
var chart = new Chart(chartCtx, options);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With