Skip to content

Commit 1a74f4d

Browse files
author
Aarón Contreras
committed
Prevent calculating legend for missing (?) points 🐛
1 parent 23c3f32 commit 1a74f4d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src-es5/plugins/legend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ Legend.prototype.select = function (e) {
120120
var point = highlightSeries ? points.find(function (p) {
121121
return p.name === highlightSeries;
122122
}) : points[0];
123+
// guard against missing point
124+
if (!point) return;
123125
// determine floating [left, top] coordinates of the legend div
124126
// within the plotter_ area
125127
// offset 50 px to the right and down from the first selection point

src/plugins/legend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Legend.prototype.select = function(e) {
113113
var point = highlightSeries
114114
? points.find(p => p.name === highlightSeries)
115115
: points[0]
116+
// guard against missing point
117+
if (!point) return;
116118
// determine floating [left, top] coordinates of the legend div
117119
// within the plotter_ area
118120
// offset 50 px to the right and down from the first selection point

0 commit comments

Comments
 (0)