Skip to content

Commit

Permalink
Fix for bug #8 (exception when zooming with LogAxis).
Browse files Browse the repository at this point in the history
  • Loading branch information
jfree committed Jun 8, 2018
1 parent 05b5399 commit 200d6db
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<artifactId>jfreechart-fx</artifactId>
<groupId>org.jfree</groupId>
<version>1.0.1</version>
<version>1.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<organization>
Expand Down
38 changes: 19 additions & 19 deletions src/main/java/org/jfree/chart/fx/interaction/ZoomHandlerFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* JFreeChart-FX : JavaFX extensions for JFreeChart
* ================================================
*
* (C) Copyright 2017, by Object Refinery Limited and Contributors.
* (C) Copyright 2017, 2018, by Object Refinery Limited and Contributors.
*
* Project Info: https://github.com/jfree/jfreechart-fx
*
Expand All @@ -27,7 +27,7 @@
* ------------------
* ZoomHandlerFX.java
* ------------------
* (C) Copyright 2014, 2017, by Object Refinery Limited and Contributors.
* (C) Copyright 2014-2018, by Object Refinery Limited and Contributors.
*
* Original Author: David Gilbert (for Object Refinery Limited);
* Contributor(s): -;
Expand Down Expand Up @@ -221,24 +221,24 @@ else if (!hZoom) {
h = Math.min(h, maxY - this.startPoint.getY());
}
Rectangle2D zoomArea = new Rectangle2D.Double(x, y, w, h);

boolean saved = p.isNotify();
p.setNotify(false);
double pw0 = percentW(x, dataArea);
double pw1 = percentW(x + w, dataArea);
double ph0 = percentH(y, dataArea);
double ph1 = percentH(y + h, dataArea);
PlotRenderingInfo info
= this.viewer.getRenderingInfo().getPlotInfo();
if (z.getOrientation().isVertical()) {
z.zoomDomainAxes(pw0, pw1, info, endPoint);
z.zoomRangeAxes(1 - ph1, 1 - ph0, info, endPoint);
} else {
z.zoomRangeAxes(pw0, pw1, info, endPoint);
z.zoomDomainAxes(1 - ph1, 1 - ph0, info, endPoint);
if (!zoomArea.isEmpty()) {
boolean saved = p.isNotify();
p.setNotify(false);
double pw0 = percentW(x, dataArea);
double pw1 = percentW(x + w, dataArea);
double ph0 = percentH(y, dataArea);
double ph1 = percentH(y + h, dataArea);
PlotRenderingInfo info
= this.viewer.getRenderingInfo().getPlotInfo();
if (z.getOrientation().isVertical()) {
z.zoomDomainAxes(pw0, pw1, info, endPoint);
z.zoomRangeAxes(1 - ph1, 1 - ph0, info, endPoint);
} else {
z.zoomRangeAxes(pw0, pw1, info, endPoint);
z.zoomDomainAxes(1 - ph1, 1 - ph0, info, endPoint);
}
p.setNotify(saved);
}
p.setNotify(saved);

}
}
this.viewer.hideZoomRectangle();
Expand Down

0 comments on commit 200d6db

Please sign in to comment.