diff --git a/graphview/src/main/java/com/broooapps/graphview/CurveGraphView.java b/graphview/src/main/java/com/broooapps/graphview/CurveGraphView.java index bfdc9be..5c85291 100644 --- a/graphview/src/main/java/com/broooapps/graphview/CurveGraphView.java +++ b/graphview/src/main/java/com/broooapps/graphview/CurveGraphView.java @@ -251,7 +251,7 @@ private void drawInterval(Canvas canvas) { } private void drawGuideline(Canvas canvas) { - if (guidelineCount == 0 || graphDataArray.length == 0) return; + if (drawGuideline()) return; for (int i = 1; i <= guidelineCount; i++) { path.reset(); @@ -263,6 +263,19 @@ private void drawGuideline(Canvas canvas) { } } + private boolean drawGuideline() { + return guidelineCount == 0 || graphDataArray.length == 0 || noDataInGraph(); + } + + private boolean noDataInGraph() { + for (int i = 0; i < graphDataArray.length; i++) { + GraphData gd = graphDataArray[i]; + if (gd.getGraphDataPoints().getPointMap().isEmpty()) continue; + return false; + } + return true; + } + private void startGradientAnimation() { valueAnimator = new ValueAnimator(); PropertyValuesHolder alphaFactor = PropertyValuesHolder.ofInt("PROPERTY_ALPHA", 0, 255);