是的,如果您想有条件地显示一些其他信息,您可以使用
tooltip.pointFormat
或 tooltip.pointFormatter()
来执行此操作。对于给定系列的点,您不仅可以输入 x、y、z、名称和一些默认信息等基本信息,还可以输入自定义信息:
tooltip: {
//pointFormat: '<div>{point.custom}</div>',
pointFormatter: function() {
const point = this;
return point.custom ? point.custom : 'z: '+point.z;
}
},
series: [{
data: [{
x: 2,
y: 4,
z: 8,
custom: 'Custom tooltip info'
}]
}]
演示:https://jsfiddle.net/BlackLabel/vdf9rnu6/
API:https://api.highcharts.com/highcharts/tooltip.pointFormat
https://api.highcharts.com/highcharts/tooltip.pointFormatter
https://api.highcharts.com/highcharts/series.bubble.data