我可以更改悬停在 highcharts 中气泡图上显示的数据吗?

fruv7luv  于 9个月前  发布在  Highcharts
关注(0)|答案(1)|浏览(94)

是否可以将鼠标悬停在气泡图中的气泡上,并显示不同的数据而不是数据点(x轴和y轴数据)?
Picture of current bubble chart
Rep names in a single line
Rep names list

dly7yett

dly7yett1#

是的,如果你想有条件地显示一些其他信息,你可以用tooltip.pointFormattooltip.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'
    }]
}]

Demohttps://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

相关问题