comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 5672:c2a590925ec3

Do not autozoom on logarithmic axis. Autozoom tries to include 0 in most cases Part of a Fix for issue/12345
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 12 Apr 2013 12:22:01 +0200
parents b195fede1c3b
children
comparison
equal deleted inserted replaced
5671:17c956be4692 5672:c2a590925ec3
17 import org.jfree.chart.annotations.XYAnnotation; 17 import org.jfree.chart.annotations.XYAnnotation;
18 import org.jfree.chart.annotations.XYImageAnnotation; 18 import org.jfree.chart.annotations.XYImageAnnotation;
19 import org.jfree.chart.annotations.XYTextAnnotation; 19 import org.jfree.chart.annotations.XYTextAnnotation;
20 import org.jfree.chart.axis.NumberAxis; 20 import org.jfree.chart.axis.NumberAxis;
21 import org.jfree.chart.axis.ValueAxis; 21 import org.jfree.chart.axis.ValueAxis;
22 import org.jfree.chart.axis.LogarithmicAxis;
22 import org.jfree.chart.plot.Marker; 23 import org.jfree.chart.plot.Marker;
23 import org.jfree.chart.plot.PlotOrientation; 24 import org.jfree.chart.plot.PlotOrientation;
24 import org.jfree.chart.plot.XYPlot; 25 import org.jfree.chart.plot.XYPlot;
25 import org.jfree.data.Range; 26 import org.jfree.data.Range;
26 import org.jfree.data.general.Series; 27 import org.jfree.data.general.Series;
212 isLegendVisible(), 213 isLegendVisible(),
213 false, 214 false,
214 false); 215 false);
215 216
216 XYPlot plot = (XYPlot) chart.getPlot(); 217 XYPlot plot = (XYPlot) chart.getPlot();
217 plot.setDomainAxis(createXAxis(getXAxisLabel())); 218 ValueAxis axis = createXAxis(getXAxisLabel());
219 plot.setDomainAxis(axis);
218 220
219 chart.setBackgroundPaint(Color.WHITE); 221 chart.setBackgroundPaint(Color.WHITE);
220 plot.setBackgroundPaint(Color.WHITE); 222 plot.setBackgroundPaint(Color.WHITE);
221 addSubtitles(chart); 223 addSubtitles(chart);
222 adjustPlot(plot); 224 adjustPlot(plot);
234 236
235 //debugAxis(plot); 237 //debugAxis(plot);
236 238
237 localizeAxes(plot); 239 localizeAxes(plot);
238 adjustAxes(plot); 240 adjustAxes(plot);
239 autoZoom(plot); 241 if (!(axis instanceof LogarithmicAxis)) {
242 // XXX:
243 // The auto zoom without a range tries
244 // to include 0 in a logarithmic axis
245 // which triggers a bug in jfreechart that causes
246 // the values to be drawn carthesian
247 autoZoom(plot);
248 }
240 249
241 //debugAxis(plot); 250 //debugAxis(plot);
242 251
243 // These have to go after the autozoom. 252 // These have to go after the autozoom.
244 addAnnotationsToRenderer(plot); 253 addAnnotationsToRenderer(plot);

http://dive4elements.wald.intevation.org