Skip to content

Commit a598343

Browse files
committed
textinfo do not leave a blank line when text is empty but print zero
1 parent 154e81e commit a598343

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

Diff for: src/traces/bar/plot.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ function calcTextinfo(calcTrace, index, xa, ya) {
538538
}
539539

540540
if(hasFlag('text')) {
541-
text.push(Lib.castOption(trace, cdi.i, 'text'));
541+
tx = Lib.castOption(trace, cdi.i, 'text');
542+
if(tx === 0 || tx) text.push(tx);
542543
}
543544

544545
if(trace.type === 'waterfall') {
Loading

Diff for: test/image/mocks/waterfall_profit-loss_2018vs2019_textinfo_base.json

+2-19
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,6 @@
3939
"Income tax (15%)",
4040
"Profit after tax"
4141
],
42-
"text": [
43-
"+ Sales",
44-
"+ Consulting",
45-
"+ Maintenance",
46-
"+ Other revenue",
47-
"= Net revenue",
48-
"- Purchases",
49-
"- Material expenses",
50-
"- Personnel expenses",
51-
"- Other expenses",
52-
"= Operating profit",
53-
"+ Investment income",
54-
"+ Financial income",
55-
"= Profit before tax",
56-
"- Income tax (15%)",
57-
"= Profit after tax"
58-
],
5942
"x": [
6043
375,
6144
128,
@@ -74,7 +57,7 @@
7457
null
7558
],
7659
"base": 0,
77-
"textinfo": "text+delta",
60+
"textinfo": "label+text+delta",
7861
"cliponaxis": false,
7962
"textposition": "outside"
8063
},
@@ -134,7 +117,7 @@
134117
null
135118
],
136119
"base": 255,
137-
"textinfo": "initial+final",
120+
"textinfo": "text+initial+final",
138121
"cliponaxis": false,
139122
"textposition": "outside"
140123
}

0 commit comments

Comments
 (0)