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 to change item's ratio after created chartview? #7

Open
thepolygongo opened this issue Dec 4, 2018 · 2 comments
Open

How to change item's ratio after created chartview? #7

thepolygongo opened this issue Dec 4, 2018 · 2 comments

Comments

@thepolygongo
Copy link

  firstItem = RKPieChartItem(ratio: 50, color: UIColor.orange)
     chartView = RKPieChartView(items: [firstItem])
     chartView.circleColor = .green
     chartView.translatesAutoresizingMaskIntoConstraints = false
     chartView.arcWidth = 10
     chartView.isIntensityActivated = false
     chartView.style = .round
     chartView.isTitleViewHidden = true
     chartView.isAnimationActivated = false
     self.view.addSubview(chartView)

button click function

    @IBAction func clickTest(_ sender: Any) {
        firstItem = RKPieChartItem(ratio: 80, color: UIColor.orange)
    }
    

this doens't work.

@melihayyildiz
Copy link

ablan star bebeğim

@Murodillo
Copy link

I have solution, but I think it is not good
firstly you should remove your chart view from its superview and initialize again

@IBAction func clickTest(_ sender: Any) {
chartView.removeFromSuperview()
firstItem = RKPieChartItem(ratio: 80, color: UIColor.orange)
chartView = RKPieChartView(items: [firstItem])
chartView.circleColor = .green
chartView.translatesAutoresizingMaskIntoConstraints = false
chartView.arcWidth = 10
chartView.isIntensityActivated = false
chartView.style = .round
chartView.isTitleViewHidden = true
chartView.isAnimationActivated = false
self.view.addSubview(chartView)
}

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