From b05dd42f29fb9d7721f9dba5a195a21ebd0fb2b4 Mon Sep 17 00:00:00 2001 From: yu_xh <940151214@qq.com> Date: Fri, 12 Nov 2021 16:21:32 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=93=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8CY=E8=BD=B4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/jjoe64/graphview/GridLabelRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java b/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java index da460dc..be58e2b 100644 --- a/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java +++ b/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java @@ -1383,7 +1383,7 @@ public class GridLabelRenderer { float y = posY; - String label = mLabelFormatter.formatLabel(e.getValue().intValue(), false); + String label = mLabelFormatter.formatLabel(e.getValue(), false); LogUtil.error("yuxh--verticalLabel--->", label + "~~~" + e.getValue().intValue()); if (label == null) { label = ""; -- Gitee From 39bbaf90907bb19a0c45d5a727711bea6bc55560 Mon Sep 17 00:00:00 2001 From: yu_xh <940151214@qq.com> Date: Fri, 12 Nov 2021 16:45:06 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=A4=84=E7=90=86GridLabelRenderer?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95=20setTes?= =?UTF-8?q?tSize()=20=E5=8F=82=E6=95=B0=E4=B8=BA=E8=B4=9F=E5=80=BC?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=A8=8B=E5=BA=8F=E5=B4=A9=E6=BA=83=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/jjoe64/graphview/GridLabelRenderer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java b/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java index be58e2b..6e787f4 100644 --- a/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java +++ b/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java @@ -1548,7 +1548,11 @@ public class GridLabelRenderer { * and {@link #setHorizontalAxisTitleTextSize(float)} */ public void setTextSize(float textSize) { - mStyles.textSize = textSize; + if (textSize <= 0) { + mStyles.textSize = 20; + } else { + mStyles.textSize = textSize; + } reloadStyles(); } -- Gitee From 5b751ce792e39090377f8df43434ba74cf1cfae1 Mon Sep 17 00:00:00 2001 From: yu_xh <940151214@qq.com> Date: Fri, 12 Nov 2021 16:49:43 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=A4=84=E7=90=86CursorMode=E7=B1=BB?= =?UTF-8?q?=E7=9A=84=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95=20setTestSize()?= =?UTF-8?q?=20=E5=8F=82=E6=95=B0=E4=B8=BA=E8=B4=9F=E5=80=BC=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=A8=8B=E5=BA=8F=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/jjoe64/graphview/CursorMode.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/graphveiw/src/main/java/com/jjoe64/graphview/CursorMode.java b/graphveiw/src/main/java/com/jjoe64/graphview/CursorMode.java index cb8c250..9836632 100644 --- a/graphveiw/src/main/java/com/jjoe64/graphview/CursorMode.java +++ b/graphveiw/src/main/java/com/jjoe64/graphview/CursorMode.java @@ -94,10 +94,10 @@ public class CursorMode { } } - public void draw(Canvas canvas,int width,int height) { + public void draw(Canvas canvas, int width, int height) { if (mCursorVisible) { - canvas.drawLine(new Point(mPosX, 0), new Point(mPosX,height), mPaintLine); + canvas.drawLine(new Point(mPosX, 0), new Point(mPosX, height), mPaintLine); } // selection @@ -208,7 +208,11 @@ public class CursorMode { } public void setTextSize(float t) { - mStyles.textSize = t; + if (t <= 0) { + mStyles.textSize = 20; + } else { + mStyles.textSize = t; + } } public void setTextColor(int color) { -- Gitee From 4e2a525ef2aef4bf88d5a688b745399d2e06a136 Mon Sep 17 00:00:00 2001 From: yu_xh <940151214@qq.com> Date: Fri, 12 Nov 2021 16:58:27 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=A4=84=E7=90=86GridLabelRenderer?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95=E5=9E=82?= =?UTF-8?q?=E7=9B=B4=E8=AE=BE=E7=BD=AE=E6=A0=87=E9=A2=98=E6=96=87=E5=AD=97?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=20setTestSize()=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=B8=BA=E8=B4=9F=E5=80=BC=E5=AF=BC=E8=87=B4=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/jjoe64/graphview/GridLabelRenderer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java b/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java index 6e787f4..af83813 100644 --- a/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java +++ b/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java @@ -1697,7 +1697,12 @@ public class GridLabelRenderer { * @param verticalAxisTitleTextSize font size of the vertical axis title */ public void setVerticalAxisTitleTextSize(float verticalAxisTitleTextSize) { - mStyles.verticalAxisTitleTextSize = verticalAxisTitleTextSize; + if (verticalAxisTitleTextSize <= 0) { + mStyles.verticalAxisTitleTextSize = 20; + } else { + mStyles.verticalAxisTitleTextSize = verticalAxisTitleTextSize; + } + } /** -- Gitee From 3dc40c30bda86d85d11a19b1b33b03e302e50ca1 Mon Sep 17 00:00:00 2001 From: yu_xh <940151214@qq.com> Date: Mon, 15 Nov 2021 16:40:20 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E8=A7=A3=E5=86=B3GraphViewXML=E5=86=85Ille?= =?UTF-8?q?galArgumentException=E6=97=A0=E6=B3=95=E6=8D=95=E8=8E=B7?= =?UTF-8?q?=E5=B9=B6=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jjoe64/graphview/helper/GraphViewXML.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/graphveiw/src/main/java/com/jjoe64/graphview/helper/GraphViewXML.java b/graphveiw/src/main/java/com/jjoe64/graphview/helper/GraphViewXML.java index 5c703b1..7e12bb6 100644 --- a/graphveiw/src/main/java/com/jjoe64/graphview/helper/GraphViewXML.java +++ b/graphveiw/src/main/java/com/jjoe64/graphview/helper/GraphViewXML.java @@ -22,6 +22,8 @@ import com.jjoe64.graphview.utils.LogUtil; import ohos.agp.components.AttrSet; import ohos.agp.utils.Color; import ohos.app.Context; +import ohos.eventhandler.EventHandler; +import ohos.eventhandler.EventRunner; import static com.jjoe64.graphview.utils.AttrSetString.*; @@ -80,9 +82,9 @@ public class GraphViewXML extends GraphView { // decode data - DataPoint[] data; + DataPoint[] data = new DataPoint[0]; if (dataStr == null || dataStr.isEmpty()) { - throw new IllegalArgumentException("Attribute seriesData is required in the format: 0=5.0;1=5;2=4;3=9"); + throwSleepTime("Attribute seriesData is required in the format: 0=5.0;1=5;2=4;3=9"); } else { String[] d = dataStr.split(";"); try { @@ -96,13 +98,12 @@ public class GraphViewXML extends GraphView { LogUtil.info(TAG, Double.parseDouble(xy[0]) + "~~~" + Double.parseDouble(xy[1])); } } catch (Exception e) { - LogUtil.error("GraphViewXML", e.toString()); - throw new IllegalArgumentException("Attribute seriesData is broken. Use this format: 0=5.0;1=5;2=4;3=9"); + throwSleepTime("Attribute seriesData is broken. Use this format: 0=5.0;1=5;2=4;3=9"); } } // create series - BaseSeries series; + BaseSeries series = null; if (type == null || type.isEmpty()) { type = "line"; } @@ -113,8 +114,7 @@ public class GraphViewXML extends GraphView { } else if (type.equals("points")) { series = new PointsGraphSeries(data); } else { - LogUtil.error("unknown graph type: " + type , ". Possible is line|bar|points"); - throw new IllegalArgumentException("unknown graph type: " + type + ". Possible is line|bar|points"); + throwSleepTime("unknown graph type: " + type + ". Possible is line|bar|points"); } if (color.getValue() != 0) { series.setColor(color.getValue()); @@ -130,4 +130,14 @@ public class GraphViewXML extends GraphView { setTitle(title); } } + + private void throwSleepTime(String str){ + new EventHandler(EventRunner.create()).postTask(new Runnable() { + @Override + public void run() { + throw new IllegalArgumentException(str); + + } + },500); + } } -- Gitee From 6c55c15e283a3a2e3e3aee7df07e47864dfa93b2 Mon Sep 17 00:00:00 2001 From: yu_xh <940151214@qq.com> Date: Mon, 15 Nov 2021 17:05:09 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=A7=A3=E5=86=B3GraphViewXML=E5=86=85Ille?= =?UTF-8?q?galArgumentException=E6=97=A0=E6=B3=95=E6=8D=95=E8=8E=B7?= =?UTF-8?q?=E5=B9=B6=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 7293b23..18982cc 100644 --- a/changelog.md +++ b/changelog.md @@ -15,7 +15,7 @@ v1.1.0 5. Viewport --> public boolean setScrollable(boolean mIsScrollable); 6. Viewport --> public boolean isScalable(); 7. Viewport --> public boolean setScalable(boolean mIsScalable); -8. Viewport --> public boolean scalableTOEnd(); +8. Viewport --> public void scrollToEnd(); 9. Viewport --> public OnXAxisBoundsChangedListener getOnXAxisBoundsChangedListener (); 10. Viewport --> public void setOnXAxisBoundListener(OnXAxisBoundsChangedListener l); 11. Viewport --> public void setScrollableY(boolean scrollableY); -- Gitee From fc6b23c4e83794c3363fe4096619abf8c230bcfa Mon Sep 17 00:00:00 2001 From: yu_xh <940151214@qq.com> Date: Tue, 16 Nov 2021 10:05:12 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E6=9B=B4=E6=96=B0changeLog=20=E5=92=8C=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96README.md=E5=86=85=E5=AE=89=E8=A3=85=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 101 +++++++++++++++++++++++++++------------------------ changelog.md | 9 +++-- 2 files changed, 59 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index ba98ad2..e2a9199 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,35 @@ -# GraphView_openharmony +# GraphView_openharmony + ### 折线图/圆点图/柱状图 ![image](image/demo1.gif) -## 集成配置 +## 安装说明 -``` -方式一: -1.将graphView-library.har放到相应module的libs目录下 -2.如果已经有implementation fileTree(dir: 'libs', include: ['.jar']),则修改为implementation fileTree(dir: 'libs', include: ['.jar','.har']) - 如果没有,直接添加依赖 implementation fileTree(dir: 'libs', include: ['.jar','*.har']) 即可 -``` +Method 1:For using circularfillableloaders module in sample app ,add the +below dependency to generate hap/har,Modify entry/build.gradle as below: -``` -方式二: -allprojects{ - repositories{ - mavenCentral() + + dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + testCompile'junit:junit:4.12' + implementation project(':graphveiw') } -} -implementation 'io.openharmony.tpc.thirdlib:graphView-library:1.0.2' -``` +Method 2:For using circularfillableloaders in separate application using har file ,generate .har package through library and add the har file to the entry/libs folder.Modify entry/build.gradle as below: + + implementation fileTree(dir: 'libs', include: ['*.jar']) + +Method 3:For using circularfillableloaders in separate application using maven dependency,modify entry/build.gradle as below: + + dependencies { + implementation 'io.openharmony.tpc.thirdlib:graphView-library:1.0.2' + } -#### 一.GraphView介绍 + + +#### 一.GraphView 介绍 public void appendData(E dataPoint,boolean scrollToEnd,int maxDataPoints,boolean silent); @@ -26,10 +25,12 @@ v1.1.0 16. Viewport --> public double setMaxYAxisSize(double mMaxYAxisViewportSize); 16. Viewport --> public double setMinimalViewport(double minX,double maxX,double minY,double maxY); 17. StaticLabelsFormatter -- >StaticLabelsFormatter staticLabelsFormatter = new StaticLabelsFormatter(graphView_01,new String[] {"old", "new"},new String[] {"high", "low"}); + (当静态标签格式化程序传递2个不同的垂直标签时,它显示两次第一个标签,而不是显示两个集合标签。) 18. GraphView --> public class GraphView 内takeSnapshotAndShare() 19. LineGraphSeries--> public class LineGraphSeries 内 public void setDrawAsPath() 20. LineGraphSeries -->public class LineGraphSeries 内 public void setAnimated(boolean animated) 21. BarGraphSeries --> public class BarGraphSeries 内 public void setAnimated(boolean animated) 22. Viewport --> public class Viewport 内OverScroller / onScroll 23. LineGraphSeries --> public class LineGraphSeries 内 AccelerateInterpolator - \ No newline at end of file +24. 如果2个图形系列具有相同的系列标题,具有不同的系列颜色,则图例中仅显示第一个系列信息 +25. 如果Y轴使用最大值或字符串,如静态标签格式化程序的中心,标签将被削减 \ No newline at end of file -- Gitee From c0b8849d7526aa6e685ccf5a5b53a40265f176b0 Mon Sep 17 00:00:00 2001 From: yu_xh <940151214@qq.com> Date: Tue, 16 Nov 2021 15:44:11 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=9B=91=E5=90=AC=E6=97=A0=E6=95=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- graphveiw/src/main/java/com/jjoe64/graphview/Viewport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphveiw/src/main/java/com/jjoe64/graphview/Viewport.java b/graphveiw/src/main/java/com/jjoe64/graphview/Viewport.java index 4dcf918..a7fcd82 100644 --- a/graphveiw/src/main/java/com/jjoe64/graphview/Viewport.java +++ b/graphveiw/src/main/java/com/jjoe64/graphview/Viewport.java @@ -319,7 +319,7 @@ public class Viewport { * @return true if it was consumed */ public boolean onTouchEvent(TouchEvent event) { - boolean b = false; + boolean b = true; // b |= mGestureDetector.onTouchEvent(event); if (mGraphView.isCursorMode()) { if (event.getAction() == TouchEvent.PRIMARY_POINT_DOWN) { -- Gitee