score:1

Accepted answer

since the pie chart defines an array of backgroundcolor for each dataset in it and the function is called for each datalabel on the chart, you will need a way to tell which color in the array the function should use, probably using the index will do the trick.

try something like this:

return context.dataset.backgroundcolor[context.dataindex];

Related Query

More Query from same tag