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

Add percent label for pie chart #1172

Closed
stevedubz opened this issue Jun 24, 2016 · 6 comments
Closed

Add percent label for pie chart #1172

stevedubz opened this issue Jun 24, 2016 · 6 comments

Comments

@stevedubz
Copy link

I have a pie chart and it displays the correct percents per item. The only problem is that it only displays a number like "55.0" and not "55.0%". I noticed you did this in one of your screenshots for the pie chart but I can't figure out how.

@kvnbautista
Copy link

Add where ever you want to add the percent to.
pFormatter.percentSymbol = @" %";

@hardikdevios
Copy link

  lazy var formatter:NSNumberFormatter = {
        let a = NSNumberFormatter()
        a.numberStyle = .PercentStyle
        a.maximumFractionDigits = 0
        a.multiplier = 1
        a.percentSymbol = " %"
        return a
    }()

After that
pieChatView.data?.setValueFormatter(formatter)

@stevedubz
Copy link
Author

Thanks guys for the help

@paulowolking
Copy link

It is still a valid solution ? Me did not work.

@SylarRuby
Copy link

@hardikdevios

For: pieChatView.data?.setValueFormatter(formatter)

Cannot convert value of type NumberFormatter to expected argument type IValueFormatter

@ghost
Copy link

ghost commented Jan 16, 2017

@SylarRuby
let myFormatter = DefaultValueFormatter(formatter: formatter)
pieChatView.data?.setValueFormatter(myFormatter)

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

5 participants