Skip to content

Commit

Permalink
Remove dataset while hovered (#8181)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeLenaleee committed Dec 16, 2020
1 parent 5e22f56 commit f191f2f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/core.controller.js
Expand Up @@ -725,7 +725,7 @@ class Chart {
hidden: null, // See isDatasetVisible() comment
xAxisID: null,
yAxisID: null,
order: dataset.order || 0,
order: dataset && dataset.order || 0,
index: datasetIndex,
_dataset: dataset,
_parsed: [],
Expand Down Expand Up @@ -808,7 +808,7 @@ class Chart {
const me = this;
const meta = me._metasets && me._metasets[datasetIndex];

if (meta) {
if (meta && meta.controller) {
meta.controller._destroy();
delete me._metasets[datasetIndex];
}
Expand Down Expand Up @@ -933,8 +933,9 @@ class Chart {

for (i = 0, ilen = items.length; i < ilen; ++i) {
item = items[i];
if (item) {
this.getDatasetMeta(item.datasetIndex).controller[prefix + 'HoverStyle'](item.element, item.datasetIndex, item.index);
const controller = item && this.getDatasetMeta(item.datasetIndex).controller;
if (controller) {
controller[prefix + 'HoverStyle'](item.element, item.datasetIndex, item.index);
}
}
}
Expand Down

0 comments on commit f191f2f

Please sign in to comment.