Created
May 10, 2020 22:04
-
-
Save AndrewBuntsev/3775bec0974f207d8394e8dfebc71665 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contents: function (d, defaultTitleFormat, defaultValueFormat, color) { | |
var $$ = this, config = $$.config, | |
titleFormat = config.tooltip_format_title || defaultTitleFormat, | |
nameFormat = config.tooltip_format_name || function (name) { return name; }, | |
valueFormat = config.tooltip_format_value || defaultValueFormat, | |
text, i, title, value, name, bgcolor; | |
d.sort(function(a, b){ | |
return a.value - b.value; | |
}); | |
for (i = 0; i < d.length; i++) { | |
if (!(d[i] && (d[i].value || d[i].value === 0))) { continue; } | |
if (!text) { | |
title = titleFormat ? titleFormat(d[i].x) : d[i].x; | |
text = "" + (title || title === 0 ? "" : ""); | |
} | |
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); | |
text += ""; | |
text += ""; | |
text += ""; | |
text += ""; | |
} | |
return text + "<table class="" + $$.CLASS.tooltip + ""><tbody> | |
<tr><th colspan="2">" + title + "</th></tr> | |
<tr class="" + $$.CLASS.tooltipName + "-" + d[i].id + ""><td class="name"><span style="background-color: " + bgcolor + ";"></span>" + name + "</td><td class="value">" + value + "</td></tr> | |
</tbody></table>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment