Skip to content

Commit

Permalink
Fixing showGuideline logic
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnil1104 committed Apr 3, 2020
1 parent 7a1d174 commit d5190e8
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
Expand Down

0 comments on commit d5190e8

Please sign in to comment.