Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 1653:73794985a899
Enable auto-scaling axis for waterlevels in WDifference-plots.
flys-artifacts/trunk@2845 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 27 Sep 2011 14:37:18 +0000 |
parents | 3067e700fc13 |
children | f1af0c07a6ee |
comparison
equal
deleted
inserted
replaced
1652:46a2a5dc98b7 | 1653:73794985a899 |
---|---|
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 | 178 |
179 /** | 179 /** |
180 * This method overrides the XYChartGenerators zoomY method to include the 0 | 180 * Create a range that includes 0 (for the Q axis). |
181 * value on the Q axis. | 181 * @param range range with which to look up upper bound. |
182 * @return range with 0 included. | |
183 */ | |
184 protected Range createSecondAxisRange(Range range) { | |
185 return new Range(0d, range.getUpperBound()); | |
186 } | |
187 | |
188 | |
189 /** | |
190 * This method overrides the XYChartGenerators zoomY method to be able to | |
191 * modify the range of the Q axis (here, it shall include 0). | |
182 */ | 192 */ |
183 @Override | 193 @Override |
184 protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) { | 194 protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) { |
185 if (plot.getRangeAxisIndex(axis) == 1) { | 195 if (plot.getRangeAxisIndex(axis) == 1) { |
186 // we want the Q axis to start at 0 if no zooming has been done | 196 // We want the Q axis to start at 0 if no zooming has been done. |
187 range = new Range(0d, range.getUpperBound()); | 197 range = createSecondAxisRange(range); |
188 } | 198 } |
189 | 199 |
190 return super.zoomY(plot, axis, range, x); | 200 return super.zoomY(plot, axis, range, x); |
191 } | 201 } |
192 | 202 |