我可以更改将鼠标悬停在 Highcharts 中的气泡图上时显示的数据吗?

问题描述 投票:0回答:1

我可以将鼠标悬停在气泡图中的气泡上并显示不同的数据而不是数据点(x 和 y 轴数据)吗?

Picture of current bubble chart

highcharts hover salesforce visualforce bubble-chart
1个回答
0
投票

是的,如果您想有条件地显示一些其他信息,您可以使用

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/
APIhttps://api.highcharts.com/highcharts/tooltip.pointFormat
https://api.highcharts.com/highcharts/tooltip.pointFormatter
https://api.highcharts.com/highcharts/series.bubble.data

© www.soinside.com 2019 - 2024. All rights reserved.