From 4069f103242732cbb8e45cd5ac28639dbda8bf74 Mon Sep 17 00:00:00 2001 From: Ross Johnson <159597299+rosco54@users.noreply.github.com> Date: Sun, 7 Apr 2024 21:13:42 +1000 Subject: [PATCH] Lines from series with only two points were not rendering. --- src/charts/Line.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/charts/Line.js b/src/charts/Line.js index 44ebae3a5..ebbf9e70e 100644 --- a/src/charts/Line.js +++ b/src/charts/Line.js @@ -933,11 +933,14 @@ class Line { } areaPath = graphics.move(pX, pY) - let p = graphics.curve(pX + length, pY, x - length, y, x, y) - linePath += p - areaPath += p pathState = 1 - break + if (j < series[i].length - 2) { + let p = graphics.curve(pX + length, pY, x - length, y, x, y) + linePath += p + areaPath += p + break + } + // Continue on with pathState 1 to finish the path and exit case 1: // Continuing with segment if (series[i][j + 1] === null) { @@ -1016,11 +1019,14 @@ class Line { } areaPath = graphics.move(pX, pY) - let p = pathToPoint(curve, x, y) - linePath += p - areaPath += p pathState = 1 - break + if (j < series[i].length - 2) { + let p = pathToPoint(curve, x, y) + linePath += p + areaPath += p + break + } + // Continue on with pathState 1 to finish the path and exit case 1: // Continuing with segment if (series[i][j + 1] === null) {