工具提示中的URL链接

时间:2013-02-05 18:05:48

标签: highcharts

我在工具提示中有一个url链接,但是,如果工具提示超出了图表区域并且您尝试单击该网址,则工具提示会消失。

为此做任何解决方法?

谢谢!

1 个答案:

答案 0 :(得分:2)

我发现在这些情况下,最好手动定位工具提示:

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

这样,不受欢迎的隐藏是可控制的。

编辑:

如果扩展工具提示原型,则可以操作X和Y

Tooltip.prototype.move = function (x, y, anchorX, anchorY) {
    var tooltip = this,
        now = tooltip.now,
        animate = tooltip.options.animation !== false && !tooltip.isHidden;

            if(x > ?????)
            {
               x = x - 50; // or how ever many pixels you want to move it to
            }

    // get intermediate values for animation
    extend(now, {
        x: animate ? (2 * now.x + x) / 3 : x,
        y: animate ? (now.y + y) / 2 : y,
        anchorX: animate ? (2 * now.anchorX + anchorX) / 3 : anchorX,
        anchorY: animate ? (now.anchorY + anchorY) / 2 : anchorY
    });

    // move to the intermediate value
    tooltip.label.attr(now);


    // run on next tick of the mouse tracker
    if (animate && (mathAbs(x - now.x) > 1 || mathAbs(y - now.y) > 1)) {

        // never allow two timeouts
        clearTimeout(this.tooltipTimeout);

        // set the fixed interval ticking for the smooth tooltip
        this.tooltipTimeout = setTimeout(function () {
            // The interval function may still be running during destroy, so check that the chart is really there before calling.
            if (tooltip) {
                tooltip.move(x, y, anchorX, anchorY);
            }
        }, 32);

    }
}