0
votes

I have multiple pie charts which I put them in an array:

var pie_array = new Array();

Creating pie charts like:

for loop{
      pie = r.piechart(48+i*120,40,30,[100],
      {
          colors: ["white"],
          maxSlices: 1
      });
}

Now I am adding click event to each pie chart :

 $.each(pie_array, function(i, p){
        $(p).click(function(){
            alert(p);
        });
    });

But unable to fire an event when I click pie chart...any solutions?

Possible duplicates: How to add jquery click event to gRaphael graphics?

and

how can i add click evet to my rapahel pie chart?

but none of the solutions work

I even used:

 //below one says click event on unknown element..I printed p and it raphael set
 $.each(pie_array, function(i, p){
        p.click(function(){
            alert(p);
        });
    }); 

and

$.each(pie_array, function(i, p){
        p.node.oclick = function(){
            alert(p);
        };
    });

but no progress

1
Can you share your solution for others that have the same problem? - Chris
@Chris: do you know to retrieve attributes like color, stroke, radius of pie chart - Chirag Tayal
yes sure: yes sure $.each(pie_array, function(i) { this.click(function () { alert("hello"); }); }); jsfiddle.net/zFCur - Chirag Tayal

1 Answers

0
votes

It looks like you are not adding the created pie charts to your array.