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

Pie Chart view as Int instead of double on segment? #2325

Closed
Antuaaan opened this issue Apr 4, 2017 · 3 comments
Closed

Pie Chart view as Int instead of double on segment? #2325

Antuaaan opened this issue Apr 4, 2017 · 3 comments

Comments

@Antuaaan
Copy link

Antuaaan commented Apr 4, 2017

Is it possible to toggle the label on the pie segments to be viewed as an integer(whole number) instead of with a decimal (double)? I am displaying an exact count of items so percentage won't work here but the .00 after each number doesn't look appealing so am trying to find way to adjust it. Thank-you in advance to someone must have encountered this and will be kind enough to share with me the solution.
piechart

TLDR : Would rather have 5 and 6 in the view instead of 5.00 and 6.00

@liuxuan30
Copy link
Member

use valueFormatter

@Antuaaan
Copy link
Author

Antuaaan commented Apr 5, 2017

#1551 helped but thank you for the push in the right direction.

let format = NumberFormatter()
format.numberStyle = .none
let formatter = DefaultValueFormatter(formatter: format)
pieChartData.setValueFormatter(formatter)

@liuxuan30
Copy link
Member

more info: it's protocol, so it's very flexible, and the default ones might have bugs.

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

2 participants