Skip to content Skip to sidebar Skip to footer

Mpandroidchart Bar Chart Values

I've been reading through the documentation for MPAndroidChart (using v3.0.1) and I can't seem to find a way to remove the labels on the bars I would like to hide the values that

Solution 1:

Simply create a new class and let it implement the IValueFormatter and return whatever you want to be displayed from the getFormattedValue(...) method like below.

publicclassMyValueFormatter implements IValueFormatter
{
    @Override
    public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler){
        return"";
    }
}

BarDataSet set = newBarDataSet(entries, "");
set.setValueFormatter(newMyValueFormatter());
set.setColor(Color.rgb(155, 155, 155));
set.setValueTextColor(Color.rgb(155, 155, 155));

You can find out more here.

Solution 2:

For others coming through here looking for solutions, try setDrawValues on the data set instead.

BarDataSetdataSet=newBarDataSet(entries, "");
dataSet.setDrawValues(false);

Post a Comment for "Mpandroidchart Bar Chart Values"