Fix bug with pie/doughnut chart legends

Fixes a rendering issue when there are multiple datasets on a pie chart and they do not all contain the same number of data in their datasets
Fixes #3309
This commit is contained in:
Zach Panzarino 2016-09-16 01:29:01 +00:00
parent 5c5b1bfe59
commit 051f5b015b

View File

@ -76,7 +76,10 @@ module.exports = function(Chart) {
for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) { for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
meta = chart.getDatasetMeta(i); meta = chart.getDatasetMeta(i);
meta.data[index].hidden = !meta.data[index].hidden; // toggle visibility of index if exists
if (meta.data[index]) {
meta.data[index].hidden = !meta.data[index].hidden;
}
} }
chart.update(); chart.update();