2015-06-10 14 views

Odpowiedz

48

Wypróbuj dataSet.setDrawValues(false).

Aby zmienić (dostosować) wylosowane wartości, można użyć interfejsu ValueFormatter.

+0

Witam Philipp, Mam wykres stosu. Chcę wyświetlić jedną wartość na górze wykresu słupkowego, a nie dla każdego stosu paska. Czy można to zrobić za pomocą biblioteki MpAndroidchart? –

+0

możesz mi pomóc tutaj https://stackoverflow.com/questions/45230343/how-to-remove-lines-if-values-is-0-in-pie-chart – gaurang

+0

Ja też potrzebuję pomocy z pytaniem^@ gauranga. proszę pomóż. –

0

Jeśli chcesz ukryć wartości według stanu można zrobić z Formatter, jest to przykład:

Musisz aktywny ta metoda:

dataSet.setDrawValues(true) 

i twój musi personalitize swoją formatowania warunku:

public class MyYAxisValueFormatter implements IAxisValueFormatter { 

    private DecimalFormat mFormat; 

    public MyYAxisValueFormatter() { 

     // format values to 1 decimal digit 
     mFormat = new DecimalFormat("###,###,##0"); 
    } 

    @Override 
    public String getFormattedValue(float value, AxisBase axis) { 
     String val = "" 
     if ((int)value > 10){ 
      val = value 
     } 
     return mFormat.format(val); 
    } 

    /** this is only needed if numbers are returned, else return 0 */ 
    /*@Override 
    public int getDecimalDigits() { return 1; }*/ 
} 

Ale jeśli chcesz ukryć wszystkie wartości trzeba użyć tego:

dataSet.setDrawValues(false)