Chartjs-ChartJs 2 How to remove numbers from the doughnut chart on loading

5👍

Chart.js does not draw any data labels itself by default. You most probably have activated (imported) a plugin such as chartjs-plugin-datalabels that draws these labels.

To disable a global plugin for a specific chart instance, the plugin options must be set to false.

In the case of chartjs-plugin-datalabels, this would be done as follows:

options: {
  plugins: {
    datalabels: {
      display: false
    }
  },
}

To avoid the cropped data labels, you can define some extra space to the left and the right of the chart through the option layout.padding as shown below:

options: {
  layout: {
    padding: {
      left: 50,
      right: 50
    }
  }
}

Leave a comment