From a100058e92ebfb57b3f446f5a3bcf6e08a11ed11 Mon Sep 17 00:00:00 2001 From: Ian Page Hands Date: Wed, 28 May 2014 11:21:23 -0400 Subject: [PATCH] add cusom name support --- c3.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 0760c33..ac93357 100644 --- a/c3.js +++ b/c3.js @@ -283,9 +283,11 @@ // tooltip - show when mouseover on each data var __tooltip_show = getConfig(['tooltip', 'show'], true), __tooltip_format_title = getConfig(['tooltip', 'format', 'title']), + __tooltip_format_name = getConfig(['tooltip', 'format', 'name']), __tooltip_format_value = getConfig(['tooltip', 'format', 'value']), __tooltip_contents = getConfig(['tooltip', 'contents'], function (d, defaultTitleFormat, defaultValueFormat, color) { var titleFormat = __tooltip_format_title ? __tooltip_format_title : defaultTitleFormat, + nameFormat = __tooltip_format_name ? __tooltip_format_name : function (name) { return name; }, valueFormat = __tooltip_format_value ? __tooltip_format_value : defaultValueFormat, text, i, title, value, name, bgcolor; for (i = 0; i < d.length; i++) { @@ -296,7 +298,7 @@ text = "" + (title || title === 0 ? "" : ""); } - name = d[i].name; + name = nameFormat(d[i].name); value = valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index); bgcolor = levelColor ? levelColor(d[i].value) : color(d[i].id);
" + title + "