wjc
2024-12-04 a399dc449dc962c088c2cacbc4c32d503ced816f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/**
 * //  AAChartModel.java
 * //  AAChartCore
 * //
 * //  Created by AnAn on 2017/9/5.
 * //  Copyright © 2018年 An An. All rights reserved.
 * <p>
 * ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
 * ◉◉◉...................................................       ◉◉◉
 * ◉◉◉   https://github.com/AAChartModel/AAChartCore            ◉◉◉
 * ◉◉◉   https://github.com/AAChartModel/AAChartCore-Kotlin     ◉◉◉
 * ◉◉◉...................................................       ◉◉◉
 * ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
 * <p>
 * <p>
 * -------------------------------------------------------------------------------
 * <p>
 * 🌕 🌖 🌗 🌘  ❀❀❀   WARM TIPS!!!   ❀❀❀ 🌑 🌒 🌓 🌔
 * <p>
 * Please contact me on GitHub,if there are any problems encountered in use.
 * GitHub Issues : https://github.com/AAChartModel/AAChartCore/issues
 * -------------------------------------------------------------------------------
 * And if you want to contribute for this project, please contact me as well
 * GitHub        : https://github.com/AAChartModel
 * StackOverflow : https://stackoverflow.com/users/7842508/codeforu
 * JianShu       : http://www.jianshu.com/u/f1e6753d4254
 * SegmentFault  : https://segmentfault.com/u/huanghunbieguan
 * <p>
 * -------------------------------------------------------------------------------
 */
 
package com.github.AAChartModel.AAChartCore.AAChartCreator;
 
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartAnimationType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartStackingType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartSymbolStyleType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartZoomType;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAOptions;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAScrollablePlotArea;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAStyle;
 
 
public class AAChartModel {
 
    public String animationType;         //动画类型
    public Integer animationDuration;     //动画时间
    public String title;                 //标题内容
    public AAStyle titleStyle;            //标题文本风格样式
    public String subtitle;              //副标题内容
    public String subtitleAlign;         //副标题水平对齐方式
    public AAStyle subtitleStyle;         //副标题文本风格样式
    public String axesTextColor;         //x 轴和 y 轴文字颜色
    public String chartType;             //图表类型
    public String stacking;              //堆积样式
    public String markerSymbol;          //折线曲线连接点的类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
    public String markerSymbolStyle;     //折线曲线连接点的自定义风格样式
    public String zoomType;              //缩放类型 AAChartZoomTypeX表示可沿着 x 轴进行手势缩放
    public Boolean inverted;              //x 轴是否翻转(垂直)
    public Boolean xAxisReversed;         //x 轴翻转
    public Boolean yAxisReversed;         //y 轴翻转
    public Boolean tooltipEnabled;        //是否显示浮动提示框(默认显示)
    public String tooltipValueSuffix;    //浮动提示框单位后缀
    public Boolean gradientColorEnable;   //是否要为渐变色
    public Boolean polar;                 //是否极化图形(变为雷达图)
    public Number[] margin;                //图表外边缘和绘图区域之间的边距
    public Boolean dataLabelsEnabled;     //是否显示数据
    public AAStyle dataLabelsStyle;       //数据文本风格样式
    public Boolean xAxisLabelsEnabled;    //x 轴是否显示数据
    public Integer xAxisTickInterval;     //x 轴刻度点间隔数(设置每隔几个点显示一个 X轴的内容)
    public String[] categories;            //x 轴是否显示数据
    public Number xAxisGridLineWidth;    //x 轴网格线的宽度
    public Boolean xAxisVisible;          //x 轴是否显示
    public Boolean yAxisVisible;          //y 轴是否显示
    public Boolean yAxisLabelsEnabled;    //y 轴是否显示数据
    public String yAxisTitle;            //y 轴标题
    public Number yAxisLineWidth;        //y 轴轴线的宽度
    public Number yAxisMin;              //y 轴最小值
    public Number yAxisMax;              //y 轴最大值
    public Boolean yAxisAllowDecimals;    //y 轴是否允许显示小数
    public Number yAxisGridLineWidth;    //y 轴网格线的宽度
    public Object[] colorsTheme;           //图表主题颜色数组
    public Boolean legendEnabled;         //是否显示图例
    public Object backgroundColor;       //图表背景色
    public Number borderRadius;          //柱状图长条图头部圆角半径(可用于设置头部的形状,仅对条形图,柱状图有效)
    public Number markerRadius;          //折线连接点的半径长度
    public Object[] series;                //图表的数据列内容
    public Boolean touchEventEnabled;     //是否支持用户触摸事件
    public AAScrollablePlotArea scrollablePlotArea;
 
 
    public AAChartModel animationType(String prop) {
        animationType = prop;
        return this;
    }
 
    public AAChartModel animationDuration(Integer prop) {
        animationDuration = prop;
        return this;
    }
 
    public AAChartModel title(String prop) {
        title = prop;
        return this;
    }
 
    public AAChartModel titleStyle(AAStyle prop) {
        titleStyle = prop;
        return this;
    }
 
    public AAChartModel subtitle(String prop) {
        subtitle = prop;
        return this;
    }
 
    public AAChartModel subtitleAlign(String prop) {
        subtitleAlign = prop;
        return this;
    }
 
    public AAChartModel subtitleStyle(AAStyle prop) {
        subtitleStyle = prop;
        return this;
    }
 
    public AAChartModel axesTextColor(String prop) {
        axesTextColor = prop;
        return this;
    }
 
    public AAChartModel chartType(String prop) {
        chartType = prop;
        return this;
    }
 
