chartsdom-eventsraphaelgraphael

How can I add click event to my Raphael pie chart?


How can I add click event to my Raphael pie chart ?

var r = Raphael("holder-1",340, 185); 
pie = r.g.piechart(150,85, 75, values , {legend: labels, legendpos: "east"});

I got the answer it is:

pie.click(function () {     });

Can I pass value to the onclick event? Here can I pass values and labels to onclick` function?


Solution

  • According to the docs for the node attribute, you should just be able to attach events as you would any DOM element using it:

    pie.node.onclick = function () { /* Something */ };