1
我有一个列表与多个系列和共享工具提示。 positioner(labelWidth, labelHeight, point)
回调函数中的点对象只包含悬停类别中的最左边的点。我希望将该工具提示定位在该类别内的最高栏之上。如果最左边的小节比其他任何小节都小,那么工具提示覆盖这些较高的小节。Highcharts自定义工具提示定位器
是否有任何方法获得所有点在徘徊类而不是只有最左边的一个?
我有一个列表与多个系列和共享工具提示。 positioner(labelWidth, labelHeight, point)
回调函数中的点对象只包含悬停类别中的最左边的点。我希望将该工具提示定位在该类别内的最高栏之上。如果最左边的小节比其他任何小节都小,那么工具提示覆盖这些较高的小节。Highcharts自定义工具提示定位器
是否有任何方法获得所有点在徘徊类而不是只有最左边的一个?
您可以遍历hoverPoints
并找到您需要的一个。
positioner: function(w, h) {
var chart = this.chart,
hoverPoints = chart.hoverPoints,
len = hoverPoints.length,
topPoint = hoverPoints[0],
x,
y;
for (var i = 0; i < len; i++) {
if (hoverPoints[i].y > topPoint.y) {
topPoint = hoverPoints[i];
}
}
x = topPoint.barX + chart.plotLeft + topPoint.pointWidth/2 - w/2;
y = topPoint.plotY + chart.plotTop - h;
return {
x: x,
y: y
};
},