PieCharts
PieCharts copied to clipboard
Deselecting slices upon selecting new slice
Is there a way to deselect other selected slices when selecting a new one? I'm trying to make the last selected slice animate back into the pie chart when I select another.
Hi, did you find any solution for you question?
Hi guys, got the same problem and solved it within the onSelected delegate of PieChartDelegate protocol:
var selectedSlice: PieSlice?
func onSelected(slice: PieSlice, selected: Bool)
{
// avoid multiple selection
let isPreviousSliceOpen = selectedSlice?.view.selected ?? false
if (selected && isPreviousSliceOpen)
{
selectedSlice?.view.selected = false // close previously selected slice
}
selectedSlice = selected ? slice : nil
}