Mercurial > dive4elements > river
changeset 2553:c7b0dfa6a52c
Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
flys-artifacts/trunk@4068 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 17 Feb 2012 07:45:27 +0000 |
parents | c7dbe696286c |
children | ee5eca3871cb |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java |
diffstat | 4 files changed, 47 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Feb 16 12:36:25 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Feb 17 07:45:27 2012 +0000 @@ -1,3 +1,16 @@ +2012-02-17 Ingo Weinzierl <ingo@intevation.de> + + Part I/III flys/issue497 (Diagrammeigenschaften in Zeitseriendiagrammen) + + * src/main/java/de/intevation/flys/exports/ChartGenerator.java, + src/main/java/de/intevation/flys/exports/XYChartGenerator.java: Moved + adjustPlot() from XYChartGenerator to ChartGenerator which enables the + TimeseriesChartGenerator to call this method as well. + + * src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java: + Call adjustPlot() in generateChart() to apply the settings specific to + gridlines in the timeseries plot. + 2012-02-16 Raimund Renkert <raimund.renkert@intevation.de> Refactored the wq data fields.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Thu Feb 16 12:36:25 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Fri Feb 17 07:45:27 2012 +0000 @@ -1,8 +1,10 @@ package de.intevation.flys.exports; +import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Paint; +import java.awt.Stroke; import java.awt.TexturePaint; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; @@ -33,6 +35,7 @@ import org.jfree.data.Range; import org.jfree.data.general.Series; import org.jfree.data.xy.XYDataset; +import org.jfree.ui.RectangleInsets; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; @@ -908,6 +911,36 @@ /** + * Adjust some Stroke/Grid parameters for <i>plot</i>. The chart + * <i>Settings</i> are applied in this method. + * + * @param plot The XYPlot which is adapted. + */ + protected void adjustPlot(XYPlot plot) { + Stroke gridStroke = new BasicStroke( + DEFAULT_GRID_LINE_WIDTH, + BasicStroke.CAP_BUTT, + BasicStroke.JOIN_MITER, + 3.0f, + new float[] { 3.0f }, + 0.0f); + + ChartSettings cs = getChartSettings(); + boolean isGridVisible = cs != null ? isGridVisible(cs) : true; + + plot.setDomainGridlineStroke(gridStroke); + plot.setDomainGridlinePaint(DEFAULT_GRID_COLOR); + plot.setDomainGridlinesVisible(isGridVisible); + + plot.setRangeGridlineStroke(gridStroke); + plot.setRangeGridlinePaint(DEFAULT_GRID_COLOR); + plot.setRangeGridlinesVisible(isGridVisible); + + plot.setAxisOffset(new RectangleInsets(0d, 0d, 0d, 0d)); + } + + + /** * This helper mehtod is used to extract the current locale from instance * vairable <i>context</i>. *
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java Thu Feb 16 12:36:25 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java Fri Feb 17 07:45:27 2012 +0000 @@ -168,6 +168,7 @@ plot.setBackgroundPaint(Color.WHITE); addSubtitles(chart); + adjustPlot(plot); addDatasets(plot); adaptZoom(plot);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Thu Feb 16 12:36:25 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Fri Feb 17 07:45:27 2012 +0000 @@ -33,7 +33,6 @@ import org.jfree.data.xy.XYSeriesCollection; import org.jfree.data.xy.XYDataset; -import org.jfree.ui.RectangleInsets; import org.jfree.ui.TextAnchor; import de.intevation.artifactdatabase.state.ArtifactAndFacet; @@ -886,33 +885,6 @@ /** - * Set some Stroke/Grid defaults. - */ - protected void adjustPlot(XYPlot plot) { - Stroke gridStroke = new BasicStroke( - DEFAULT_GRID_LINE_WIDTH, - BasicStroke.CAP_BUTT, - BasicStroke.JOIN_MITER, - 3.0f, - new float[] { 3.0f }, - 0.0f); - - ChartSettings cs = getChartSettings(); - boolean isGridVisible = cs != null ? isGridVisible(cs) : true; - - plot.setDomainGridlineStroke(gridStroke); - plot.setDomainGridlinePaint(DEFAULT_GRID_COLOR); - plot.setDomainGridlinesVisible(isGridVisible); - - plot.setRangeGridlineStroke(gridStroke); - plot.setRangeGridlinePaint(DEFAULT_GRID_COLOR); - plot.setRangeGridlinesVisible(isGridVisible); - - plot.setAxisOffset(new RectangleInsets(0d, 0d, 0d, 0d)); - } - - - /** * This method walks over all axes (domain and range) of <i>plot</i> and * calls localizeDomainAxis() for domain axes or localizeRangeAxis() for * range axes.