1
我想將SQLite中的值添加到XY系列中以創建圖表。以下是我迄今所做的:將陣列中的值添加到XY系列中
Double a, b;
mDbHelper = new NotesDbAdapter(this);
mDbHelper.open();
Cursor notesCursor = mDbHelper.fetchAllNotes();
startManagingCursor(notesCursor);
ArrayList x = new ArrayList();
ArrayList y = new ArrayList();
notesCursor.moveToFirst();
for(int i = 0; i<notesCursor.getCount();i++){
a = notesCursor.getDouble(notesCursor.getColumnIndex(mDbHelper.KEY_ROWID));
b = notesCursor.getDouble(notesCursor.getColumnIndex(mDbHelper.KEY_RESULT));
}
x.add(a);
y.add(b);
notesCursor.moveToNext();
mCurrentSeries.add(x, y);
if (mChartView != null) {
mChartView.repaint();
}
但我有在該行的一個問題:
mCurrentSeries.add(x, y);
我怎樣才能陣列添加到XY系列?有什麼建議麼?
是的,我想打一個圖,我想從我的數據庫(源碼)的值(X,Y)的包含我之前插入的許多x和y值,你知道該怎麼做嗎?謝謝 – Handy
嗨,你看過我的回答嗎?它從數據庫中獲取2個值,並將它們用於圖表上的點。 –
是的,我讀過你的答案,但它不起作用,你介意給我的例子項目?謝謝 – Handy