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

Skip to content

Commit 00a8dba

Browse files
committed
check for missing text within an array
1 parent 5453e79 commit 00a8dba

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/drawing/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,11 @@ var TEXTOFFSETSIGN = {start:1, end:-1, middle:0, bottom:1, top:-1},
296296
LINEEXPAND = 1.3;
297297
drawing.textPointStyle = function(s, trace) {
298298
s.each(function(d){
299-
var p = d3.select(this);
300-
if(!d.tx && !trace.text) {
299+
var p = d3.select(this),
300+
text = d.tx || trace.text;
301+
if(!text || Array.isArray(text)) {
302+
// isArray test handles the case of (intentionally) missing
303+
// or empty text within a text array
301304
p.remove();
302305
return;
303306
}
@@ -320,7 +323,7 @@ drawing.textPointStyle = function(s, trace) {
320323
fontSize,
321324
d.tc || trace.textfont.color)
322325
.attr('text-anchor',h)
323-
.text(d.tx || trace.text)
326+
.text(text)
324327
.call(Plotly.util.convertToTspans);
325328
var pgroup = d3.select(this.parentNode),
326329
tspans = p.selectAll('tspan.line'),

0 commit comments

Comments
 (0)