case 'label':
case 'dataset':
for (var i = 0; i < this.lastActive.length; i++) {
- this.data.datasets[this.lastActive[i]._datasetIndex].controller.removeHoverStyle(this.lastActive[i], this.lastActive[i]._datasetIndex, this.lastActive[i]._index);
+ if (this.lastActive[i])
+ this.data.datasets[this.lastActive[i]._datasetIndex].controller.removeHoverStyle(this.lastActive[i], this.lastActive[i]._datasetIndex, this.lastActive[i]._index);
}
break;
default:
case 'label':
case 'dataset':
for (var j = 0; j < this.active.length; j++) {
- this.data.datasets[this.active[j]._datasetIndex].controller.setHoverStyle(this.active[j]);
+ if (this.active[j])
+ this.data.datasets[this.active[j]._datasetIndex].controller.setHoverStyle(this.active[j]);
}
break;
default:
var yPositions = [];
helpers.each(elements, function(el){
- var pos = el.tooltipPosition();
- xPositions.push(pos.x);
- yPositions.push(pos.y);
+ if(el) {
+ var pos = el.tooltipPosition();
+ xPositions.push(pos.x);
+ yPositions.push(pos.y);
+ }
});
var x = 0, y = 0;
return;
}
var currentElement = dataset.metaData[element._index];
- var yScale = element._yScale || element._scale; // handle radar || polarArea charts
-
- tooltipItems.push({
- xLabel: currentElement._xScale ? currentElement._xScale.getLabelForIndex(currentElement._index, currentElement._datasetIndex) : '',
- yLabel: yScale ? yScale.getLabelForIndex(currentElement._index, currentElement._datasetIndex) : '',
- index: element._index,
- datasetIndex: datasetIndex,
- });
+ if (currentElement) {
+ var yScale = element._yScale || element._scale; // handle radar || polarArea charts
+
+ tooltipItems.push({
+ xLabel: currentElement._xScale ? currentElement._xScale.getLabelForIndex(currentElement._index, currentElement._datasetIndex) : '',
+ yLabel: yScale ? yScale.getLabelForIndex(currentElement._index, currentElement._datasetIndex) : '',
+ index: element._index,
+ datasetIndex: datasetIndex,
+ });
+ }
});
helpers.each(this._active, function(active, i) {
- labelColors.push({
- borderColor: active._view.borderColor,
- backgroundColor: active._view.backgroundColor
- });
+ if (active) {
+ labelColors.push({
+ borderColor: active._view.borderColor,
+ backgroundColor: active._view.backgroundColor
+ });
+ }
}, this);
tooltipPosition = this.getAveragePosition(this._active);