2011-02-15 40 views
4

我想使堆疊條形圖(水平在我的情況下)的每個片段可點擊到特定的超鏈接(基本上是「向下鑽取」)。我不認爲這個功能在g.bar.js中,但是任何人都可以做到這一點,或者可以指向正確的方向嗎?在圓點圖上也是有用的。g.raphael條形圖與可點擊的酒吧

回答

4

好吧,張貼問題似乎已經促使我看着辦吧......

使用演示條形圖提供,我添加了一行到功能:

fin = function() { 
    this.flag = r.g.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this); 
    /* add this for linked bars */ 
    this.attr({href: "http://myurl.com/"+this.bar.x+"/"+this.bar.y+"/"+this.bar.value}); 
    }, 
+1

這是有效的。好東西。 – 2011-05-21 12:40:37

-1

上面提到的this.attr對我不起作用,但是這樣做:

fin = function() { 
    this.flag = r.g.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this); 

    /* add click event to bar */ 
    this.click(function(){ 
     location.href = "http://myurl.com"; 
    }); 
}, 
相關問題