Skip to content

Commit ff62258

Browse files
committed
avoid formatting missing data in texttemplate
1 parent 22ea112 commit ff62258

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/lib/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,9 @@ function templateFormatString(string, labels, d3locale) {
12191219
var fmt;
12201220
if(format[0] === ':') {
12211221
fmt = d3locale ? d3locale.numberFormat : lib.numberFormat;
1222-
value = fmt(format.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, ''))(value);
1222+
if(value !== '') { // e.g. skip missing data on heatmap
1223+
value = fmt(format.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, ''))(value);
1224+
}
12231225
}
12241226

12251227
if(format[0] === '|') {
-2.08 KB
Loading

0 commit comments

Comments
 (0)