将数组中的值添加到 XY 系列
我想将 SQLite 中的值添加到 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 系列?有什么建议吗?
I want to add a value from SQLite to an XY series to create a diagram. Here is what I've done so far:
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();
}
But I've got a problem at the line:
mCurrentSeries.add(x, y);
How I can add an Array to an XY series? Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定您在这里使用什么库来创建图表(图表?)。我使用aChartEngine,它非常好。我用来获取包含 aChartEngine 中时间序列的数据集的代码是:
not sure what library you are using here to create your diagram (chart?). I use aChartEngine which is pretty good. The code I use to get a dataset containing a time series in aChartEngine is: