From a448f62fc94dfb6212a27d62aad8db021924caee Mon Sep 17 00:00:00 2001 From: rozetko Date: Wed, 3 Aug 2022 16:24:07 +0300 Subject: [PATCH] minor fix --- src/index.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index f4861b7..8380f35 100644 --- a/src/index.ts +++ b/src/index.ts @@ -290,17 +290,12 @@ export class LinePod extends ChartwerkPod { let points = []; // datapoints in each metric that is closest to xValue/yValue position this.series.visibleSeries.forEach((serie: LineTimeSerie) => { const closestDatapoint = this.getClosestDatapoint(serie, xValue, yValue); - if(_.isNil(closestDatapoint)) { + if(_.isNil(closestDatapoint) || _.isNil(closestDatapoint[0])) { this.hideCrosshairCircle(serie.idx); - return; - } - - const xPosition = this.state.xScale(closestDatapoint[0]); - const yPosition = this.state.yScale(closestDatapoint[1]); - if(!_.isNil(closestDatapoint[0])) { - this.moveCrosshairCircle(xPosition, yPosition, serie.idx); } else { - this.hideCrosshairCircle(serie.idx); + const xPosition = this.state.xScale(closestDatapoint[0]); + const yPosition = this.state.yScale(closestDatapoint[1]); + this.moveCrosshairCircle(xPosition, yPosition, serie.idx); } points.push({