Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f78e4d

Browse files
committed
Skip customdata loop if no customdata provided
1 parent 8ce3ded commit 2f78e4d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/traces/scatter/style.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ module.exports = function style(gd) {
2626
.each(function(d) {
2727
var el = d3.select(this);
2828
var pt = el.selectAll('path.point');
29+
var trace = d.trace || d[0].trace;
2930

30-
pt.call(Drawing.pointStyle, d.trace || d[0].trace);
31+
pt.call(Drawing.pointStyle, trace);
3132

32-
pt.each(function(cd) {
33-
d3.select(this).classed('plotly-customdata', cd.data !== null && cd.data !== undefined);
34-
});
33+
if(trace.customdata) {
34+
pt.each(function(cd) {
35+
d3.select(this).classed('plotly-customdata', cd.data !== null && cd.data !== undefined);
36+
});
37+
}
3538

3639
el.selectAll('text')
37-
.call(Drawing.textPointStyle, d.trace || d[0].trace);
40+
.call(Drawing.textPointStyle, trace);
3841
});
3942

4043
s.selectAll('g.trace path.js-line')

0 commit comments

Comments
 (0)