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

后端 未结 1 2030
遇见更好的自我
遇见更好的自我 2020-12-16 11:53

I\'m trying to remove the space between my bar chart bars, but even though I see this solution many places it doesn\'t work for me. It\'s also not mentioned in the Chart.js

相关标签:
1条回答
  • 2020-12-16 12:37

    You need to set barPercentage and categoryPercentage to 1.0 on the x-axis scale. Add this to your options object:

    var options = {
        ...
        scales: {
            xAxes: [{
                categoryPercentage: 1.0,
                barPercentage: 1.0
            }]
        }
    };
    

    See http://www.chartjs.org/docs/#bar-chart-chart-options

    0 讨论(0)
提交回复
热议问题