diff --git a/samples/vanilla-js/heatmap/inconsistent-timeseries.html b/samples/vanilla-js/heatmap/inconsistent-timeseries.html
new file mode 100644
index 000000000..2c144fa4c
--- /dev/null
+++ b/samples/vanilla-js/heatmap/inconsistent-timeseries.html
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+ HeatMap with inconsistent timeseries
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/charts/HeatMap.js b/src/charts/HeatMap.js
index 04056aa68..f8c0627fd 100644
--- a/src/charts/HeatMap.js
+++ b/src/charts/HeatMap.js
@@ -76,7 +76,18 @@ export default class HeatMap {
let x1 = 0
let shadeIntensity = w.config.plotOptions.heatmap.shadeIntensity
- for (let j = 0; j < heatSeries[i].length; j++) {
+ let j = 0;
+ for (let dIndex = 0; dIndex < w.globals.dataPoints; dIndex++) {
+
+ // Recognize gaps and align values based on x axis
+ if ((w.globals.minX + (w.globals.minXDiff * dIndex)) < w.globals.seriesX[i][j]) {
+ x1 = x1 + xDivision;
+ continue;
+ }
+
+ // Stop loop if index is out of array length
+ if (j >= heatSeries[i].length) break;
+
let heatColor = this.helpers.getShadeColor(
w.config.chart.type,
i,
@@ -114,7 +125,6 @@ export default class HeatMap {
cx: x1,
cy: y1,
})
-
rect.node.classList.add('apexcharts-heatmap-rect')
elSeries.add(rect)
@@ -186,6 +196,7 @@ export default class HeatMap {
}
x1 = x1 + xDivision
+ j++;
}
y1 = y1 + yDivision