comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 720:d60cc6453d45

#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
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 22 Jun 2011 06:51:36 +0000
parents 035c0095b427
children 56d70e546800
comparison
equal deleted inserted replaced
719:035c0095b427 720:d60cc6453d45
8 import org.jfree.chart.axis.NumberAxis; 8 import org.jfree.chart.axis.NumberAxis;
9 import org.jfree.chart.axis.ValueAxis; 9 import org.jfree.chart.axis.ValueAxis;
10 import org.jfree.chart.plot.XYPlot; 10 import org.jfree.chart.plot.XYPlot;
11 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; 11 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
12 import org.jfree.chart.title.TextTitle; 12 import org.jfree.chart.title.TextTitle;
13 import org.jfree.data.Range;
13 import org.jfree.data.xy.XYSeries; 14 import org.jfree.data.xy.XYSeries;
14 import org.jfree.data.xy.XYSeriesCollection; 15 import org.jfree.data.xy.XYSeriesCollection;
15 16
16 import org.w3c.dom.Document; 17 import org.w3c.dom.Document;
17 18
157 invertXAxis(plot.getDomainAxis()); 158 invertXAxis(plot.getDomainAxis());
158 } 159 }
159 160
160 161
161 /** 162 /**
163 * This method overrides the XYChartGenerators zoomY method to include the 0
164 * value on the Q axis.
165 */
166 @Override
167 protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) {
168 boolean zoomin = super.zoomY(plot, axis, range, x);
169
170 // we want the Q axis to start at 0 if no zooming has been done
171 if (!zoomin && plot.getRangeAxisIndex(axis) == 1) {
172 axis.setLowerBound(0d);
173 }
174
175 return zoomin;
176 }
177
178
179 /**
162 * This method inverts the x-axis based on the kilometer information of the 180 * This method inverts the x-axis based on the kilometer information of the
163 * selected river. If the head of the river is at kilometer 0, the axis is 181 * selected river. If the head of the river is at kilometer 0, the axis is
164 * not inverted, otherwise it is. 182 * not inverted, otherwise it is.
165 * 183 *
166 * @param xaxis The domain axis. 184 * @param xaxis The domain axis.

http://dive4elements.wald.intevation.org