引言:最近因为公司业务需求需要做一个访问统计的模块,设计到图表控件比较大,在Github看了一下,hellochats这个控件大家用了最后反映很好,我下了个demo研究了下。
- 什么hellochats
https://github.com/lecho/hellocharts-android
这个github链接,有兴趣可以去看看。主要就是一个包含折线图,柱状图,饼状图的图形框架,功能强大,自由度高。
- 折线图的相关实现
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>
布局文件声明具体应用类型。
private LineChartData data;
private long MaxY=0;//y轴最大值
private void generateData() {
//初始化数据
MaxY = 0;
List<Line> lines = new ArrayList<L