鼠标悬停时如何避免移动标志 - highcharts
How can I avoid moving flags when mouseovered - highcharts
我遇到了与 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);
我遇到了与 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);