图表库(2018年10月12日)

2018.10.12

1、图表库

1)使用的场景:

数据汇总以可视化的方式进行展示时使用图表。

市场占有率、销售业绩、天气变化、温度、湿度、股票涨跌、CPI

2)获取helloCharts

官网:https://github.com/lecho/hellocharts-android

依赖:

2.1build.gradle(project)

allprojects {

    repositories {

        google()

        jcenter()

        maven {

            url "https://jitpack.io"

        }

    }

}

(2.2)bulild.gradle(module)

implementation 'com.github.lecho:hellocharts-library:1.5.8@aar'

implementation 'com.github.lecho:hellocharts-android:v1.5.8'

3)分类

线形图——折线图LineChartView

饼状图——圆饼图PieChartView

柱状图——ColumnChartView

等等

4)用法

4.1)布局上添加控件<LineChartView>等等

4.2)构造图表需要的数据

通常是一个由点构成的数组,点是PointValue

还需要设定轴线(例如xy轴),用AxisValue表达;

4.3)图形中的点、线、面的画法进行设定

颜色、形状、标注、轴设置等构成

4.4)将数据加到图表中

构造图表的数据源;

4.5)将画法添加到图表中

4.6)设置图表样式

5)给图表添加事件,实现图表交互

原文地址:https://www.cnblogs.com/sanshengshitouhua/p/14577555.html