Skip to content

Commit 234a30d

Browse files
committed
fall back to pre-patch value if correct point cannot be found
via #1013 (comment)
1 parent 981ed55 commit 234a30d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/plugins/legend.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ Legend.prototype.select = function(e) {
109109
// find the closest data point by checking the currently highlighted series,
110110
// or fall back to using the first data point available
111111
var highlightSeries = e.dygraph.getHighlightSeries()
112-
var point = highlightSeries ?
113-
points.find(p => p.name === highlightSeries) :
114-
points[0];
112+
var point;
113+
if (highlightSeries) {
114+
point = points.find(p => p.name === highlightSeries);
115+
if (!point)
116+
point = points[0];
117+
} else
118+
point = points[0];
115119
// determine floating [left, top] coordinates of the legend div
116120
// within the plotter_ area
117121
// offset 50 px to the right and down from the first selection point

0 commit comments

Comments
 (0)