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

Regarding to label of axis, I think it displays .03 instead of 0.03 #3824

Closed
alexliubj opened this issue Jan 26, 2019 · 2 comments
Closed

Regarding to label of axis, I think it displays .03 instead of 0.03 #3824

alexliubj opened this issue Jan 26, 2019 · 2 comments

Comments

@alexliubj
Copy link

when it has decimal places and smaller than 1.
I want it to be 0.03 or 0.15 instead of .03, .15
I couldn't find a way to handle it.

@liuxuan30
Copy link
Member

use valueFormatter....

@alexliubj
Copy link
Author

alexliubj commented Jan 29, 2019

Awesome, thank you so much.
Just put what I did at the end and hope this will help someone else has the same issue.

leftAxis.valueFormatter = DefaultAxisValueFormatter(block: { (value, _) -> String in
    //.toString() is a function I coded to convert double to string with decimal places. 
    return "\(value.toString(AppConstants.decimals))" 
})

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