Skip to content

Commit

Permalink
fixes wrong label overlap detection that prevented inverted x-axes (see
Browse files Browse the repository at this point in the history
  • Loading branch information
RalphSteinhagen committed Sep 22, 2020
1 parent 7f170d5 commit ec32ed0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,9 @@ private static boolean checkOverlappingLabels(final int start, final int stride,
} else {
labelHidden = true;
current.setVisible(!makeInvisible);
if (!makeInvisible == false) {
System.err.println("mark + " + current.getValue() + " - " + !makeInvisible);
}
}
}
return labelHidden;
Expand Down Expand Up @@ -1403,7 +1406,7 @@ private static boolean isTickLabelsOverlap(final Side side, final boolean isInve
final double m1End = m1.getPosition() + (m1Size / 2);
final double m2Start = m2.getPosition() - (m2Size / 2);
final double m2End = m2.getPosition() + (m2Size / 2);
return side.isVertical() && !isInverted ? (m1Start - m2End) <= gap : (m2Start - m1End) <= gap;
return side.isVertical() && !isInverted ? Math.abs(m1Start - m2End) <= gap : Math.abs(m2Start - m1End) <= gap;
}

protected static void drawAxisLabel(final GraphicsContext gc, final double x, final double y, final Text label) {
Expand Down
8 changes: 3 additions & 5 deletions chartfx-chart/src/main/java/de/gsi/chart/plugins/Zoomer.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,7 @@ public HBox getZoomInteractorBar() {

zoomOut.setOnAction(evt -> {
zoomOrigin();
for (final Axis axis : getChart().getAxes()) {
axis.setAutoRanging(true);
}
getChart().getAxes().forEach(axis -> axis.setAutoRanging(true));
});
zoomModeXY.setOnAction(evt -> setAxisMode(AxisMode.XY));
zoomModeX.setOnAction(evt -> setAxisMode(AxisMode.X));
Expand Down Expand Up @@ -1198,8 +1196,8 @@ public class ZoomState {

private ZoomState(final double zoomRangeMin, final double zoomRangeMax, final boolean isAutoRanging,
final boolean isAutoGrowRanging) {
this.zoomRangeMin = zoomRangeMin;
this.zoomRangeMax = zoomRangeMax;
this.zoomRangeMin = Math.min(zoomRangeMin, zoomRangeMax);
this.zoomRangeMax = Math.max(zoomRangeMin, zoomRangeMax);
this.wasAutoRanging = isAutoRanging;
this.wasAutoGrowRanging = isAutoGrowRanging;
}
Expand Down

0 comments on commit ec32ed0

Please sign in to comment.