listY) {
269 | if (canvas == null || listX == null || listX.size() == 0 || listY == null || listY.size() == 0)
270 | return;
271 | Paint paint = new Paint();
272 | paint.setColor(xyAxisLineColor);// //表格线颜色
273 | paint.setStrokeWidth(xyAxisLineStrokeWidth);
274 |
275 | if (isDrawX) {//是否绘制X轴
276 | int appendX = 0;
277 | if (isAppendX) {
278 | appendX = appendXLength;
279 | }
280 | if (isDrawXDashed) {
281 | paintDashed(canvas, paddingLeft - appendX, paddingTop + listY.get(0).y, listY.get(0).x
282 | + paddingLeft,
283 | paddingTop + listY.get(0).y, xyAxisLineColor);
284 | } else
285 | canvas.drawLine(paddingLeft - appendX, paddingTop + listY.get(0).y, listY.get(0).x
286 | + paddingLeft,
287 | paddingTop + listY.get(0).y, paint);
288 | }
289 | if (isDrawY) {//是否绘制Y轴
290 | if (isDrawYDashed) {
291 | paintDashed(canvas, listX.get(0).x, paddingTop, listX.get(0).x, listX.get(0).y + paddingTop, xyAxisLineColor);
292 | } else
293 | canvas.drawLine(listX.get(0).x, paddingTop, listX.get(0).x, listX.get(0).y + paddingTop, paint);
294 | }
295 |
296 | if (isDrawInsedeY) {// 是否绘制内部的Y轴
297 | for (int i = 0; i < listX.size(); i++) {// 第一根内部 y轴线 和 Y轴线 重叠,故绘制Y轴的时候 不绘制第一条线
298 | if (isDrawY && i == 0) continue;
299 | Point point = listX.get(i);
300 | if (isDrawInsideDashedY) {
301 | paintDashed(canvas, point.x, paddingTop, point.x, point.y + paddingTop, xyAxisLineColor);
302 | } else {
303 | canvas.drawLine(point.x, paddingTop, point.x, point.y + paddingTop, paint);
304 | }
305 |
306 | }
307 | }
308 | if (isDrawInsideX) {// 是否绘制内部的X轴
309 |
310 | int appendX = 0;
311 | if (isAppendX) {
312 | appendX = appendXLength;
313 | }
314 | for (int i = (isDrawX ? 1 : 0); i < listY.size(); i++) {// 第一根内部 x轴线 和 X轴线 重叠,故绘制X轴的时候 不绘制第一条线
315 | Point point = listY.get(i);
316 | if (isDrawInsideDashedX) {
317 | paintDashed(canvas, paddingLeft - appendX, paddingTop + point.y, point.x + paddingLeft,
318 | paddingTop + point.y, xyAxisLineColor);
319 | } else {
320 | canvas.drawLine(paddingLeft - appendX, paddingTop + point.y, point.x + paddingLeft,
321 | paddingTop + point.y, paint);
322 | }
323 |
324 | }
325 |
326 | }
327 |
328 | // 选中的 内部Y轴 position, (selectedPositionInsideY >=0 && < numberOfX &&绘制内部的Y轴完成) 才会绘制出来
329 | paint.setColor(selectedPositionInsideYLineColor);// //表格线颜色
330 | paint.setStrokeWidth(selectedPositionInsideYStrokeWidth);
331 | if (selectedPositionInsideY >= 0 && selectedPositionInsideY < listX.size()) {
332 | Point point = listX.get(selectedPositionInsideY);
333 | canvas.drawLine(point.x, paddingTop, point.x, point.y + paddingTop, paint);
334 | }
335 |
336 | }
337 |
338 | /**
339 | * 为X轴每个标题
340 | *
341 | * canvas.drawText(text, x, y, paint),第一个参数是我们需要绘制的文本,第四个参数是我们的画笔,
342 | * 这两个不用多说,主要是第二和第三个参数的含义,这两个参数在不同的情况下的值还是不一样的,
343 | * x默认是这个字符串的左边在屏幕的位置,如果设置了paint.setTextAlign(Paint.Align.CENTER);那就是字符的中心,
344 | * y是指定这个字符baseline在屏幕上的位置,大家记住了,不要混淆,y不是这个字符中心在屏幕上的位置,而是baseline在屏幕上的位置。
345 | */
346 | private void setXTitle(List listX, Canvas canvas) {
347 | Paint paint = new Paint();
348 | paint.setColor(textColor);
349 | paint.setTextSize(textSize);
350 |
351 | if (titleXList == null) {
352 | titleXList = new ArrayList();
353 | for (int i = 1; i <= numberOfX; i++) {
354 | titleXList.add("title" + i);
355 | }
356 | }
357 | for (int i = 0; i < numberOfX && i < titleXList.size(); i++) {
358 | canvas.save();
359 | String xTitle = titleXList.get(i);
360 | if (xTitle != null) {
361 | int titleHeight = CommonUtils.getTextHeight(xTitle, paint);
362 | int finalX = listX.get(i).x;
363 | if (i != 0)
364 | finalX = finalX - CommonUtils.getTextWidth(xTitle, paint) / 2;
365 | canvas.rotate(titleXRotateDegrees, finalX,
366 | listX.get(i).y + paddingTop + xTitlePaddingXAxis + titleHeight);
367 | canvas.drawText(titleXList.get(i), finalX,
368 | listX.get(i).y + paddingTop + xTitlePaddingXAxis + titleHeight
369 | , paint);
370 | canvas.restore();
371 | }
372 | }
373 | }
374 |
375 | //为Y轴找到最大值以及它的每个标题
376 | private void setYTitle(List listY, Canvas canvas) {
377 | Paint paint = new Paint();
378 | paint.setColor(textColor);
379 | paint.setTextSize(textSize);
380 | if (pointList == null) {
381 | titleYList = new ArrayList();
382 | for (int i = 1; i <= numberOfY; i++) {
383 | titleYList.add(0, String.valueOf(100 / i));
384 | }
385 | } else {
386 | for (int i = 0; i < pointList.size(); i++) {
387 | for (int j = 0; j < pointList.get(i).size(); j++) {
388 |
389 | if (pointList.get(i).get(j) > maxNumber) {
390 | maxNumber = pointList.get(i).get(j);
391 | }
392 | }
393 | }
394 | maxNumber = maxNumber + maxNumber / 3;
395 | titleYList = new ArrayList();
396 | for (int i = 0; i < numberOfY; i++) {
397 | titleYList.add(String.valueOf((int) (0 + i * (maxNumber / (numberOfY - 1)))));
398 | }
399 | }
400 |
401 | int finalAppendX = (isAppendX && appendXLength > 0) ? appendXLength : 0;
402 | finalAppendX = finalAppendX + yTitle2RightPadding;
403 |
404 | for (int i = 0; i < numberOfY; i++) {
405 | String title = titleYList.get(i);
406 | if (!TextUtils.isEmpty(title)) {
407 | if (i == 0)
408 | title = title + yAxisUnit;
409 | Rect bounds = new Rect();
410 | paint.getTextBounds(title, 0, title.length(), bounds);
411 | canvas.drawText(titleYList.get(i), paddingLeft - finalAppendX - CommonUtils.getTextWidth(title, paint),
412 | paddingTop
413 | + listY.get(i).y + CommonUtils.getTextHeight(title, paint) / 2, paint);
414 |
415 | }
416 |
417 | }
418 | }
419 |
420 |
421 | // 填充折线和边框
422 | private void drawFill(Canvas canvas, List> positionList) {
423 | if (!isFillDown || positionList == null) {
424 | return;
425 | }
426 | Paint paint = new Paint();
427 | paint.setAntiAlias(true);
428 | paint.setColor(fillDownColor);
429 | paint.setAlpha(50);
430 | for (int i = 0; i < positionList.size(); i++) {
431 | Path path = new Path();
432 | path.moveTo(paddingLeft, ScreenY - paddingBottom);
433 | int size = positionList.get(i).size();
434 | for (int j = 0; j < size; j++) {
435 | path.lineTo(positionList.get(i).get(j).x, positionList.get(i).get(j).y);
436 | }
437 | if (size > 0)
438 | path.lineTo(positionList.get(i).get(size - 1).x, ScreenY - paddingBottom);
439 | path.close();
440 | canvas.drawPath(path, paint);
441 | }
442 | }
443 |
444 | // 画折线
445 | private void drawLineChart(Canvas canvas, List> positionList) {
446 | if (positionList == null) return;
447 | Paint paint = new Paint();
448 | paint.setAntiAlias(true);
449 | paint.setStrokeWidth(lineChartStrokeWidth);
450 |
451 | for (int i = 0; i < positionList.size(); i++) {
452 | if (lineColorList != null && lineColorList.size() - 1 >= i && lineColorList.get(i) != null) {
453 | paint.setColor(lineColorList.get(i));
454 | } else {
455 | paint.setColor(lineColorNotSet);
456 | }
457 | for (int j = 0; j < positionList.get(i).size() - 1; j++) {
458 | canvas.drawLine(positionList.get(i).get(j).x, positionList.get(i).get(j).y,
459 | positionList.get(i).get(j + 1).x, positionList.get(i).get(j + 1).y, paint);
460 | }
461 | }
462 | }
463 |
464 | // 画点
465 | private void drawCicle(Canvas canvas, List> positionList) {
466 | if (positionList == null) return;
467 | Paint paint = new Paint();
468 | paint.setAntiAlias(true);//设置画笔为无锯齿
469 | paint.setColor(circleDotBitmapNotSet);//设置画笔颜色
470 | for (int i = 0; i < positionList.size(); i++) {
471 | Bitmap bitmap = null;
472 | if (circleDotBitmapList != null && circleDotBitmapList.size() - 1 >= i && circleDotBitmapList.get(i) != null) {
473 | int resouceId = circleDotBitmapList.get(i);
474 | bitmap = BitmapFactory.decodeResource(getResources(), resouceId);
475 | }
476 |
477 | for (int j = 0; j < positionList.get(i).size(); j++) {
478 | if (bitmap != null) {
479 | canvas.drawBitmap(bitmap, positionList.get(i).get(j).x + 0.5f - bitmap.getWidth()
480 | / 2,
481 | positionList.get(i).get(j).y + 0.5f - bitmap.getHeight() / 2, paint);
482 | } else {
483 | canvas.drawCircle(positionList.get(i).get(j).x, positionList.get(i).get(j).y,
484 | circleDotRadius, paint);
485 | }
486 | }
487 |
488 | }
489 | }
490 |
491 | // 计算出X轴平均后的坐标
492 | private List initNumberOfX() {
493 | int num = (ScreenX - paddingLeft - paddingRight) / (numberOfX - 1);
494 | List list = new ArrayList();
495 | for (int i = 0; i < numberOfX; i++) {
496 | Point point = new Point();
497 | point.y = ScreenY - paddingBottom - paddingTop;
498 | point.x = paddingLeft + num * i;
499 | list.add(point);
500 | }
501 | return list;
502 | }
503 |
504 | // 计算出Y轴平均后的坐标
505 | private List initNumberOfY() {
506 | int num = (ScreenY - paddingBottom - paddingTop) / (numberOfY - 1);
507 | List list = new ArrayList();
508 | for (int i = 0; i < numberOfY; i++) {
509 | Point point = new Point();
510 | point.x = ScreenX - paddingLeft - paddingRight;
511 | point.y = ScreenY - paddingBottom - paddingTop - num * i;
512 | list.add(point);
513 | }
514 | return list;
515 | }
516 |
517 | /**
518 | * 画虚线
519 | *
520 | * @param canvas
521 | * @param moveToX
522 | * @param moveToY
523 | * @param lineToX
524 | * @param lineToY
525 | */
526 | private void paintDashed(Canvas canvas, int moveToX, int moveToY, int lineToX, int lineToY, int color) {
527 | DashPathEffect pathEffect = new DashPathEffect(new float[]{6, 4}, 0);
528 | Paint paint = new Paint();
529 | paint.reset();
530 | paint.setStyle(Paint.Style.STROKE);
531 | paint.setStrokeWidth(xyAxisLineStrokeWidth);
532 | paint.setColor(color);
533 | paint.setAntiAlias(true);
534 | paint.setPathEffect(pathEffect);
535 | Path path = new Path();
536 | path.moveTo(moveToX, moveToY);
537 | path.lineTo(lineToX, lineToY);
538 | canvas.drawPath(path, paint);
539 | }
540 |
541 | public void setTextSize(float textSize) {
542 | this.textSize = textSize;
543 | }
544 |
545 | public void setTextColor(int textColor) {
546 | this.textColor = textColor;
547 | }
548 |
549 | public void setNumberOfX(int numberOfX) {
550 | this.numberOfX = numberOfX;
551 | }
552 |
553 | public void setNumberOfY(int numberOfY) {
554 | this.numberOfY = numberOfY;
555 | }
556 |
557 | public void setPaddingTop(int paddingTop) {
558 | this.paddingTop = paddingTop;
559 | }
560 |
561 | public void setPaddingLeft(int paddingLeft) {
562 | this.paddingLeft = paddingLeft;
563 | }
564 |
565 | public void setPaddingRight(int paddingRight) {
566 | this.paddingRight = paddingRight;
567 | }
568 |
569 | public void setPaddingBottom(int paddingBottom) {
570 | this.paddingBottom = paddingBottom;
571 | }
572 |
573 | public void setyTitle2RightPadding(int yTitle2RightPadding) {
574 | this.yTitle2RightPadding = yTitle2RightPadding;
575 | }
576 |
577 | public void setAppendXLength(int appendXLength) {
578 | this.appendXLength = appendXLength;
579 | }
580 |
581 | public void setCircleDotRadius(int circleDotRadius) {
582 | this.circleDotRadius = circleDotRadius;
583 | }
584 |
585 | public void setTitleXRotateDegrees(int titleXRotateDegrees) {
586 | this.titleXRotateDegrees = titleXRotateDegrees;
587 | }
588 |
589 | public void setXyAxisLineStrokeWidth(float xyAxisLineStrokeWidth) {
590 | this.xyAxisLineStrokeWidth = xyAxisLineStrokeWidth;
591 | }
592 |
593 | public void setSelectedPositionInsideY(int selectedPositionInsideY) {
594 | this.selectedPositionInsideY = selectedPositionInsideY;
595 | }
596 |
597 | public void setSelectedPositionInsideYLineColor(int selectedPositionInsideYLineColor) {
598 | this.selectedPositionInsideYLineColor = selectedPositionInsideYLineColor;
599 | }
600 |
601 | public void setSelectedPositionInsideYStrokeWidth(float selectedPositionInsideYStrokeWidth) {
602 | this.selectedPositionInsideYStrokeWidth = selectedPositionInsideYStrokeWidth;
603 | }
604 |
605 | public void setCircleDotBitmapNotSet(int circleDotBitmapNotSet) {
606 | this.circleDotBitmapNotSet = circleDotBitmapNotSet;
607 | }
608 |
609 | public void setLineColorNotSet(int lineColorNotSet) {
610 | this.lineColorNotSet = lineColorNotSet;
611 | }
612 |
613 | public void setLineChartStrokeWidth(float lineChartStrokeWidth) {
614 | this.lineChartStrokeWidth = lineChartStrokeWidth;
615 | }
616 |
617 | public void setBgColor(int bgColor) {
618 | this.bgColor = bgColor;
619 | }
620 |
621 | public void setSingleColumnFillColor(int singleColumnFillColor) {
622 | this.singleColumnFillColor = singleColumnFillColor;
623 | }
624 |
625 | public void setDoubleColumnFillColor(int doubleColumnFillColor) {
626 | this.doubleColumnFillColor = doubleColumnFillColor;
627 | }
628 |
629 | public void setFillDownColor(int fillDownColor) {
630 | this.fillDownColor = fillDownColor;
631 | }
632 |
633 | public void setXyAxisLineColor(int xyAxisLineColor) {
634 | this.xyAxisLineColor = xyAxisLineColor;
635 | }
636 |
637 | public void setyAxisUnit(String yAxisUnit) {
638 | this.yAxisUnit = yAxisUnit;
639 | }
640 |
641 | public void setCircleDotBitmapList(List circleDotBitmapList) {
642 | this.circleDotBitmapList = circleDotBitmapList;
643 | }
644 |
645 | public void setLineColorList(List lineColorList) {
646 | this.lineColorList = lineColorList;
647 | }
648 |
649 | public void setTitleXList(List titleXList) {
650 | this.titleXList = titleXList;
651 | }
652 |
653 | public void setPointList(List> pointList) {
654 | this.pointList = pointList;
655 | }
656 |
657 | public void setDrawYDashed(boolean drawYDashed) {
658 | isDrawYDashed = drawYDashed;
659 | }
660 |
661 | public void setDrawY(boolean drawY) {
662 | isDrawY = drawY;
663 | }
664 |
665 | public void setDrawX(boolean drawX) {
666 | isDrawX = drawX;
667 | }
668 |
669 | public void setDrawXDashed(boolean drawXDashed) {
670 | isDrawXDashed = drawXDashed;
671 | }
672 |
673 | public void setDrawInsideDashedY(boolean drawInsideDashedY) {
674 | isDrawInsideDashedY = drawInsideDashedY;
675 | }
676 |
677 | public void setDrawInsedeY(boolean drawInsedeY) {
678 | isDrawInsedeY = drawInsedeY;
679 | }
680 |
681 | public void setDrawInsideX(boolean drawInsideX) {
682 | isDrawInsideX = drawInsideX;
683 | }
684 |
685 | public void setDrawInsideDashedX(boolean drawInsideDashedX) {
686 | isDrawInsideDashedX = drawInsideDashedX;
687 | }
688 |
689 | public void setColumnFillColor(boolean columnFillColor) {
690 | isColumnFillColor = columnFillColor;
691 | }
692 |
693 | public void setFillDown(boolean fillDown) {
694 | isFillDown = fillDown;
695 | }
696 |
697 | public void setAppendX(boolean appendX) {
698 | isAppendX = appendX;
699 | }
700 |
701 | public List> getPositionList() {
702 | return positionList;
703 | }
704 |
705 | public int getPaddingBottom() {
706 | return paddingBottom;
707 | }
708 |
709 | public int getPaddingTop() {
710 | return paddingTop;
711 | }
712 |
713 | public int getPaddingLeft() {
714 | return paddingLeft;
715 | }
716 |
717 | public int getPaddingRight() {
718 | return paddingRight;
719 | }
720 |
721 | public int getScreenX() {
722 | return ScreenX;
723 | }
724 |
725 | public int getScreenY() {
726 | return ScreenY;
727 | }
728 |
729 | public void setxTitlePaddingXAxis(int xTitlePaddingXAxis) {
730 | this.xTitlePaddingXAxis = xTitlePaddingXAxis;
731 | }
732 | }
733 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
35 |
36 |
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 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/icon_chart_dot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/app/src/main/res/mipmap-xxhdpi/icon_chart_dot.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attr.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 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ChartDemo
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/dzq/chartdemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.dzq.chartdemo;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/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.2.2'
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 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/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/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
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-2.14.1-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 |
--------------------------------------------------------------------------------
/img1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/img1.png
--------------------------------------------------------------------------------
/img2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/img2.png
--------------------------------------------------------------------------------
/img3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/img3.png
--------------------------------------------------------------------------------
/img4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dingzuoqiang/LineChartDemo/44f704f25fe67d29ef2f5a2f7353a1b860ea0c15/img4.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------