Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 923:7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
flys-artifacts/trunk@2275 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 01 Jul 2011 11:16:11 +0000 |
parents | f959faaa7c4a |
children | f7761914f745 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Fri Jul 01 08:33:52 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Fri Jul 01 11:16:11 2011 +0000 @@ -12,7 +12,6 @@ import org.jfree.chart.title.TextTitle; import org.jfree.data.Range; import org.jfree.data.xy.XYSeries; -import org.jfree.data.xy.XYSeriesCollection; import org.w3c.dom.Document; @@ -59,20 +58,12 @@ public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; public static final String I18N_2YAXIS_LABEL_DEFAULT = "Q [m\u00b3/s]"; - /** The storage for the W series to be drawn in this chart.*/ - protected XYSeriesCollection w; - - /** The storage for the Q series to be drawn in this chart.*/ - protected XYSeriesCollection q; protected boolean inverted; public LongitudinalSectionGenerator() { super(); - - this.w = new XYSeriesCollection(); - this.q = new XYSeriesCollection(); } @@ -113,43 +104,34 @@ } - @Override - protected void addDatasets(JFreeChart chart) { - XYPlot plot = (XYPlot) chart.getPlot(); - - plot.setDataset(0, w); - plot.setDataset(1, q); - } - - protected void adjustPlot(XYPlot plot) { super.adjustPlot(plot); - // TODO REMOVE THIS CODE, IF WE HAVE INTRODUCED THEMES! - XYLineAndShapeRenderer rw = (XYLineAndShapeRenderer) - plot.getRendererForDataset(w); - - XYLineAndShapeRenderer rq = null; - try { - rq = (XYLineAndShapeRenderer) rw.clone(); - } - catch (Exception e) { - logger.error(e, e); - } + //// TODO REMOVE THIS CODE, IF WE HAVE INTRODUCED THEMES! + //XYLineAndShapeRenderer rw = (XYLineAndShapeRenderer) + // plot.getRendererForDataset(w); - int wNum = w.getSeriesCount(); - int qNum = q.getSeriesCount(); + //XYLineAndShapeRenderer rq = null; + //try { + // rq = (XYLineAndShapeRenderer) rw.clone(); + //} + //catch (Exception e) { + // logger.error(e, e); + //} - for (int i = 0; i < wNum; i++) { - rw.setSeriesPaint(i, Color.BLUE); - } + //int wNum = w.getSeriesCount(); + //int qNum = q.getSeriesCount(); - for (int i = 0; i < qNum; i++) { - rq.setSeriesPaint(i, Color.GREEN); - } + //for (int i = 0; i < wNum; i++) { + // rw.setSeriesPaint(i, Color.BLUE); + //} - plot.setRenderer(0, rw); - plot.setRenderer(1, rq); + //for (int i = 0; i < qNum; i++) { + // rq.setSeriesPaint(i, Color.GREEN); + //} + + //plot.setRenderer(0, rw); + //plot.setRenderer(1, rq); } @@ -160,7 +142,6 @@ msg(I18N_2YAXIS_LABEL, I18N_2YAXIS_LABEL_DEFAULT)); plot.setRangeAxis(1, qAxis); - plot.mapDatasetToRangeAxis(1, 1); invertXAxis(plot.getDomainAxis()); } @@ -252,7 +233,7 @@ series.add(wqkms.getKms(i), wqkms.getW(i)); } - w.addSeries(series); + addFirstAxisSeries(series); if (wqkms.guessWaterIncreasing()) { setInverted(true); @@ -285,7 +266,7 @@ series.add(wqkms.getKms(i), wqkms.getQ(i)); } - q.addSeries(series); + addSecondAxisSeries(series); if (wqkms.guessWaterIncreasing()) { setInverted(true);