Last active
June 21, 2017 17:24
-
-
Save xuhaibahmad/9ab0e076476a23b14f066d8d42355490 to your computer and use it in GitHub Desktop.
Value formatter for MP Android Charts library to display integer values instead of floating point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.zuhaibahmad.cricketer.utils; | |
import com.github.mikephil.charting.data.Entry; | |
import com.github.mikephil.charting.formatter.ValueFormatter; | |
import com.github.mikephil.charting.utils.ViewPortHandler; | |
/** | |
* Created by Zuhaib Ahmad on 1/9/2017. | |
* | |
* Value formatter for MP Android Charts library to display integer values instead of floating point | |
*/ | |
public class IntegerValueFormatter implements ValueFormatter { | |
@Override | |
public String getFormattedValue(float value, Entry entry, int index, ViewPortHandler handler) { | |
return String.valueOf(Math.round(value)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment