0

我在 Highcharts 中实现了一个动画饼图,其中切片在鼠标悬停时拉出,除了在 mouseOut 上我希望切片返回“关闭”位置的问题之外,一切都很好。

这是动画的代码,我在 mouseOut 上有一个 clearTimeout 但这不会将切片返回到原始位置。

是否有一种简单的方法将图表恢复到其原始位置。

我这里有一个小提琴...

http://jsfiddle.net/rupertito/Y3wvN/1/

   pie: {
       allowPointSelect: true,
                        stickyTracking: false,

                        point: {
                        events: {
                                    legendItemClick: function() {

                                            return false;

                                    },
                                    mouseOver: function(event) {
                                        var point = this;

                                        if (!point.selected) {                                                          
                                            timeout = setTimeout(function () {
                                                point.firePointEvent('click');

                                                sectors.tooltip.refresh(point);
                                            }, 20);
                                        }
                                    }
                                }


                            },
                        events: {
                            mouseOut: function() {
                                clearTimeout(timeout);

                            },

                        },

希望这一切都有意义,并提前感谢您的任何帮助。

干杯抢

4

1 回答 1

6

这是此处报告的错误。这是关于不为点工作的。还有解决方法如何避免该问题。以及 mouseOver/mouseOut 的简单示例:http: //jsfiddle.net/GqfU4/8/

function setTranslation(p, slice){
    p.sliced = slice;
    if(p.sliced){
        p.graphic.animate(p.slicedTranslation);
    } else {
        p.graphic.animate({
            translateX: 0,
            translateY: 0
        });
    } 
}

对于馅饼:

            point: {
                events: {
                    mouseOut: function () {
                        setTranslation(this, false);
                    },
                    mouseOver: function() {
                        setTranslation(this, true);
                    }
                }
            },
于 2013-05-21T12:52:26.720 回答