【问题标题】:Graphael pie.js unhover event missingGraphael pie.js unhover 事件丢失
【发布时间】:2011-12-11 01:56:49
【问题描述】:

由于某些奇怪的原因,Graphael 没有取消悬停事件。在 pie.js 中找到了创建悬停事件的这段代码:

chart.hover = function (fin, fout) {
    fout = fout || function () {};

    var that = this;

    for (var i = 0; i < len; i++) {
        (function (sector, cover, j) {
            var o = {
                sector: sector,
                cover: cover,
                cx: cx,
                cy: cy,
                mx: sector.middle.x,
                my: sector.middle.y,
                mangle: sector.mangle,
                r: r,
                value: values[j],
                total: total,
                label: that.labels && that.labels[j]
            };
            cover.mouseover(function () {
                fin.call(o);
            }).mouseout(function () {
                fout.call(o);
            });
        })(series[i], covers[i], i);
    }
    return this;
};

unhover 事件是 Raphael JS 如下代码 sn-p。使用这两个必须有一种方法可以为 Grapael 饼图创建悬停。非常感谢这里的任何帮助,因为我很难过!

elproto.unhover = function (f_in, f_out) {
    return this.unmouseover(f_in).unmouseout(f_out);
};

【问题讨论】:

    标签: svg raphael pie-chart graphael


    【解决方案1】:

    悬停事件有两个函数 - f_in 和 f_out

    所以(使用我现在正在处理的示例)

    pie.hover(
        // hover function
        function () {
            this.sector.stop();
            this.sector.scale(1.1, 1.1, this.cx, this.cy);
        },
        // un-hover function 
        function () {
            this.sector.scale(0.9, 0.9, this.cx, this.cy);
        }
    );
    

    【讨论】:

    • 明天我破解代码时得试试这个。会告诉你进展如何。
    猜你喜欢
    • 1970-01-01
    • 2011-09-17
    • 2010-12-15
    • 2015-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多