You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Doughnut/Pie generateLabels assumes backgroundColor is always set on dataset #2143
In the doughnut chart defaults, the generateLabels function assumes that data.datasets[0].backgroundColor is always set, resulting in the classic Cannot read property '0' of undefined error
labels: {generateLabels: function(data){if(data.labels.length&&data.datasets.length){returndata.labels.map(function(label,i){return{text: label,fillStyle: data.datasets[0].backgroundColor[i],hidden: isNaN(data.datasets[0].data[i]),// Extra data used for toggling the correct itemindex: i};});}else{return[];}}},
Activity
etimberg commentedon Mar 16, 2016
We could look at the objects and see what backgroundColor is set and use that.
The legend isn't great here since it assumes the color is the same for all datasets 😞