├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── QQ截图20171028153815.png
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── day.json
│ ├── month.json
│ └── year.json
│ ├── java
│ └── com
│ │ └── example
│ │ └── guo
│ │ └── linechartnotify
│ │ ├── MainActivity.java
│ │ ├── bean
│ │ └── ChartDayBean.java
│ │ └── utils
│ │ ├── GetJsonDataUtil.java
│ │ └── MyMarkerView.java
│ └── res
│ ├── drawable
│ ├── bg_line_chart.xml
│ ├── bg_oval.xml
│ └── bgl_marker.xml
│ ├── layout
│ ├── activity_main.xml
│ └── custom_marker_view.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── chart1.gif
├── chart2.gif
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/QQ截图20171028153815.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/QQ截图20171028153815.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LineChartNotify
2 |
3 | 定期分享国内外别人家技术赚钱的案例,希望能给你启发。可以关注一波 保证不坑,坑了取消就是啦 :)
4 |
5 | 
6 |
7 |
8 | MVAndroidChart之LineChart使用
9 | ## 效果图
10 | 
11 | 
12 | 
13 | ## 详情
14 | [csdn博客](http://blog.csdn.net/guozhaohui628/article/details/78379592)
15 |
16 | 如果帮到你了给个star支持下,谢谢了
17 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "26.0.2"
6 | defaultConfig {
7 | applicationId "com.example.guo.linechartnotify"
8 | minSdkVersion 15
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(include: ['*.jar'], dir: 'libs')
23 | compile 'com.android.support:appcompat-v7:25.3.1'
24 | compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
25 | }
26 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\MyDownLoad\as\android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/assets/day.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "saveTime": "2017-10-28 06:00:00.0",
4 | "attribValue": 0
5 | },
6 | {
7 | "saveTime": "2017-10-28 06:05:00.0",
8 | "attribValue": 0
9 | },
10 | {
11 | "saveTime": "2017-10-28 06:10:00.0",
12 | "attribValue": 0
13 | },
14 | {
15 | "saveTime": "2017-10-28 06:15:00.0",
16 | "attribValue": 0
17 | },
18 | {
19 | "saveTime": "2017-10-28 06:20:00.0",
20 | "attribValue": 0
21 | },
22 | {
23 | "saveTime": "2017-10-28 06:25:00.0",
24 | "attribValue": 0
25 | },
26 | {
27 | "saveTime": "2017-10-28 06:30:00.0",
28 | "attribValue": 0
29 | },
30 | {
31 | "saveTime": "2017-10-28 06:35:00.0",
32 | "attribValue": 55
33 | },
34 | {
35 | "saveTime": "2017-10-28 06:40:00.0",
36 | "attribValue": 498
37 | },
38 | {
39 | "saveTime": "2017-10-28 06:45:00.0",
40 | "attribValue": 1055
41 | },
42 | {
43 | "saveTime": "2017-10-28 06:50:00.0",
44 | "attribValue": 1609
45 | },
46 | {
47 | "saveTime": "2017-10-28 06:55:00.0",
48 | "attribValue": 2250
49 | },
50 | {
51 | "saveTime": "2017-10-28 07:00:00.0",
52 | "attribValue": 3592
53 | },
54 | {
55 | "saveTime": "2017-10-28 07:05:00.0",
56 | "attribValue": 4137
57 | },
58 | {
59 | "saveTime": "2017-10-28 07:10:00.0",
60 | "attribValue": 6009
61 | },
62 | {
63 | "saveTime": "2017-10-28 07:15:00.0",
64 | "attribValue": 7751
65 | },
66 | {
67 | "saveTime": "2017-10-28 07:20:00.0",
68 | "attribValue": 9350
69 | },
70 | {
71 | "saveTime": "2017-10-28 07:25:00.0",
72 | "attribValue": 11473
73 | },
74 | {
75 | "saveTime": "2017-10-28 07:30:00.0",
76 | "attribValue": 13646
77 | },
78 | {
79 | "saveTime": "2017-10-28 07:35:00.0",
80 | "attribValue": 17081
81 | },
82 | {
83 | "saveTime": "2017-10-28 07:40:00.0",
84 | "attribValue": 19356
85 | },
86 | {
87 | "saveTime": "2017-10-28 07:45:00.0",
88 | "attribValue": 22411
89 | },
90 | {
91 | "saveTime": "2017-10-28 07:50:00.0",
92 | "attribValue": 24676
93 | },
94 | {
95 | "saveTime": "2017-10-28 07:55:00.0",
96 | "attribValue": 29377
97 | },
98 | {
99 | "saveTime": "2017-10-28 08:00:00.0",
100 | "attribValue": 32412
101 | },
102 | {
103 | "saveTime": "2017-10-28 08:05:00.0",
104 | "attribValue": 36801
105 | },
106 | {
107 | "saveTime": "2017-10-28 08:10:00.0",
108 | "attribValue": 40610
109 | },
110 | {
111 | "saveTime": "2017-10-28 08:15:00.0",
112 | "attribValue": 43864
113 | },
114 | {
115 | "saveTime": "2017-10-28 08:20:00.0",
116 | "attribValue": 47771
117 | },
118 | {
119 | "saveTime": "2017-10-28 08:25:00.0",
120 | "attribValue": 51071
121 | },
122 | {
123 | "saveTime": "2017-10-28 08:30:00.0",
124 | "attribValue": 55321
125 | },
126 | {
127 | "saveTime": "2017-10-28 08:35:00.0",
128 | "attribValue": 58090
129 | },
130 | {
131 | "saveTime": "2017-10-28 08:40:00.0",
132 | "attribValue": 62146
133 | },
134 | {
135 | "saveTime": "2017-10-28 08:45:00.0",
136 | "attribValue": 65416
137 | },
138 | {
139 | "saveTime": "2017-10-28 08:50:00.0",
140 | "attribValue": 69004
141 | },
142 | {
143 | "saveTime": "2017-10-28 08:55:00.0",
144 | "attribValue": 72331
145 | },
146 | {
147 | "saveTime": "2017-10-28 09:00:00.0",
148 | "attribValue": 75354
149 | },
150 | {
151 | "saveTime": "2017-10-28 09:05:00.0",
152 | "attribValue": 71456
153 | },
154 | {
155 | "saveTime": "2017-10-28 09:10:00.0",
156 | "attribValue": 74276
157 | },
158 | {
159 | "saveTime": "2017-10-28 09:15:00.0",
160 | "attribValue": 76952
161 | },
162 | {
163 | "saveTime": "2017-10-28 09:20:00.0",
164 | "attribValue": 79207
165 | },
166 | {
167 | "saveTime": "2017-10-28 09:25:00.0",
168 | "attribValue": 77645
169 | },
170 | {
171 | "saveTime": "2017-10-28 09:30:00.0",
172 | "attribValue": 83788
173 | },
174 | {
175 | "saveTime": "2017-10-28 09:35:00.0",
176 | "attribValue": 85841
177 | },
178 | {
179 | "saveTime": "2017-10-28 09:40:00.0",
180 | "attribValue": 82203
181 | },
182 | {
183 | "saveTime": "2017-10-28 09:45:00.0",
184 | "attribValue": 84102
185 | },
186 | {
187 | "saveTime": "2017-10-28 09:50:00.0",
188 | "attribValue": 85707
189 | },
190 | {
191 | "saveTime": "2017-10-28 09:55:00.0",
192 | "attribValue": 87900
193 | },
194 | {
195 | "saveTime": "2017-10-28 10:00:00.0",
196 | "attribValue": 82146
197 | },
198 | {
199 | "saveTime": "2017-10-28 10:05:00.0",
200 | "attribValue": 85532
201 | },
202 | {
203 | "saveTime": "2017-10-28 10:10:00.0",
204 | "attribValue": 93230
205 | },
206 | {
207 | "saveTime": "2017-10-28 10:15:00.0",
208 | "attribValue": 94066
209 | },
210 | {
211 | "saveTime": "2017-10-28 10:20:00.0",
212 | "attribValue": 66450
213 | },
214 | {
215 | "saveTime": "2017-10-28 10:25:00.0",
216 | "attribValue": 97877
217 | },
218 | {
219 | "saveTime": "2017-10-28 10:30:00.0",
220 | "attribValue": 98828
221 | },
222 | {
223 | "saveTime": "2017-10-28 10:35:00.0",
224 | "attribValue": 117132
225 | },
226 | {
227 | "saveTime": "2017-10-28 10:40:00.0",
228 | "attribValue": 99788
229 | },
230 | {
231 | "saveTime": "2017-10-28 10:45:00.0",
232 | "attribValue": 121001
233 | },
234 | {
235 | "saveTime": "2017-10-28 10:50:00.0",
236 | "attribValue": 113459
237 | },
238 | {
239 | "saveTime": "2017-10-28 10:55:00.0",
240 | "attribValue": 122486
241 | },
242 | {
243 | "saveTime": "2017-10-28 11:00:00.0",
244 | "attribValue": 123430
245 | },
246 | {
247 | "saveTime": "2017-10-28 11:05:00.0",
248 | "attribValue": 124882
249 | },
250 | {
251 | "saveTime": "2017-10-28 11:10:00.0",
252 | "attribValue": 123553
253 | },
254 | {
255 | "saveTime": "2017-10-28 11:15:00.0",
256 | "attribValue": 125603
257 | },
258 | {
259 | "saveTime": "2017-10-28 11:20:00.0",
260 | "attribValue": 95354
261 | },
262 | {
263 | "saveTime": "2017-10-28 11:25:00.0",
264 | "attribValue": 127300
265 | },
266 | {
267 | "saveTime": "2017-10-28 11:30:00.0",
268 | "attribValue": 116152
269 | },
270 | {
271 | "saveTime": "2017-10-28 11:35:00.0",
272 | "attribValue": 127590
273 | },
274 | {
275 | "saveTime": "2017-10-28 11:40:00.0",
276 | "attribValue": 128604
277 | },
278 | {
279 | "saveTime": "2017-10-28 11:45:00.0",
280 | "attribValue": 127559
281 | },
282 | {
283 | "saveTime": "2017-10-28 11:50:00.0",
284 | "attribValue": 127176
285 | },
286 | {
287 | "saveTime": "2017-10-28 11:55:00.0",
288 | "attribValue": 127867
289 | },
290 | {
291 | "saveTime": "2017-10-28 12:00:00.0",
292 | "attribValue": 127329
293 | },
294 | {
295 | "saveTime": "2017-10-28 12:05:00.0",
296 | "attribValue": 126148
297 | },
298 | {
299 | "saveTime": "2017-10-28 12:10:00.0",
300 | "attribValue": 125267
301 | },
302 | {
303 | "saveTime": "2017-10-28 12:15:00.0",
304 | "attribValue": 126492
305 | },
306 | {
307 | "saveTime": "2017-10-28 12:20:00.0",
308 | "attribValue": 127127
309 | },
310 | {
311 | "saveTime": "2017-10-28 12:25:00.0",
312 | "attribValue": 128455
313 | },
314 | {
315 | "saveTime": "2017-10-28 12:30:00.0",
316 | "attribValue": 127073
317 | },
318 | {
319 | "saveTime": "2017-10-28 12:35:00.0",
320 | "attribValue": 127770
321 | },
322 | {
323 | "saveTime": "2017-10-28 12:40:00.0",
324 | "attribValue": 116556
325 | },
326 | {
327 | "saveTime": "2017-10-28 12:45:00.0",
328 | "attribValue": 127041
329 | },
330 | {
331 | "saveTime": "2017-10-28 12:50:00.0",
332 | "attribValue": 126023
333 | },
334 | {
335 | "saveTime": "2017-10-28 12:55:00.0",
336 | "attribValue": 117142
337 | },
338 | {
339 | "saveTime": "2017-10-28 13:00:00.0",
340 | "attribValue": 124044
341 | },
342 | {
343 | "saveTime": "2017-10-28 13:05:00.0",
344 | "attribValue": 122728
345 | },
346 | {
347 | "saveTime": "2017-10-28 13:10:00.0",
348 | "attribValue": 121595
349 | },
350 | {
351 | "saveTime": "2017-10-28 13:15:00.0",
352 | "attribValue": 120736
353 | },
354 | {
355 | "saveTime": "2017-10-28 13:20:00.0",
356 | "attribValue": 120020
357 | },
358 | {
359 | "saveTime": "2017-10-28 13:25:00.0",
360 | "attribValue": 109786
361 | },
362 | {
363 | "saveTime": "2017-10-28 13:30:00.0",
364 | "attribValue": 117798
365 | },
366 | {
367 | "saveTime": "2017-10-28 13:35:00.0",
368 | "attribValue": 116977
369 | },
370 | {
371 | "saveTime": "2017-10-28 13:40:00.0",
372 | "attribValue": 115691
373 | },
374 | {
375 | "saveTime": "2017-10-28 13:45:00.0",
376 | "attribValue": 114694
377 | },
378 | {
379 | "saveTime": "2017-10-28 13:50:00.0",
380 | "attribValue": 112050
381 | },
382 | {
383 | "saveTime": "2017-10-28 13:55:00.0",
384 | "attribValue": 110493
385 | },
386 | {
387 | "saveTime": "2017-10-28 14:00:00.0",
388 | "attribValue": 109504
389 | },
390 | {
391 | "saveTime": "2017-10-28 14:05:00.0",
392 | "attribValue": 108355
393 | },
394 | {
395 | "saveTime": "2017-10-28 14:10:00.0",
396 | "attribValue": 106635
397 | },
398 | {
399 | "saveTime": "2017-10-28 14:15:00.0",
400 | "attribValue": 96714
401 | },
402 | {
403 | "saveTime": "2017-10-28 14:20:00.0",
404 | "attribValue": 102557
405 | },
406 | {
407 | "saveTime": "2017-10-28 14:25:00.0",
408 | "attribValue": 101228
409 | },
410 | {
411 | "saveTime": "2017-10-28 14:30:00.0",
412 | "attribValue": 98478
413 | },
414 | {
415 | "saveTime": "2017-10-28 14:35:00.0",
416 | "attribValue": 96830
417 | },
418 | {
419 | "saveTime": "2017-10-28 14:40:00.0",
420 | "attribValue": 94662
421 | },
422 | {
423 | "saveTime": "2017-10-28 14:45:00.0",
424 | "attribValue": 68293
425 | },
426 | {
427 | "saveTime": "2017-10-28 14:50:00.0",
428 | "attribValue": 90622
429 | },
430 | {
431 | "saveTime": "2017-10-28 14:55:00.0",
432 | "attribValue": 81085
433 | },
434 | {
435 | "saveTime": "2017-10-28 15:00:00.0",
436 | "attribValue": 85565
437 | },
438 | {
439 | "saveTime": "2017-10-28 15:05:00.0",
440 | "attribValue": 61329
441 | },
442 | {
443 | "saveTime": "2017-10-28 15:10:00.0",
444 | "attribValue": 79621
445 | },
446 | {
447 | "saveTime": "2017-10-28 15:15:00.0",
448 | "attribValue": 77200
449 | },
450 | {
451 | "saveTime": "2017-10-28 15:20:00.0",
452 | "attribValue": 74272
453 | },
454 | {
455 | "saveTime": "2017-10-28 15:25:00.0",
456 | "attribValue": 71893
457 | },
458 | {
459 | "saveTime": "2017-10-28 15:30:00.0",
460 | "attribValue": 69094
461 | },
462 | {
463 | "saveTime": "2017-10-28 15:35:00.0",
464 | "attribValue": 65541
465 | },
466 | {
467 | "saveTime": "2017-10-28 15:40:00.0",
468 | "attribValue": 58201
469 | },
470 | {
471 | "saveTime": "2017-10-28 15:45:00.0",
472 | "attribValue": 59557
473 | },
474 | {
475 | "saveTime": "2017-10-28 15:50:00.0",
476 | "attribValue": 55480
477 | },
478 | {
479 | "saveTime": "2017-10-28 15:55:00.0",
480 | "attribValue": 51707
481 | },
482 | {
483 | "saveTime": "2017-10-28 16:00:00.0",
484 | "attribValue": 49770
485 | },
486 | {
487 | "saveTime": "2017-10-28 16:05:00.0",
488 | "attribValue": 43452
489 | },
490 | {
491 | "saveTime": "2017-10-28 16:10:00.0",
492 | "attribValue": 39478
493 | },
494 | {
495 | "saveTime": "2017-10-28 16:15:00.0",
496 | "attribValue": 36612
497 | },
498 | {
499 | "saveTime": "2017-10-28 16:20:00.0",
500 | "attribValue": 31224
501 | },
502 | {
503 | "saveTime": "2017-10-28 16:25:00.0",
504 | "attribValue": 31277
505 | },
506 | {
507 | "saveTime": "2017-10-28 16:30:00.0",
508 | "attribValue": 25501
509 | },
510 | {
511 | "saveTime": "2017-10-28 16:35:00.0",
512 | "attribValue": 26350
513 | },
514 | {
515 | "saveTime": "2017-10-28 16:40:00.0",
516 | "attribValue": 23872
517 | },
518 | {
519 | "saveTime": "2017-10-28 16:45:00.0",
520 | "attribValue": 18940
521 | },
522 | {
523 | "saveTime": "2017-10-28 16:50:00.0",
524 | "attribValue": 18171
525 | },
526 | {
527 | "saveTime": "2017-10-28 16:55:00.0",
528 | "attribValue": 15681
529 | },
530 | {
531 | "saveTime": "2017-10-28 17:00:00.0",
532 | "attribValue": 13239
533 | }
534 | ]
535 |
--------------------------------------------------------------------------------
/app/src/main/assets/month.json:
--------------------------------------------------------------------------------
1 |
2 | [
3 | 511,
4 | 586,
5 | 209,
6 | 96,
7 | 203,
8 | 201,
9 | 215,
10 | 457,
11 | 477,
12 | 584,
13 | 44,
14 | 80,
15 | 102,
16 | 213,
17 | 64,
18 | 88,
19 | 94,
20 | 103,
21 | 218,
22 | 261,
23 | 715,
24 | 642,
25 | 444,
26 | 889,
27 | 607,
28 | 734,
29 | 803,
30 | 839,
31 | 0,
32 | 0,
33 | 0
34 | ]
35 |
--------------------------------------------------------------------------------
/app/src/main/assets/year.json:
--------------------------------------------------------------------------------
1 | [
2 | 0,
3 | 0,
4 | 0,
5 | 0,
6 | 0,
7 | 0,
8 | 0,
9 | 0,
10 | 1335,
11 | 10048,
12 | 0,
13 | 0
14 | ]
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/guo/linechartnotify/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.guo.linechartnotify;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.view.View.OnClickListener;
9 | import android.widget.Button;
10 | import android.widget.Toast;
11 |
12 | import com.example.guo.linechartnotify.bean.ChartDayBean;
13 | import com.example.guo.linechartnotify.utils.GetJsonDataUtil;
14 | import com.example.guo.linechartnotify.utils.MyMarkerView;
15 | import com.github.mikephil.charting.charts.LineChart;
16 | import com.github.mikephil.charting.components.AxisBase;
17 | import com.github.mikephil.charting.components.Description;
18 | import com.github.mikephil.charting.components.XAxis;
19 | import com.github.mikephil.charting.components.YAxis;
20 | import com.github.mikephil.charting.data.Entry;
21 | import com.github.mikephil.charting.data.LineData;
22 | import com.github.mikephil.charting.data.LineDataSet;
23 | import com.github.mikephil.charting.formatter.IAxisValueFormatter;
24 | import com.github.mikephil.charting.highlight.Highlight;
25 | import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
26 |
27 |
28 | import org.json.JSONArray;
29 | import org.json.JSONObject;
30 |
31 | import java.util.ArrayList;
32 | import java.util.List;
33 |
34 | import static com.github.mikephil.charting.components.Legend.LegendPosition.RIGHT_OF_CHART_INSIDE;
35 |
36 | /**
37 | * Created by ${GuoZhaoHui} on 2017/10/28.
38 | * Email:guozhaohui628@gmail.com
39 | * @author Guo
40 | */
41 |
42 | public class MainActivity extends AppCompatActivity implements OnClickListener,OnChartValueSelectedListener {
43 |
44 | private LineChart lineChart;
45 |
46 | //日实时功率的xy
47 | private List xDayData = new ArrayList<>();
48 | private List yDayData = new ArrayList<>();
49 |
50 | //月发电量的xy
51 | private List xMonthData = new ArrayList<>();
52 | private List yMonthData = new ArrayList<>();
53 |
54 | //年发电量的xy
55 | private List xYearData = new ArrayList<>();
56 | private List yYearData = new ArrayList<>();
57 | @Override
58 | protected void onCreate(@Nullable Bundle savedInstanceState) {
59 | super.onCreate(savedInstanceState);
60 | setContentView(R.layout.activity_main);
61 |
62 | initView();
63 |
64 | //默认显示
65 | reqeustDayData();
66 |
67 | }
68 |
69 | private void initView() {
70 | Button btDay = (Button) this.findViewById(R.id.bt_day);
71 | Button btMonth = (Button) this.findViewById(R.id.bt_month);
72 | Button btYear = (Button) this.findViewById(R.id.bt_year);
73 | Button btAll = (Button) this.findViewById(R.id.bt_all);
74 |
75 | btDay.setOnClickListener(this);
76 | btMonth.setOnClickListener(this);
77 | btYear.setOnClickListener(this);
78 | btAll.setOnClickListener(this);
79 |
80 | //对折线图初始化
81 | initChartView();
82 | }
83 |
84 | /**
85 | * 初始化折线图
86 | */
87 | private void initChartView() {
88 | lineChart = (LineChart) this.findViewById(R.id.linechart);
89 |
90 | //在点击高亮值时回调
91 | lineChart.setOnChartValueSelectedListener(this);
92 |
93 | //设置整个图表的颜色
94 | lineChart.setBackgroundResource(R.drawable.bg_line_chart);
95 |
96 | Description description = lineChart.getDescription();
97 | description.setYOffset(10);
98 | description.setEnabled(true);
99 | description.setText("时间");
100 |
101 | //设置标签的位置(如 发电量 实时功率)
102 | lineChart.getLegend().setPosition(RIGHT_OF_CHART_INSIDE);
103 |
104 | //是否可以缩放、移动、触摸
105 | lineChart.setTouchEnabled(true);
106 | lineChart.setDragEnabled(true);
107 |
108 | //不能让缩放,不然有bug,所以接口也没实现
109 | lineChart.setScaleEnabled(false);
110 | lineChart.setPinchZoom(true);
111 |
112 | //设置图表距离上下左右的距离
113 | lineChart.setExtraOffsets(10, 10, 10, 0);
114 |
115 | //获取左侧侧坐标轴
116 | YAxis leftAxis = lineChart.getAxisLeft();
117 |
118 | //设置是否显示Y轴的值
119 | leftAxis.setDrawLabels(true);
120 | leftAxis.setTextColor(this.getResources().getColor(R.color.homecolor));
121 |
122 | //设置所有垂直Y轴的的网格线是否显示
123 | leftAxis.setDrawGridLines(true);
124 |
125 | //设置虚线
126 | leftAxis.enableGridDashedLine(10f, 10f, 0f);
127 | leftAxis.setDrawZeroLine(false);
128 |
129 | //设置Y极值,我这里没设置最大值,因为项目需要没有设置最大值
130 | leftAxis.setAxisMinimum(0f);
131 |
132 | //将右边那条线隐藏
133 | lineChart.getAxisRight().setEnabled(false);
134 | //获取X轴
135 | XAxis xAxis = lineChart.getXAxis();
136 | //设置X轴的位置,可上可下
137 | xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
138 |
139 | //将垂直于X轴的网格线隐藏,将X轴显示
140 | xAxis.setDrawGridLines(false);
141 | xAxis.setDrawAxisLine(true);
142 |
143 | //设置X轴上lable颜色和大小
144 | xAxis.setTextSize(8f);
145 | xAxis.setTextColor(Color.GRAY);
146 |
147 | //设置X轴高度
148 | xAxis.setAxisLineWidth(1);
149 | }
150 |
151 | @Override
152 | public void onClick(View v) {
153 | switch(v.getId()){
154 | case R.id.bt_day:
155 | if (xDayData.size() != 0 || yDayData.size() != 0) { //不请求服务器
156 | setChartData(xDayData, yDayData,0);
157 | lineChart.invalidate();
158 | } else {
159 | reqeustDayData(); //请求服务器
160 | }
161 | break;
162 | case R.id.bt_month:
163 | if (xMonthData.size() != 0 || yMonthData.size() != 0) { //有数据
164 | setChartData(xMonthData, yMonthData,1);
165 | lineChart.invalidate();
166 | }else{ //没数据,请求服务器
167 | reqeustMonthData();
168 | }
169 | break;
170 | case R.id.bt_year:
171 | if (xYearData.size() != 0 || yYearData.size() != 0) { //有数据
172 | setChartData(xYearData, yYearData,1);
173 | lineChart.invalidate();
174 | }else{ //没数据,请求服务器
175 | reqeustYearData();
176 | }
177 | break;
178 | case R.id.bt_all:
179 | Toast.makeText(this,"hi,what's up?",Toast.LENGTH_SHORT).show();
180 | break;
181 | default:
182 | break;
183 | }
184 | }
185 |
186 | /**
187 | * 数据都是从服务器获取,这里我拿出了项目接口一天的数据,做成json文件(见assests)
188 | * 关键在于代码逻辑以及方法,反正这个方法是用来获取日实时功率
189 | */
190 | private void reqeustDayData(){
191 | String jsondata = new GetJsonDataUtil().getJson(this,"day.json");
192 | try {
193 | JSONArray data = new JSONArray(jsondata);
194 | for (int i = 0; i < data.length(); i++) {
195 | JSONObject jsonObject = data.getJSONObject(i);
196 |
197 | //循环遍历时X轴和Y轴的值获取到
198 | String time = jsonObject.getString("saveTime").substring(11, 16);
199 | xDayData.add(time);
200 | yDayData.add(jsonObject.getInt("attribValue") + "");
201 | }
202 | } catch (Exception e) {
203 | e.printStackTrace();
204 | }
205 |
206 | if (xDayData.size() != 0 || yDayData.size() != 0) {
207 | setChartData(xDayData, yDayData,0);
208 | lineChart.invalidate();
209 | }
210 |
211 | }
212 |
213 | /**
214 | * 数据都是从服务器获取,这里我拿出了项目接口一天的数据,做成json文件(见assests)
215 | * 关键在于代码逻辑以及方法,反正这个方法是用来获取月发电量
216 | */
217 | private void reqeustMonthData(){
218 | String jsondata = new GetJsonDataUtil().getJson(this,"month.json");
219 | try {
220 | JSONArray data = new JSONArray(jsondata);
221 | for (int i = 0; i < data.length(); i++) {
222 | xMonthData.add(i+1+"天");
223 | yMonthData.add(String.valueOf(data.get(i)));
224 | }
225 | } catch (Exception e) {
226 | e.printStackTrace();
227 | }
228 |
229 | if (xMonthData.size() != 0 || yMonthData.size() != 0) {
230 | setChartData(xMonthData, yMonthData,1);
231 | lineChart.invalidate();
232 | }
233 | }
234 |
235 |
236 |
237 | /**
238 | * 数据都是从服务器获取,这里我拿出了项目接口一天的数据,做成json文件(见assests)
239 | * 关键在于代码逻辑以及方法,反正这个方法是用来获取年发电量
240 | */
241 | private void reqeustYearData(){
242 | String jsondata = new GetJsonDataUtil().getJson(this,"year.json");
243 | try {
244 | JSONArray data = new JSONArray(jsondata);
245 | for (int i = 0; i < data.length(); i++) {
246 | xYearData.add(i+1+"月");
247 | yYearData.add(String.valueOf(data.get(i)));
248 | }
249 | } catch (Exception e) {
250 | e.printStackTrace();
251 | }
252 |
253 | if (xYearData.size() != 0 || yYearData.size() != 0) {
254 | setChartData(xYearData, yYearData,1);
255 | lineChart.invalidate();
256 | }
257 | }
258 |
259 | /**
260 | * 为折线图设置数据,并且第一个图表的标签是日实时功率,后面的都是发电量,通过flag来判断,flag 0 实时功率 ,1 发电量
261 | * @param xData
262 | * @param yData
263 | * @param flag
264 | */
265 | private void setChartData(final List xData , List yData, int flag) {
266 |
267 | lineChart.getXAxis().setValueFormatter(new IAxisValueFormatter() {
268 | @Override
269 | public String getFormattedValue(float value, AxisBase axis) {
270 |
271 | //对X轴上的值进行Format格式化,转成相应的值
272 | int intValue = (int)value;
273 |
274 | //筛选出自己需要的值,一般都是这样写没问题,并且一定要加上这个判断,不然会出错
275 | if(xData.size()>intValue && intValue>=0){
276 | //这样显示在X轴上值就是 05:30 05:35,不然会是1.0 2.0
277 | return xData.get(intValue);
278 | }else{
279 | return "";
280 | }
281 | }
282 | });
283 |
284 | lineChart.invalidate();
285 |
286 | MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view,xData);
287 | mv.setChartView(lineChart);
288 | lineChart.setMarker(mv);
289 |
290 | final ArrayList values = new ArrayList<>();
291 |
292 | for (int i = 0; i < yData.size(); i++) {
293 |
294 | //注意这里的Entry(不一定需要)采用这种方式构造,采用其他的结果是一样的
295 | values.add(new Entry(i, Float.valueOf(yData.get(i)),xData.get(i)));
296 | }
297 |
298 | LineDataSet lineDataset ;
299 |
300 | if (lineChart.getData() != null && lineChart.getData().getDataSetCount() > 0) {
301 |
302 | lineDataset = (LineDataSet) lineChart.getData().getDataSetByIndex(0);
303 | lineDataset.setValues(values);
304 | if(flag==0){
305 | lineDataset.setLabel("实时功率");
306 | lineDataset.setDrawFilled(true);
307 | }
308 | else{
309 | lineDataset.setLabel("发电量");
310 | lineDataset.setDrawFilled(false);
311 | }
312 |
313 | lineChart.getData().notifyDataChanged();
314 | lineChart.notifyDataSetChanged();
315 |
316 | }else{
317 | if(flag==0){
318 | lineDataset = new LineDataSet(values, "实时功率");
319 | lineDataset.setDrawFilled(true);
320 | }else{
321 | lineDataset = new LineDataSet(values, "发电量");
322 | lineDataset.setDrawFilled(false);
323 | }
324 |
325 | lineDataset.setColor(this.getResources().getColor(R.color.homecolor));
326 |
327 | //设置是否显示圆点
328 | lineDataset.setDrawCircles(false);
329 |
330 | //是否显示每个点的Y值
331 | lineDataset.setDrawValues(false);
332 |
333 | LineData lineData = new LineData(lineDataset);
334 | lineChart.setData(lineData);
335 | lineChart.animateX(1000);
336 | }
337 | }
338 |
339 |
340 | @Override
341 | public void onValueSelected(Entry e, Highlight h) {
342 |
343 | }
344 |
345 | @Override
346 | public void onNothingSelected() {
347 |
348 | }
349 | }
350 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/guo/linechartnotify/bean/ChartDayBean.java:
--------------------------------------------------------------------------------
1 | package com.example.guo.linechartnotify.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by ${GuoZhaoHui} on 2017/9/21.
7 | * email:guozhaohui628@gmail.com
8 | */
9 |
10 | public class ChartDayBean {
11 |
12 |
13 | /**
14 | * meta : {"success":true,"message":"ok"}
15 | * data : [{"saveTime":"2017-09-21 04:00:00.0","attribValue":0},{"saveTime":"2017-09-21 04:05:00.0","attribValue":0},{"saveTime":"2017-09-21 04:10:00.0","attribValue":0}]
16 | */
17 |
18 | private MetaBean meta;
19 | private List data;
20 |
21 | @Override
22 | public String toString() {
23 | return "ChartDayBean{" +
24 | "meta=" + meta +
25 | ", data=" + data +
26 | '}';
27 | }
28 |
29 | public MetaBean getMeta() {
30 | return meta;
31 | }
32 |
33 | public void setMeta(MetaBean meta) {
34 | this.meta = meta;
35 | }
36 |
37 | public List getData() {
38 | return data;
39 | }
40 |
41 | public void setData(List data) {
42 | this.data = data;
43 | }
44 |
45 | public static class MetaBean {
46 | /**
47 | * success : true
48 | * message : ok
49 | */
50 |
51 | private boolean success;
52 | private String message;
53 |
54 | @Override
55 | public String toString() {
56 | return "MetaBean{" +
57 | "success=" + success +
58 | ", message='" + message + '\'' +
59 | '}';
60 | }
61 |
62 | public boolean isSuccess() {
63 | return success;
64 | }
65 |
66 | public void setSuccess(boolean success) {
67 | this.success = success;
68 | }
69 |
70 | public String getMessage() {
71 | return message;
72 | }
73 |
74 | public void setMessage(String message) {
75 | this.message = message;
76 | }
77 | }
78 |
79 | public static class DataBean {
80 | /**
81 | * saveTime : 2017-09-21 04:00:00.0
82 | * attribValue : 0
83 | */
84 |
85 | private String saveTime;
86 | private int attribValue;
87 |
88 | @Override
89 | public String toString() {
90 | return "DataBean{" +
91 | "saveTime='" + saveTime + '\'' +
92 | ", attribValue=" + attribValue +
93 | '}';
94 | }
95 |
96 | public String getSaveTime() {
97 | return saveTime;
98 | }
99 |
100 | public void setSaveTime(String saveTime) {
101 | this.saveTime = saveTime;
102 | }
103 |
104 | public int getAttribValue() {
105 | return attribValue;
106 | }
107 |
108 | public void setAttribValue(int attribValue) {
109 | this.attribValue = attribValue;
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/guo/linechartnotify/utils/GetJsonDataUtil.java:
--------------------------------------------------------------------------------
1 | package com.example.guo.linechartnotify.utils;
2 |
3 | import android.content.Context;
4 | import android.content.res.AssetManager;
5 |
6 | import java.io.BufferedReader;
7 | import java.io.IOException;
8 | import java.io.InputStreamReader;
9 |
10 | /**
11 | * Created by ${GuoZhaoHui} on 2017/10/28.
12 | * Email:guozhaohui628@gmail.com
13 | */
14 |
15 | public class GetJsonDataUtil {
16 | public String getJson(Context context, String fileName) {
17 |
18 | StringBuilder stringBuilder = new StringBuilder();
19 | try {
20 | AssetManager assetManager = context.getAssets();
21 | BufferedReader bf = new BufferedReader(new InputStreamReader(
22 | assetManager.open(fileName)));
23 | String line;
24 | while ((line = bf.readLine()) != null) {
25 | stringBuilder.append(line);
26 | }
27 | } catch (IOException e) {
28 | e.printStackTrace();
29 | }
30 | return stringBuilder.toString();
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/guo/linechartnotify/utils/MyMarkerView.java:
--------------------------------------------------------------------------------
1 |
2 | package com.example.guo.linechartnotify.utils;
3 |
4 | import android.content.Context;
5 | import android.widget.TextView;
6 |
7 | import com.example.guo.linechartnotify.R;
8 | import com.github.mikephil.charting.components.MarkerView;
9 | import com.github.mikephil.charting.data.CandleEntry;
10 | import com.github.mikephil.charting.data.Entry;
11 | import com.github.mikephil.charting.highlight.Highlight;
12 | import com.github.mikephil.charting.utils.MPPointF;
13 | import com.github.mikephil.charting.utils.Utils;
14 |
15 | import java.util.List;
16 |
17 | /**
18 | * Custom implementation of the MarkerView.
19 | *
20 | * @author Philipp Jahoda
21 | */
22 | public class MyMarkerView extends MarkerView {
23 |
24 | private TextView tvContent,tv_marker_time;
25 | private List mXList;
26 |
27 | public MyMarkerView(Context context, int layoutResource, List xData) {
28 |
29 | super(context, layoutResource);
30 | tvContent = (TextView) findViewById(R.id.tvContent);
31 | tv_marker_time = (TextView) findViewById(R.id.tv_marker_time);
32 | mXList = xData;
33 | }
34 |
35 | // callbacks everytime the MarkerView is redrawn, can be used to update the
36 | // content (user-interface)
37 | @Override
38 | public void refreshContent(Entry e, Highlight highlight) {
39 |
40 | if (e instanceof CandleEntry) {
41 |
42 | CandleEntry ce = (CandleEntry) e;
43 |
44 | tvContent.setText(Utils.formatNumber(ce.getHigh(), 0, true));
45 |
46 | } else {
47 | //这里
48 | tvContent.setText( Utils.formatNumber(e.getY(), 0, true));
49 |
50 | String time = mXList.get((int)e.getX());
51 | tv_marker_time.setText(time);
52 |
53 | }
54 |
55 | super.refreshContent(e, highlight);
56 | }
57 |
58 | @Override
59 | public MPPointF getOffset() {
60 | return new MPPointF(-(getWidth() / 2), -getHeight());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_line_chart.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_oval.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bgl_marker.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
27 |
28 |
34 |
35 |
41 |
42 |
43 |
44 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom_marker_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
15 |
16 |
22 |
23 |
34 |
35 |
36 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #1a5cc0
7 | #59000000
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LineChartNotify
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | maven { url "https://jitpack.io" }
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/chart1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/chart1.gif
--------------------------------------------------------------------------------
/chart2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/chart2.gif
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GuoZhaoHui628/LineChartNotify/8cbc259a7830a56476b94c683c1b7eaf0bdd01bc/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Oct 28 15:38:57 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------