是否有任何现有代码允许从SQLite数据库中检索数据并将其显示在图表中? (我希望图形对y(字符串部门)绘制x(整数headcount)。以下代码仅允许在类文件中手动输入坐标。
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Vector<SeriesData> sds = new Vector<SeriesData>();
//line
SeriesData sd = new SeriesData();
sd.setData(new double[][]{{0,0}, {2, 2}, {4, 4}, {8, 8}});
sds.add(sd);
//bar
SeriesData sd2 = new SeriesData();
sd2.setData(new double[][]{{0,0}, {2, 2}, {4, 4}, {8, 8}});
sd2.series.bars.show = true;
sds.add(sd2);
FlotDraw fd = new FlotDraw(sds, null, null);
setContentView(R.layout.main);
FlotChartContainer tv = (FlotChartContainer)this.findViewById(R.id.flotdraw);
if(tv != null) {
tv.setDrawData(fd);
}
}