From 2aac8d36291838afd3ff5f1d6de07d94b2f573b9 Mon Sep 17 00:00:00 2001 From: Juned Chhipa Date: Wed, 25 Dec 2024 16:06:57 +0530 Subject: [PATCH] fixes #1753; fixes #3641; markers disappearing after hover --- src/charts/Line.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/charts/Line.js b/src/charts/Line.js index c437f50d8..05114123c 100644 --- a/src/charts/Line.js +++ b/src/charts/Line.js @@ -297,6 +297,25 @@ class Line { 'data:realIndex': realIndex, }) + if (w.globals.hasNullValues) { + // fixes https://github.com/apexcharts/apexcharts.js/issues/3641 + const firstPoint = this.markers.plotChartMarkers( + { + x: [w.globals.minX - 100], + y: [w.globals.minY - 100], + }, + i, + 0, + 0.1, + true + ) + + if (firstPoint !== null) { + // firstPoint is rendered for cases where there are null values and when dynamic markers are required + this.elPointsMain.add(firstPoint) + } + } + // eldatalabels this.elDataLabelsWrap = graphics.group({ class: 'apexcharts-datalabels', @@ -587,7 +606,7 @@ class Line { let segmentStartX for (let j = 0; j < iterations; j++) { - if (series[i].length === 0) break; + if (series[i].length === 0) break const isNull = typeof series[i][j + 1] === 'undefined' || series[i][j + 1] === null @@ -956,7 +975,10 @@ class Line { areaPath = graphics.move(pX, pY) // Check for single isolated point - if (series[i][j + 1] === null || typeof series[i][j + 1] === 'undefined') { + if ( + series[i][j + 1] === null || + typeof series[i][j + 1] === 'undefined' + ) { linePaths.push(linePath) areaPaths.push(areaPath) // Stay in pathState = 0; @@ -1045,7 +1067,10 @@ class Line { areaPath = graphics.move(pX, pY) // Check for single isolated point - if (series[i][j + 1] === null || typeof series[i][j + 1] === 'undefined') { + if ( + series[i][j + 1] === null || + typeof series[i][j + 1] === 'undefined' + ) { linePaths.push(linePath) areaPaths.push(areaPath) // Stay in pathState = 0