I am using the MPAndroidChart library. I use CustomValueFormatter, which formats Float values so that their accuracy is 1.
CustomValueFormatter Code:
public class CustomYAxisValueFormatter implements YAxisValueFormatter { private DecimalFormat mFormat; public CustomYAxisValueFormatter() { mFormat = new DecimalFormat("###,###,###,##0.0");
I set the formatter on the y axis.
Setting formatting:
YAxis yAxis = lineChart.getAxisLeft(); //show left y-axis line yAxis.setValueFormatter(new CustomYAxisValueFormatter()); // set value formatter to format y-values.
As a result, setValueFormatter(YAxisValueFormatter) by default creates the following formatter (CustomYAxisValueFormatter) .
The problem is that CustomYAxisValueFormatter cannot be recreated when scaling, resulting in duplicate y values.
Is it possible to create a CustomValueFormatter that changes the accuracy of the values based on the zoom level?
source share