From: Zach Panzarino Date: Fri, 16 Sep 2016 01:29:01 +0000 (+0000) Subject: Fix bug with pie/doughnut chart legends X-Git-Tag: v2.3.0-rc.1~1^2~3^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F3315%2Fhead;p=thirdparty%2FChart.js.git 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 --- diff --git a/src/controllers/controller.doughnut.js b/src/controllers/controller.doughnut.js index 0e9c5fe80..e0f378dae 100644 --- a/src/controllers/controller.doughnut.js +++ b/src/controllers/controller.doughnut.js @@ -76,7 +76,10 @@ module.exports = function(Chart) { for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++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();