I'm working on a pie chart, for that, i'm using MPAndroidChart library, the values may contain 0% for any data or more than one data and I'm displaying values outside of piechart using setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE)
.
I don't want to display 0% values in a pie chart, I got a solution for that to use value formatted.
public class CustomPercentFormatter implements IValueFormatter {
private DecimalFormat mFormat;
public CustomPercentFormatter() {
mFormat = new DecimalFormat("###,###,##0.0");
}
public CustomPercentFormatter(DecimalFormat format) {
this.mFormat = format;
}
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
if (value == 0.0f)
return "";
return mFormat.format(value) + " %";
}
}
But if I'm using lines option then the line is displayed for 0 % values and overlapping for multiple 0% values, so can anyone help me to remove line option for 0% values?