Skip to content

Instantly share code, notes, and snippets.

@xuhaibahmad
Last active June 21, 2017 17:24
Show Gist options
  • Save xuhaibahmad/9ab0e076476a23b14f066d8d42355490 to your computer and use it in GitHub Desktop.
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
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