Skip to content

Commit eae47bb

Browse files
committed
fix scatterternary default logic:
- make sure that len is considered 0 if a is defined but not b and c. - make sure the a, b, c are defined before trying to slice them
1 parent e99a5a6 commit eae47bb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/traces/scatterternary/defaults.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
4444
if(c) len = Math.min(len, c.length);
4545
}
4646
else if(c) len = Math.min(len, c.length);
47+
else len = 0;
4748
}
4849
else if(b && c) {
4950
len = Math.min(b.length, c.length);
@@ -55,9 +56,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
5556
}
5657

5758
// cut all data arrays down to same length
58-
if(len < a.length) traceOut.a = a.slice(0, len);
59-
if(len < b.length) traceOut.b = b.slice(0, len);
60-
if(len < c.length) traceOut.c = c.slice(0, len);
59+
if(a && len < a.length) traceOut.a = a.slice(0, len);
60+
if(b && len < b.length) traceOut.b = b.slice(0, len);
61+
if(c && len < c.length) traceOut.c = c.slice(0, len);
6162

6263
coerce('sum');
6364

0 commit comments

Comments
 (0)