1

I want to attach a unit to the value labels. How do I do that?

A bar chart with the value labels circled and "+km" written next to the first

David Rawson
  • 20,912
  • 7
  • 88
  • 124
  • 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 Answers1

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