繪製圖形我想繪製MPAndroidChart折線圖,但是當我要定線數據我得到這個錯誤:使用Mpandroid圖表
LineData (com.github.mikephil.charting.interfaces.datasets.ILineDataSet...) in LineData cannot be applied to (java.util.ArrayList, com.github.mikephil.charting.data.LineDataSet)
繪製圖形我想繪製MPAndroidChart折線圖,但是當我要定線數據我得到這個錯誤:使用Mpandroid圖表
LineData (com.github.mikephil.charting.interfaces.datasets.ILineDataSet...) in LineData cannot be applied to (java.util.ArrayList, com.github.mikephil.charting.data.LineDataSet)
XAxis xAxis = lineChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(true);
xAxis.setDrawAxisLine(true);
xAxis.setTextSize(10f);
date.clear();
for (int i = 0; i < size; i++) {
date.add("第" + i + "天");
}
//Set the X axis below the data (not the same as the previous version)
xAxis.setValueFormatter(new AxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
axis.setGranularityEnabled(true);
axis.resetAxisMaxValue();
axis.isAxisMaxCustom();
int a = (int) value;
return date.get(a);// Data below
}
@Override
public int getDecimalDigits() {
return 0;
}
});
也許它會幫助你
請你的答案 – Naga2Raja
即使翻譯代碼註釋爲英語將是一個巨大的幫助很少提供更多的解釋。 – Laurel