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

How can i refresh slices? #2

Closed
editor83 opened this issue Jan 19, 2017 · 5 comments
Closed

How can i refresh slices? #2

editor83 opened this issue Jan 19, 2017 · 5 comments

Comments

@editor83
Copy link

Hi ivan, i want to update my pie chart values? How can i do?

@ivnsch
Copy link
Owner

ivnsch commented Jan 19, 2017

That's currently not supported!

@diogo10
Copy link

diogo10 commented Feb 3, 2017

Hi @editor83 ,

You can delete the subview chart dynamically on viewWillAppear and create it again....

override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
       
        //remove subviews
        view.subviews.forEach({ $0.removeFromSuperview() })
        
        //label view
        label.text = "\(views!) views"
        view.addSubview(label)
        
        //add chart
        chartView = PieChart(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height))
        chartView.delegate = self
        chartView.models = createModels()
        chartView.layers = [createCustomViewsLayer(), createTextLayer(), createTextWithLinesLayer()]
        view.addSubview(chartView)
        chartView.setNeedsDisplay()
        
      
    }

@ivnsch
Copy link
Owner

ivnsch commented Feb 3, 2017

That's right. I forgot to mention this, thanks!

I was thinking on a transition where slides are animated from their current state to the new state. For now re-adding as described by @editor83 is the way to go.

@ivnsch
Copy link
Owner

ivnsch commented May 3, 2017

Added a method clear() to PieChart which removes all the content from UI and models. To refresh now you can call clear() and re-add everything instead of re-adding PieChart (it's in master).

@ivnsch ivnsch closed this as completed May 3, 2017
@GaneshKumarSelvam
Copy link

There is no any method name clear()?

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

No branches or pull requests

4 participants