From 3740f24ab404ba2953c0591aaebe0daef1644a10 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 24 Apr 2017 16:34:50 +0200 Subject: [PATCH] Closing path should be to zerovalue not to the bottom --- .../com/jjoe64/graphview/series/LineGraphSeries.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/jjoe64/graphview/series/LineGraphSeries.java b/src/main/java/com/jjoe64/graphview/series/LineGraphSeries.java index a7ba85941..c45152dba 100644 --- a/src/main/java/com/jjoe64/graphview/series/LineGraphSeries.java +++ b/src/main/java/com/jjoe64/graphview/series/LineGraphSeries.java @@ -488,13 +488,14 @@ public void draw(GraphView graphView, Canvas canvas, boolean isSecondScale) { } if (mStyles.drawBackground && firstX != -1) { + float zero = (float) (graphHeight + graphTop + minY / diffY * graphHeight); // end / close path - if (lastUsedEndY != graphHeight + graphTop) { + if (lastUsedEndY != zero) { // dont draw line to same point, otherwise the path is completely broken - mPathBackground.lineTo((float) lastUsedEndX, graphHeight + graphTop); + mPathBackground.lineTo((float) lastUsedEndX, zero); } - mPathBackground.lineTo(firstX, graphHeight + graphTop); - if (firstY != graphHeight + graphTop) { + mPathBackground.lineTo(firstX, zero); + if (firstY != zero) { // dont draw line to same point, otherwise the path is completely broken mPathBackground.lineTo(firstX, firstY); }