在Highcharts Stacked列中,共享工具提示定位器point.plotY始终为0

时间:2017-07-10 07:43:35

标签: highcharts

我有这种图形:https://www.highcharts.com/demo/column-stacked-percent

我的问题是,就像在示例中一样,工具提示位于每个栏的顶部。使用工具提示的定位器属性使我有可能将它放在某处,但是point.plotY属性始终为0.我认为这是因为工具提示是共享的。

当我将鼠标悬停在顶部系列时,我需要将工具提示放在底部,因为我在工具提示隐藏的栏之间有一些信息。 我怎样才能得到这一点.PlotY"真实"重视或克服这个问题?

1 个答案:

答案 0 :(得分:1)

如果您有堆积列,则可以通过this.chart.hoverPoints(这是工具提示)获取悬停点,然后从堆积列中选择点。

如果想要一个不属于悬停列的特定点 - 您可以通过this.chart.series[seriesIndex].data[pointIndex]访问系列对象。

工具提示的定位器出现在底部:

   positioner: function (w, h, p) {
      const chart = this.chart
      const points = chart.hoverPoints
      if (points && points.length) {
        const i = points.length - 1
        return { x: points[i].plotX + chart.plotLeft - w / 2, y: points[i].plotY + chart.plotTop}
      }

      return { x: 0, y: -9e7 }
    }

示例:here

相关问题