diff --git a/src/plugins/plugin.tooltip.js b/src/plugins/plugin.tooltip.js index 2e881417f78..a24d0f7dde3 100644 --- a/src/plugins/plugin.tooltip.js +++ b/src/plugins/plugin.tooltip.js @@ -120,15 +120,29 @@ function splitNewlines(str) { function createTooltipItem(chart, item) { const {element, datasetIndex, index} = item; const controller = chart.getDatasetMeta(datasetIndex).controller; - const {label, value} = controller.getLabelAndValue(index); + + if (controller) { + const {label, value} = controller.getLabelAndValue(index); + + return { + chart, + label, + parsed: controller.getParsed(index), + raw: chart.data.datasets[datasetIndex].data[index], + formattedValue: value, + dataset: controller.getDataset(), + dataIndex: index, + datasetIndex, + element + }; + } return { chart, - label, - parsed: controller.getParsed(index), - raw: chart.data.datasets[datasetIndex].data[index], - formattedValue: value, - dataset: controller.getDataset(), + label: '', + parsed: undefined, + raw: undefined, + formattedValue: '', dataIndex: index, datasetIndex, element