0

Graphael には、奇妙な理由で unhover イベントがありません。ホバー イベントを作成するコードのこのチャンクが 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 は次のコード スニペットです。これら 2 つを使用して、Grapael 円グラフの unhover を作成する方法が必要です。私は困惑しているので、ここでの助けは非常に高く評価されます!

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

1 に答える 1

0

ホバーイベントは、f_inとf_outの2つの関数を取ります

だから(私が今取り組んでいる例を使って)

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);
    }
);
于 2011-12-22T02:19:16.843 に答える