[Chartjs]-Chartjs: How can I group datasets closer if I have maxBarThickness set?

2👍

According to this github issue you cannot change the space between bars if you decide to set a barThickness (I assume it does not work when maxBarThickness is set either but I might be wrong, if so I’ll delete this answer)

According to the previous link, you have two solutions:

  • If you want to keep your bar thickness (answer to the github issue):

If you don’t want to stretch out the bar to fill the extra space, you have to reduce the width of the canvas.

  • Otherwise you could set a barPercentage and a categoryPercentage on your chart, without a barThickness or a maxBarThickness:

    scales: {
      xAxes: [{
        categoryPercentage: 0.8,
        barPercentage: 0.9
      }]
    },
    

Those are the default values.


Related questions :

Chart.js Bar Chart: How to remove space between the bars in v2.3?

CharJS 2.5.0 – How to remove space between bars

Reduce space between ticks in horizontal bar-chart chartJS

Leave a comment