diff --git a/src/plugins/plugin.legend.js b/src/plugins/plugin.legend.js index c358ff6804c..e790e9ba43e 100644 --- a/src/plugins/plugin.legend.js +++ b/src/plugins/plugin.legend.js @@ -53,13 +53,13 @@ defaults._set('global', { var options = chart.options.legend || {}; var usePointStyle = options.labels && options.labels.usePointStyle; - return chart._getSortedDatasetMetas().map(function(meta, i) { + return chart._getSortedDatasetMetas().map(function(meta) { var style = meta.controller.getStyle(usePointStyle ? 0 : undefined); return { text: datasets[meta.index].label, fillStyle: style.backgroundColor, - hidden: !chart.isDatasetVisible(i), + hidden: !chart.isDatasetVisible(meta.index), lineCap: style.borderCapStyle, lineDash: style.borderDash, lineDashOffset: style.borderDashOffset, @@ -70,7 +70,7 @@ defaults._set('global', { rotation: style.rotation, // Below is extra data used for toggling the datasets - datasetIndex: i + datasetIndex: meta.index }; }, this); }