1

私は自分のチャートでほろ酔い作業をしています。イベントは正常に機能しましたが、イベントmouseoverを追加すると、期待どおりにイベントがclick実行されません。click

以下は私のコードです:

var vis = new pv.Panel()
            .width(w)
            .height(h);

            vis.add(pv.Bar)
            .data(data)
            .width(4)
            .left(function() 5 * this.index)
            .height(function(d) Math.round(d*4))
            .bottom(0)
            .text(function(d) d.toFixed(1))
            .event("mouseover", pv.Behavior.tipsy({gravity: "w", fade: true}))
            //If I remove the mouseover event, the click event will work but not when both are veing put together.
            .event("click", function() self.location = "http://stanford.edu");

            vis.render();

誰かが私がこの問題を解決するのを手伝ってもらえますか?

4

1 に答える 1

2

ここに回避策があります。クリック コールバック関数を pv.Behavior.tipy に渡し、その中でクリック イベントを呼び出すことができます。

  1. pv.Behavior.tipsy(...) を変更して、コールバック関数を渡します。

    pv.Behavior.tipy = function(opts, コールバック)

  2. コールバック関数を渡すようにイベント呼び出しを変更します。

    .event("mouseover", pv.Behavior.tipsy({gravity: "w", fade: true}, function(){alert('click call back');}))

  3. protovis.tipsy.js の return 関数の最後の行を変更します。

    return function(d) { ....... $(tip).mouseleave(cleanup).tipsy("show"); if(callback) { $(tip).click(callback); } };

于 2011-09-20T22:01:22.360 に答える