# HG changeset patch # User Ingo Weinzierl # Date 1308725496 0 # Node ID d60cc6453d453ce953303c614e22bd9fa6aff628 # Parent 035c0095b427685c6621c8d2613acfd3fa537476 #161 Include the 0 on the second y axis (the Q axis) in longitudinal section charts intially. flys-artifacts/trunk@2194 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 035c0095b427 -r d60cc6453d45 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Jun 21 21:41:49 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Jun 22 06:51:36 2011 +0000 @@ -1,3 +1,12 @@ +2011-06-22 Ingo Weinzierl + + flys/issue161 (Diagramm: Q-Achse in W-Längsschnitten immer bei Q=0) + + * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java: + The Q axis (which is the second y axis) initially contains the 0 value. + After a zoom action has taken place, this behaviour is no longer + supported. + 2011-06-21 Sascha L. Teichmann Draw correction curve again. diff -r 035c0095b427 -r d60cc6453d45 flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Tue Jun 21 21:41:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Wed Jun 22 06:51:36 2011 +0000 @@ -10,6 +10,7 @@ import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.chart.title.TextTitle; +import org.jfree.data.Range; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; @@ -159,6 +160,23 @@ /** + * This method overrides the XYChartGenerators zoomY method to include the 0 + * value on the Q axis. + */ + @Override + protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) { + boolean zoomin = super.zoomY(plot, axis, range, x); + + // we want the Q axis to start at 0 if no zooming has been done + if (!zoomin && plot.getRangeAxisIndex(axis) == 1) { + axis.setLowerBound(0d); + } + + return zoomin; + } + + + /** * This method inverts the x-axis based on the kilometer information of the * selected river. If the head of the river is at kilometer 0, the axis is * not inverted, otherwise it is.