- 一图一表
- 一图多表数据对比
- 组内学习自定义View的基础Demo
- 基础 Paint 的使用
- 基础 Canvas 的 drawText,drawLine ,drawPath 等 的使用
- 基础 Canvas 的 translate,sava,restore 的使用
- 基础 Path 的使用
- 基础 Matrix 坐标转换的使用
- 基础 Region 特殊区域触摸事件处理
- 基础 AttributeSet 使用
- 基础 数据结构设计
<declare-styleable name="OneChartView">
<!-- 标题名 -->
<attr name="one_title_name" format="string" />
<!-- 标题颜色 -->
<attr name="one_title_color" format="color" />
<!-- 标题字号 -->
<attr name="one_title_size" format="dimension" />
<!-- 副标题名称 -->
<attr name="one_subtitle_name" format="string" />
<!-- 副标题颜色 -->
<attr name="one_subtitle_color" format="color" />
<!-- 副标题字号 -->
<attr name="one_subtitle_size" format="dimension" />
<!-- x轴线颜色 -->
<attr name="one_x_axis_color" format="color" />
<!-- x轴线宽度 -->
<attr name="one_x_axis_size" format="dimension" />
<!-- x轴文字颜色 -->
<attr name="one_x_axis_text_color" format="color" />
<!-- x轴文字字号 -->
<attr name="one_x_axis_text_size" format="dimension" />
</declare-styleable>
<com.easy.onechartview.view.OneChartView
android:id="@+id/xchart"
android:layout_width="match_parent"
android:layout_height="300dp" />
- 图表类型
- 数据集
- 单位
- Y轴名称
- 颜色
public class ChartBean implements Serializable {
/**
* 柱状图
*/
public final static int CHART_SHOW_BARCHART = 0;
/**
* 线状图
*/
public final static int CHART_SHOW_LINECHART = 1;
/**
* 数据
*/
private List<PointBean> mValus;
/**
* 单位
*/
private String unit;
/**
* Y轴名称
*/
private String yAxisName;
/**
* 颜色
*/
private int color;
/**
* 最大值
*/
private Float maxValue;
/**
* 最小值
*/
private Float minValue;
/**
* 展示图表类型
*/
private int type = CHART_SHOW_BARCHART;
}
- 表名
- 副表名
- 图例(暂时未加)
- 表集
public class XChatDataBean implements Serializable {
/**
* 标题
*/
private String title;
/**
* 副标题
*/
private String subTitle;
/**
* 图例
*/
private List<LegendBean> legends;
/**
* 数据
*/
private List<ChartBean> charts;
}
- 纵向上
- 分割出标题高度
- 分割出副标题高度
- 分割Y轴名称高度
- 分割数据部分高度
- 分割X轴文字部分高度
- 横向上
- 分割左侧Y轴宽度
- 分割中间数据区 宽度
- 分割右侧多个Y轴的 宽度
- 数据区域部分宽度一定,按照数据个数分割区域
- 计算各个区域 x轴中心点
- 计算柱状图,折线图点数据
- 使用 Matrix 矩阵方式转换
- 使用 Region 区域判定
- 绘制标题
- 绘制背景(包含x轴,y轴背景线)
- 绘制左侧坐标轴
- 绘制中间数据
- 绘制右侧坐标轴