【问题标题】:Highcharts: Positioning the toolip with chart.plotLeftHighcharts:使用 chart.plotLeft 定位工具提示
【发布时间】:2014-06-30 13:01:28
【问题描述】:

在 highchart 文档中说:

定位器:功能

将工具提示放置在默认位置的回调函数。回调接收三个参数:labelWidth、labelHeight 和 point,其中 point 包含 plotX 和 plotY 的值,告诉参考点在绘图区域中的位置。

添加 chart.plotLeftchart.plotTop 以获得完整坐标。

http://api.highcharts.com/highcharts#tooltip.positioner

但我不确定应该在哪里添加 plotLeftplotTop

在示波器上看不到,在“图表”属性选项中也看不到。

谁能解释一下?

【问题讨论】:

  • 取决于图形
  • 你在做吧,椭圆形你能显示具体想要什么吗,因为在同一页面你可以找到演示
  • 定位器函数应返回您希望工具提示出现的位置的 x 和 y 坐标,考虑到图表的 TopLeft 坐标为 (0, 0)

标签: highcharts


【解决方案1】:

您的示例:http://jsfiddle.net/j92p2/

    tooltip: {
        positioner: function (w, h, p) {
            var chart = this.chart,  // get chart
                plotLeft = chart.plotLeft, // get plotLeft
                plotTop = chart.plotTop;  // get plotTop

            console.log(this, plotTop, plotLeft); // watch console while hovering points

            return { x: 80, y: 50 };
        }
    }

查看内联 cmets。如果您还有其他问题,请告诉我。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 1970-01-01
    相关资源
    最近更新 更多