Skip to content

Commit d1f8ef5

Browse files
committed
fix bug in chart drawing wrong vertical lines for clipped polygons (introduced with clipping of polygons in issue #48)
1 parent 2095776 commit d1f8ef5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/com/tagtraum/perf/gcviewer/renderer/PolygonChartRenderer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,15 @@ private Polygon initClippedPolygon(Polygon polygon, Shape clip) {
107107
insertionPoint.getDistance() + 1);
108108

109109
xpoints[0] = xpoints[1]-1;
110-
ypoints[0] = (int) Math.ceil(clip.getBounds2D().getMaxY());
110+
if (drawPolygon) {
111+
// for polygons the last point needs to be in the bottom of the chart
112+
// (otherwise filling will not be correct)...
113+
ypoints[0] = (int) Math.ceil(clip.getBounds2D().getMaxY());
114+
}
115+
else {
116+
// ...for lines it must not (otherwise vertical lines will appear where they shouldn't)
117+
ypoints[0] = ypoints[1];
118+
}
111119

112120
clippedPolygon.xpoints = xpoints;
113121
clippedPolygon.ypoints = ypoints;

0 commit comments

Comments
 (0)