    public AAChartModel stacking(String prop) {
        stacking = prop;
        return this;
    }
 
    public AAChartModel markerSymbol(String prop) {
        markerSymbol = prop;
        return this;
    }
 
    public AAChartModel markerSymbolStyle(String prop) {
        markerSymbolStyle = prop;
        return this;
    }
 
    public AAChartModel zoomType(String prop) {
        zoomType = prop;
        return this;
    }
 
    public AAChartModel inverted(Boolean prop) {
        inverted = prop;
        return this;
    }
 
    public AAChartModel xAxisReversed(Boolean prop) {
        xAxisReversed = prop;
        return this;
    }
 
    public AAChartModel yAxisReversed(Boolean prop) {
        yAxisReversed = prop;
        return this;
    }
 
    public AAChartModel tooltipEnabled(Boolean prop) {
        tooltipEnabled = prop;
        return this;
    }
 
    public AAChartModel tooltipValueSuffix(String prop) {
        tooltipValueSuffix = prop;
        return this;
    }
 
    public AAChartModel gradientColorEnable(Boolean prop) {
        gradientColorEnable = prop;
        return this;
    }
 
    public AAChartModel polar(Boolean prop) {
        polar = prop;
        return this;
    }
 
    public AAChartModel margin(Number[] prop) {
        margin = prop;
        return this;
    }
 
    public AAChartModel dataLabelsEnabled(Boolean prop) {
        dataLabelsEnabled = prop;
        return this;
    }
 
    public AAChartModel dataLabelsStyle(AAStyle prop) {
        dataLabelsStyle = prop;
        return this;
    }
 
    public AAChartModel xAxisLabelsEnabled(Boolean prop) {
        xAxisLabelsEnabled = prop;
        return this;
    }
 
    public AAChartModel xAxisTickInterval(Integer prop) {
        xAxisTickInterval = prop;
        return this;
    }
 
    public AAChartModel categories(String[] prop) {
        categories = prop;
        return this;
    }
 
    public AAChartModel xAxisGridLineWidth(Number prop) {
        xAxisGridLineWidth = prop;
        return this;
    }
 
    public AAChartModel yAxisGridLineWidth(Number prop) {
        yAxisGridLineWidth = prop;
        return this;
    }
 
    public AAChartModel xAxisVisible(Boolean prop) {
        xAxisVisible = prop;
        return this;
    }
 
    public AAChartModel yAxisVisible(Boolean prop) {
        yAxisVisible = prop;
        return this;
    }
 
    public AAChartModel yAxisLabelsEnabled(Boolean prop) {
        yAxisLabelsEnabled = prop;
        return this;
    }
 
    public AAChartModel yAxisTitle(String prop) {
        yAxisTitle = prop;
        return this;
    }
 
    public AAChartModel yAxisLineWidth(Number prop) {
        yAxisLineWidth = prop;
        return this;
    }
 
    public AAChartModel yAxisMin(Number prop) {
        yAxisMin = prop;
        return this;
    }
 
    public AAChartModel yAxisMax(Number prop) {
        yAxisMax = prop;
        return this;
    }
 
    public AAChartModel yAxisAllowDecimals(Boolean prop) {
        yAxisAllowDecimals = prop;
        return this;
    }
 
    public AAChartModel colorsTheme(Object[] prop) {
        colorsTheme = prop;
        return this;
    }
 
    public AAChartModel legendEnabled(Boolean prop) {
        legendEnabled = prop;
        return this;
    }
 
    public AAChartModel backgroundColor(Object prop) {
        backgroundColor = prop;
        return this;
    }
 
 
    public AAChartModel borderRadius(Number prop) {
        borderRadius = prop;
        return this;
    }
 
    public AAChartModel markerRadius(Number prop) {
        markerRadius = prop;
        return this;
    }
 
    public AAChartModel series(Object[] prop) {
        series = prop;
        return this;
    }
 
    public AAChartModel touchEventEnabled(Boolean prop) {
        touchEventEnabled = prop;
        return this;
    }
 
    public AAChartModel scrollablePlotArea(AAScrollablePlotArea prop) {
        scrollablePlotArea = prop;
        return this;
    }
 
    public AAOptions aa_toAAOptions() {
        return AAOptionsConstructor.configureChartOptions(this);
    }
 
    public AAChartModel() {
        chartType = AAChartType.Line;
        title = "";
        yAxisTitle = "";
        animationDuration = 500;//以毫秒为单位
        animationType = AAChartAnimationType.Linear;
        inverted = false;
        stacking = AAChartStackingType.False;
        xAxisReversed = false;
        yAxisReversed = false;
        zoomType = AAChartZoomType.None;
        dataLabelsEnabled = false;
        markerSymbolStyle = AAChartSymbolStyleType.Normal;
        colorsTheme = new String[]{"#fe117c", "#ffc069", "#06caf4", "#7dffc0"};//默认的颜色数组(必须要添加默认数组,否则就会出错)
        gradientColorEnable = false;
        polar = false;
        xAxisLabelsEnabled = true;
        xAxisGridLineWidth = 0f;
        yAxisLabelsEnabled = true;
        yAxisGridLineWidth = 1f;
        legendEnabled = true;
        backgroundColor = "#333738";
        borderRadius = 0f;//柱状图长条图头部圆角半径(可用于设置头部的形状,仅对条形图,柱状图有效,设置为1000时,柱形图或者条形图头部为楔形)
        markerRadius = 6f;//折线连接点的半径长度,如果值设置为0,这样就相当于不显示了
    }
 
}