Skip to content

Commit 414ba10

Browse files
authored
Merge pull request #628 from Deliner/patch-1
fix #569 bar graph out of viewport on scroll
2 parents 9741bfb + f0a8aad commit 414ba10

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/jjoe64/graphview/series/BarGraphSeries.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,11 @@ public void draw(GraphView graphView, Canvas canvas, boolean isSecondScale) {
279279
}
280280

281281
double left = x + contentLeft - offset + spacing/2 + currentSeriesOrder*barWidth;
282-
double top = (contentTop - y) + contentHeight;
283282
double right = left + barWidth;
283+
if (left > contentLeft + contentWidth || right < contentLeft) {
284+
continue;
285+
}
286+
double top = (contentTop - y) + contentHeight;
284287
double bottom = (contentTop - y0) + contentHeight - (graphView.getGridLabelRenderer().isHighlightZeroLines()?4:1);
285288

286289
boolean reverse = top > bottom;

0 commit comments

Comments
 (0)