zhengdan66的专栏

该工程地址:

示例代码也非常简单

GraphViewData[] data = new GraphViewData[num];double v=0;for (int i=0; i<num; i++) {v += 0.2;data[i] = new GraphViewData(i, Math.sin(v));}// graph with dynamically genereatedhorizontal and vertical labelsGraphView graphView;if (getIntent().getStringExtra("type").equals("bar")) {graphView = new BarGraphView(this, "GraphViewDemo");} else {graphView = new LineGraphView(this, "GraphViewDemo");}// add datagraphView.addSeries(new GraphViewSeries(data));// set view port, start=2,size=40graphView.setViewPort(2, 40);graphView.setScrollable(true);LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);layout.addView(graphView);

从代码上面可以看到,,graphview支持线性图和圆饼图。

目前有个小问题就是graphview使用的是折线图,不够圆滑。如果要能使线条圆滑就需要修改相关源码。过段时间搞定更新blog

艰苦能磨练人的意志。

zhengdan66的专栏

相关文章:

你感兴趣的文章:

标签云: