1

raphael.js で .data メソッドを使用しようとしています。

 var r = Raphael('diagram', width, width);
 [...]
 var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': width/24 });
 z.data({"entry": entry});
 z.mouseover(function(){
            this.animate({ 'stroke-width': width/14, opacity: .75 }, 1000, 'elastic');
            if(Raphael.type != 'VML') //solves IE problem
            this.toFront();
            title.stop().animate({ opacity: 0 }, speed, '>', function(){
                this.attr({ text: this.data('entry').name + '\n' + this.data('entry').value + '%' }).animate({ opacity: 1 }, speed, '<');
            });

残念ながら、うまくいきません。これは raphael.js のバグですか、それとも私のコードが間違っていますか?

助けてください、ありがとう。

パラメータを mouseover メソッドに渡すにはどうすればよいですか?

http://jsfiddle.net/stefanszakal/St9Ky/

4

1 に答える 1

2

Raphael JS 1.5 を使用しています。.data()要素のメソッドは実装されていません。

これを使用してください: //cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js

フィドルはそれでうまく機能します。

于 2013-07-20T00:30:37.137 に答える