Chartjs-ChartJS custom legend doughnut separate legend from chart area

1👍

The legends namespace has been changed in V3, it is now configured in the plugins section, where you also configured the title.

To achieve an external legend you will need to use a custom plugin which you also need to configure in the plugins section.

You can copy paste the plugin from this official example: https://www.chartjs.org/docs/master/samples/legend/html.html

The only things you need to configure are:

  • for the internal legend plugin you need to disable it
  • for the custom legend plugin you need to provide it with the ID of the div it needs to target to generate the legend in.

Leave a comment