I want to attach a unit to the value labels. How do I do that?
Asked
Active
Viewed 659 times
1

David Rawson
- 20,912
- 7
- 88
- 124

user7811428
- 15
- 3
-
Possible duplicate of [How to format values inside MPAndroidChart?](http://stackoverflow.com/questions/26883298/how-to-format-values-inside-mpandroidchart) – David Rawson Apr 06 '17 at 00:47
1 Answers
0
You can do this by writing an implementation of IValueFormatter
as in the answers to this question :
public class MyValueFormatter implements IValueFormatter {
private DecimalFormat mFormat;
public MyValueFormatter() {
mFormat = new DecimalFormat("###,###,##0.0");
}
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
return mFormat.format(value) + " km";
}
}

Community
- 1
- 1

David Rawson
- 20,912
- 7
- 88
- 124