2011-12-11 48 views
0

由於某些奇怪的原因,Graphael沒有非停歇事件。發現在本pie.js塊的代碼創建懸停事件:Graphael pie.js unhover事件丟失

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事件是拉斐爾JS在下面的代碼片段。使用這兩種方法必須有一種方法可以爲Grapael餅圖創建非停留。任何幫助在這裏將非常非常感激,因爲我很難過!

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

回答

0

懸停事件發生兩個功能 - 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); 
    } 
); 
+0

總得試試這個,明天,當我出局代碼。會告訴你這件事的進展的。 –