[Chartjs]-Using Chart.js – Creating Legend for Doughnut Chart

7👍

Where you are trying to use ‘helpers’ and ‘canvas’ you do not have scope for them.

Helpers refers to Chartjs helpers, this can be easily added by creating

var helpers = Chart.helpers

Canvas refers to you race variables canvas so just add

race.chart.canvas.parentNode.parentNode.appendChild(legendHolder.firstChild);

here is a fiddle with it working

Leave a comment