I want to make my pie-chart interactive by allowing the user to double-click on a slice to drill down. I believe that the way to do this is to create an onclick handler on the canvas, and use getSegmentsAtEvent() to determine which slice was clicked.
The segment data returned by the call to getSegmentsAtEvent() is possibly ambiguous though. Here is a sample of the returned data:
[{ "circumference": 4.1887902047863905, "endAngle": 8.901179185171081, "fillColor": "#FF5A5E", "highlightColor": "#FF5A5E", "innerRadius": 0, "label": "Red", "outerRadius": 99.5, "showStroke": true, "startAngle": 4.71238898038469, "strokeColor": "#fff", "strokeWidth": 2, "value": 300 }] Of those fields, only value, fillColor, highlightColor, and label are supplied by me, and none of them are necessarily unique. I could ensure that label is unique, but that might make it less readable for humans.
I have tried adding an additional property (e.g. "id") into the data I pass into Pie(), but it is stripped out when I get the segment data back from this call. Is there a way to add a property to each segment which I can use to positively identify them, without overloading the label field?