From 88225b94b33a2ec2dd14c9efc27c0ca048aba757 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Sun, 3 Nov 2024 21:10:37 -0500 Subject: [PATCH] fix(graph): gradient color fallback Added a fallback to use the `stop.color` when threshold values are outside the visible range. This prevents undefined colors from causing unexpected graph rendering behavior, such as turning blue near the edges. --- src/graph.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graph.js b/src/graph.js index 84697d4..98e616a 100644 --- a/src/graph.js +++ b/src/graph.js @@ -166,6 +166,8 @@ export default class Graph { } else if (stop.value < this._min && arr[index - 1]) { const factor = (arr[index - 1].value - this._min) / (arr[index - 1].value - stop.value); color = interpolateColor(arr[index - 1].color, stop.color, factor); + } else { + color = stop.color; } let offset; if (scale <= 0) {