2011-02-15 41 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"; 
    }); 
}, 
相关问题