Hello, I am trying to implement the exploding pie slice functionality in my pie chart. I have followed the online example to make the slices explode/un-explode when pressed. However, I would like only one exploded slice to be showing at a time. For when the user selects the slice I have tried to implement the following code:
-(void)pieChartView:(IGPieChartView*)pieChartView tapWithItem:(IGPieSliceInfo*)item atPoint:(CGPoint)point{
if(lastSelectedSlice){
lastSelectedSlice.isExploded = NO;
}
item.isExploded = !item.isExploded;
lastSelectedSlice = item;
I have stepped though this method, and my lastSelectedSlice object seems to be setting correctly the exploded property correctly, however the pie chart only seems to update the state of the selected pie slice. How would I update the other pie slices to show if they are exploded or not?
Hello,
What you could do in your case is to set explodedSlices array to empty array, in this case PieChart will marks all slices as “exploded - NO” , so in tapWithinItem method you could use code like:
bool isExlded =!item.isExploded;
NSMutableIndexSet *exploded = [[NSMutableIndexSet alloc]init];
_infraPieChart.explodedSlices = exploded;
item.isExploded =isExlded;
Please try this suggestion and let me know if this is desired result.
Please let me know if you have any further questions.
Great, that did the trick, and such a simple implementation as well. Thanks!