Skip to content

Commit

Permalink
Merge pull request #248 from emilsgulbis/patch-1
Browse files Browse the repository at this point in the history
Fix: Sometimes index === -1
  • Loading branch information
scmmishra committed Oct 30, 2019
2 parents 39211a4 + f85daa3 commit f06d0c7
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/js/charts/AxisChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f06d0c7

Please sign in to comment.