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