From e60f0f9e682dc7e5e175841b619ea4788172f961 Mon Sep 17 00:00:00 2001 From: Chris Vaszauskas Date: Fri, 9 Jan 2015 09:31:39 -0600 Subject: [PATCH] Control whether tooltip is displayed by value --- src/tooltip.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tooltip.js b/src/tooltip.js index 59af9fc..50446f1 100644 --- a/src/tooltip.js +++ b/src/tooltip.js @@ -38,14 +38,16 @@ c3_chart_internal_fn.getTooltipContent = function (d, defaultTitleFormat, defaul text = "" + (title || title === 0 ? "" : ""); } - name = nameFormat(d[i].name, d[i].ratio, d[i].id, d[i].index); value = valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index); - bgcolor = $$.levelColor ? $$.levelColor(d[i].value) : color(d[i].id); + if (value !== undefined) { + name = nameFormat(d[i].name, d[i].ratio, d[i].id, d[i].index); + bgcolor = $$.levelColor ? $$.levelColor(d[i].value) : color(d[i].id); - text += ""; - text += ""; - text += ""; - text += ""; + text += ""; + text += ""; + text += ""; + text += ""; + } } return text + "
" + title + "
" + name + "" + value + "
" + name + "" + value + "
"; };