WilliamChart是github上的一个android图表控件,项目地址:https://github.com/diogobernardino/WilliamChart
该图表控件效果不错,使用也比较方便。
参考它提供的示例程序,我写了一个更加简单的图表程序,步骤如下:
1.从github上下载项目,将其library项目导入adt;
2.将其sample项目导入adt;
3.创建自己的工程,引用library项目,并将sample项目中的DataRetriever类拷贝到本项目的源代码目录中;
4.创建一个chart_layout.xml代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.db.chart.view.LineChartView
xmlns:chart="http://schemas.android.com/apk/res-auto"
android:id="@+id/linechart"
android:layout_width="match_parent"