Browse Source

Merge pull request #248 from emilsgulbis/patch-1

Fix: Sometimes index === -1
tags/v1.3.1
Shivam Mishra 5 years ago
committed by GitHub
parent
commit
f06d0c70af
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 11 deletions
  1. +13
    -11
      src/js/charts/AxisChart.js

+ 13
- 11
src/js/charts/AxisChart.js View File

@@ -405,17 +405,19 @@ export default class AxisChart extends BaseChart {
if(!s.yExtremes) return;

let index = getClosestInArray(relX, s.xAxis.positions, true);
let dbi = this.dataByIndex[index];

this.tip.setValues(
dbi.xPos + this.tip.offset.x,
dbi.yExtreme + this.tip.offset.y,
{name: dbi.formattedLabel, value: ''},
dbi.values,
index
);

this.tip.showTip();
if (index >= 0) {
let dbi = this.dataByIndex[index];

this.tip.setValues(
dbi.xPos + this.tip.offset.x,
dbi.yExtreme + this.tip.offset.y,
{name: dbi.formattedLabel, value: ''},
dbi.values,
index
);

this.tip.showTip();
}
}

renderLegend() {


Loading…
Cancel
Save