# HG changeset patch # User Felix Wolfsteller # Date 1322210564 0 # Node ID e4a516ca2e8667de6adc7de46e64d16e7adeadf0 # Parent 9e9cfc036a3f3d62c715ec9e5cfdfe4c34a3e6eb When having axis in diagrams, always have one on the left. flys-artifacts/trunk@3315 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 9e9cfc036a3f -r e4a516ca2e86 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Nov 24 11:03:33 2011 +0000 +++ b/flys-artifacts/ChangeLog Fri Nov 25 08:42:44 2011 +0000 @@ -1,3 +1,11 @@ +2011-11-25 Felix Wolfsteller + + Let first visible axis be always on the left. + + * src/main/java/de/intevation/flys/exports/XYChartGenerator.java: + (createAxes): When creating axes, keep track of which is the first + one. Set its location to "left". + 2011-11-24 Felix Wolfsteller Use multiple axis in relevant generators. diff -r 9e9cfc036a3f -r e4a516ca2e86 flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Thu Nov 24 11:03:33 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Fri Nov 25 08:42:44 2011 +0000 @@ -24,6 +24,7 @@ import org.jfree.chart.LegendItem; import org.jfree.chart.LegendItemCollection; import org.jfree.chart.annotations.XYTextAnnotation; +import org.jfree.chart.axis.AxisLocation; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.PlotOrientation; @@ -284,18 +285,24 @@ /** - * Create y-axes. + * Create y-axes, ensure that the first axis (with data) is on the left. */ public void createAxes(XYPlot plot) { logger.debug("XYChartGenerator.createAxes"); + Integer last = datasets.lastKey(); + int i = 0; + int firstVisible = 0; if (last != null) { - for (int i = last; i >= 0; --i) { + firstVisible = i = last; + for (; i >= 0; --i) { if (datasets.containsKey(i)) { plot.setRangeAxis(i, createYAxis(i)); + firstVisible = i; } } + plot.setRangeAxisLocation(firstVisible, AxisLocation.TOP_OR_LEFT); } }