Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deselecting slices upon selecting new slice #40

Open
Brandon-316 opened this issue Dec 24, 2017 · 2 comments
Open

Deselecting slices upon selecting new slice #40

Brandon-316 opened this issue Dec 24, 2017 · 2 comments

Comments

@Brandon-316
Copy link

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.

@davidhsu1115
Copy link

Hi, did you find any solution for you question?

@fabiomartignoni
Copy link

fabiomartignoni commented Mar 1, 2019

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
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants