MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

I manually set DefaultValueFormatter(0) to a ChartData but still show 1 digital in DecimalFormat.

Open Jasper009-So opened this issue 10 years ago • 2 comments

My solution as below for your reference:

step-1. in public void setData(T data) of MPChartLib\src\com\github\mikephil\charting\charts\Chart.java add a Disable flag to skip calling calculateFormatter(data.getYMin(), data.getYMax());

step-2. in MPChartLib\src\com\github\mikephil\charting\data\DataSet.java
public boolean needsDefaultFormatter() {
if (mValueFormatter == null)
return true;
//if (mValueFormatter instanceof DefaultValueFormatter) //ignore it for an unreasonable case
// return true;
return false;
}

Jasper009-So avatar Jan 04 '16 07:01 Jasper009-So

Just use the formatter like it's supposed to be used: https://github.com/PhilJay/MPAndroidChart/wiki/The-ValueFormatter-interface

PhilJay avatar Jan 04 '16 09:01 PhilJay

thank you so much.

Jasper009-So avatar Jan 04 '16 09:01 Jasper009-So