Fix: Sometimes index === -1

Sometimes when mouse-overing container, i got `vendors.app.js:8427 Uncaught TypeError: Cannot read property 'xPos' of undefined` that is caused by `-1` index
This commit is contained in:
Emīls Gulbis 2019-10-07 14:45:16 +03:00 committed by GitHub
parent 39211a406d
commit f85daa3d6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -405,6 +405,7 @@ export default class AxisChart extends BaseChart {
if(!s.yExtremes) return;
let index = getClosestInArray(relX, s.xAxis.positions, true);
if (index >= 0) {
let dbi = this.dataByIndex[index];
this.tip.setValues(
@ -417,6 +418,7 @@ export default class AxisChart extends BaseChart {
this.tip.showTip();
}
}
renderLegend() {
let s = this.data;