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

2019-09-06 06:11发布

问题:

How can I add click event to my Rapahel 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 onclcik function ??

回答1:

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 */ };