Chartjs-Chart.js – problem with label on the right hand

0👍

The problem is that Chart.js is not aware of what chartjs-plugin-datalabels is doing. Therefore, it doesn’t reserve enough space at the right of the chart, allowing the labels of the largest bars to appear on the canvas.

This can be fixed by defining extra padding at the right of the chart as follows.

options: {
  layout: {
    padding: {
      right: 100
    }
  },
  ...

For further details, please consult the page Layout Configuration from the Chart.js documentation.

Leave a comment