2016-08-08 8 views

答えて

0

は最後に、私は解決策が見つかりましたがば完全によくない:

私は以下のようなパブリッククラスDayAxisValueFormatterを変更する必要があり:

private BarLineChartBase<?> chart; 
private String[] mValues; 
private ArrayList<Long> mDateList = new ArrayList<Long>(); 
private int mSize; 

public DayAxisValueFormatter(BarLineChartBase<?> chart, ArrayList<Long> DateList, int size) { 
    this.chart = chart; 
    this.mDateList = DateList; 
    this.mSize = size; 
} 

@Override 
public String getFormattedValue(float value, AxisBase axis) { 

    // "value" represents the position of the label on the axis (x or y) 
    return longToStringForTimeReal(mDateList.get(mSize)); 
} 

//Pour le formatage de la date 

public static String longToStringForTimeReal(long time) { 
    Date date = new Date(time); 
    SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy/MM/dd"); 
    return simpleDate.format(date); 
} 

そして、私はこのようにそれを呼び出す:

AxisValueFormatter xAxisFormatter = new DayAxisValueFormatter(mChart,mDateList, mDateList.size()); 
xAxis.setValueFormatter(xAxisFormatter); 

その方法の問題は次のとおりです。X値について同じ日付を取得しました。

関連する問題