Ich habe ein horizontales Balkendiagramm mit X-Werten. Im Moment kann ich nur einen BarEntry mit einem Schwimmer Wert wie folgt erstellen:MPAndroidChart: Wie BarEntry als String formatiert?
BarEntry barEntry = new BarEntry((float)iAmountInCents/100, ++ index,item.getKey());
valueSet1.add(barEntry);
ich auch einen benutzerdefinierten Formatter hinzugefügt:
public class MyYAxisValueFormatter implements YAxisValueFormatter {
private DecimalFormat mFormat;
public MyYAxisValueFormatter() {
mFormat = new DecimalFormat("###,###,##0.00");
}
@Override
public String getFormattedValue(float value, YAxis yAxis) {
// write your logic here
// access the YAxis object to get more information
return "₹. " + mFormat.format(value) ;
}
}
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setValueFormatter(new MyYAxisValueFormatter());
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setValueFormatter(new MyYAxisValueFormatter());
Aber das GetFormattedValue() -Methode wird NIE genannt, die Ergebnisse in so etwas auf einem Balken in der Tabelle: 0,400. Ich möchte, dass dieser Wert im Balkendiagramm wie "$ .40" aussieht. Wie kann ich das erreichen?