comparison gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java @ 1104:5207d09e4af6

Fixed range calculation for y-axes in the base chart class (issue233). gnv-artifacts/trunk@1234 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 28 Jun 2010 16:48:03 +0000
parents 22c18083225e
children f953c9a559d8
comparison
equal deleted inserted replaced
1103:faae3fc7b792 1104:5207d09e4af6
205 localizeRangeAxis(yAxis, locale); 205 localizeRangeAxis(yAxis, locale);
206 206
207 // litte workarround to adjust the max range of axes. 207 // litte workarround to adjust the max range of axes.
208 // NumberAxis.setAutoRange(true) doesn't seem to work properly. 208 // NumberAxis.setAutoRange(true) doesn't seem to work properly.
209 Range yRange = (Range) ranges.get(seriesKey); 209 Range yRange = (Range) ranges.get(seriesKey);
210 yAxis.setRange(Range.expand(yRange, LOWER_MARGIN, UPPER_MARGIN)); 210 double lo = yRange.getLowerBound();
211 double hi = yRange.getUpperBound();
212
213 if (lo == hi) {
214 yRange = new Range(
215 lo - (lo / 100 * LOWER_MARGIN),
216 hi + (hi / 100 * UPPER_MARGIN));
217 }
218 else {
219 yRange = Range.expand(yRange, LOWER_MARGIN, UPPER_MARGIN);
220 }
221 yAxis.setRange(yRange);
211 log.debug("Max Range of dataset is: " + yRange.toString()); 222 log.debug("Max Range of dataset is: " + yRange.toString());
212 223
213 if (seriesKey.contains("richtung")) { 224 if (seriesKey.contains("richtung")) {
214 yAxis.setTickUnit(new NumberTickUnit(30.0)); 225 yAxis.setTickUnit(new NumberTickUnit(30.0));
215 yAxis.setUpperBound(360.0); 226 yAxis.setUpperBound(360.0);

http://dive4elements.wald.intevation.org