GitHub - f-evil/OneChart: 基础图表控件
0. 系列文章
1. 原始效果图
2. Demo效果图
3. 解决问题
4. 由来
5. 包含内容
6. 使用
<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" />
7. 项目解析
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; }