从Sqlite数据库中检索数据并将其绘制在Android图形的XY图形中

时间:2012-05-16 06:53:11

标签: android sqlite graph

是否有任何现有代码允许从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);
    }

}

0 个答案:

没有答案