鼠标悬停在高位图上时,如何避免移动标志

How can I avoid moving flags when mouseovered - highcharts

本文关键字:何避免 标志 移动 悬停 高位图 位图 鼠标      更新时间:2023-09-26

我遇到了与this fiddle中类似的问题当我把鼠标悬停在绿色圆圈上(它们在同一点上)时,它们会向上移动一点,我如何才能让它们在悬停时保持原位。

注意:我不能为每个添加不同的系列。

谢谢你的帮助。

我为您准备了一个覆盖距离的片段。

 (function (HC) {
    var each = Highcharts.each,
        addEvent = window.HighchartsAdapter.addEvent,
        TrackerMixin = Highcharts.TrackerMixin;
    HC.wrap(HC.seriesTypes.flags.prototype, 'drawTracker', function (proceed) {
        var series = this,
            points = series.points;
        TrackerMixin.drawTrackerPoint.apply(this);
        each(points, function (point) {
            var graphic = point.graphic;
            if (graphic) {
                addEvent(graphic.element, 'mouseover', function () {
                    // Raise this point
                    if (point.stackIndex > 0 && !point.raised) {
                        point._y = graphic.y;
                        graphic.attr({
                            y: point._y
                        });
                        point.raised = true;
                    }
                    // Revert other raised points
                    each(points, function (otherPoint) {
                        if (otherPoint !== point && otherPoint.raised && otherPoint.graphic) {
                            otherPoint.graphic.attr({
                                y: otherPoint._y
                            });
                            otherPoint.raised = false;
                        }
                    });
                });
            }
        });
    });
})(Highcharts);

http://jsfiddle.net/5pXfM/6/