树形图中不同的工具提示和值 ||排行榜
Different tooltip and value in Treemap || Highcharts
我目前正在显示一个 treemap 有很多数据,因此由于巨大的价值,一些图块比其他图块占用更多 space。
所以,我想在工具提示中记录值并显示实际值。
但目前,我仅从值属性中提供工具提示。
请建议如何同时提供 工具提示和值 。
通过使用 tooltip.formatter
函数,您可以创建任何工具提示格式,例如:
tooltip: {
formatter: function() {
var str = this.point.name + ' ' + this.point.value,
node = this.point.node;
if (node) {
node.children.forEach(function(child) {
str += '<br />' + child.name + ' ' + child.val;
});
}
return str;
}
}
现场演示: https://jsfiddle.net/BlackLabel/z5rdh83p/
API参考:https://api.highcharts.com/highcharts/tooltip.formatter
我目前正在显示一个 treemap 有很多数据,因此由于巨大的价值,一些图块比其他图块占用更多 space。
所以,我想在工具提示中记录值并显示实际值。
但目前,我仅从值属性中提供工具提示。
请建议如何同时提供 工具提示和值 。
通过使用 tooltip.formatter
函数,您可以创建任何工具提示格式,例如:
tooltip: {
formatter: function() {
var str = this.point.name + ' ' + this.point.value,
node = this.point.node;
if (node) {
node.children.forEach(function(child) {
str += '<br />' + child.name + ' ' + child.val;
});
}
return str;
}
}
现场演示: https://jsfiddle.net/BlackLabel/z5rdh83p/
API参考:https://api.highcharts.com/highcharts/tooltip.formatter