Accepted answer

You don't have to manually pass the context to the datalabels' formatter function since the plugin takes care of this itself.

Here's a working example of the pie graph with the options specified above.

But if you want to access the chart's context in some other functions you want to pass to the options, then you can get it through the chart instance by using this.chart.ctx.

var options = {
  animation: {
    onComplete: function () {
      var chartInstance = this.chart;
      var ctx = chartInstance.ctx; // chart context

Related Query