Skip to content

Commit 0084efb

Browse files
committed
hovertemplate: add warning if variable can't be found
1 parent 3eaa3b9 commit 0084efb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,10 @@ lib.hovertemplateString = function(string, labels) {
10481048
if(value !== undefined) break;
10491049
}
10501050

1051-
if(value === undefined) value = match;
1051+
if(value === undefined) {
1052+
lib.warn('Variable \'' + key + '\' in hovertemplate could not be found!');
1053+
value = match;
1054+
}
10521055

10531056
if(format) {
10541057
value = d3.format(format.replace(/^:/, ''))(value);

0 commit comments

Comments
 (0)