# HG changeset patch # User Raimund Renkert # Date 1340206412 0 # Node ID 0dd569e9b9f1b48f19a15e7cfc434b14f62f8fbe # Parent 04952869e4fa1f0294133e92987f7fa09f783abe Added new methods to add domain and value axis markers to time series plots. flys-artifacts/trunk@4731 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 04952869e4fa -r 0dd569e9b9f1 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Jun 20 15:30:38 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Jun 20 15:33:32 2012 +0000 @@ -1,3 +1,8 @@ +2012-06-20 Raimund Renkert + + * src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java: + New methods to add domain and value axis markers to the plot. + 2012-06-20 Raimund Renkert * src/main/java/de/intevation/flys/exports/DeltaWtExporter.java: diff -r 04952869e4fa -r 0dd569e9b9f1 flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java Wed Jun 20 15:30:38 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java Wed Jun 20 15:33:32 2012 +0000 @@ -25,6 +25,9 @@ import org.jfree.chart.plot.XYPlot; import org.jfree.chart.annotations.XYTextAnnotation; import org.jfree.chart.LegendItemCollection; +import org.jfree.chart.plot.Marker; +import org.jfree.chart.plot.ValueMarker; +import org.jfree.ui.Layer; import org.jfree.data.Range; import org.jfree.data.time.TimeSeriesCollection; @@ -32,6 +35,7 @@ import org.jfree.data.xy.XYDataset; import org.jfree.data.time.Day; import org.jfree.data.time.TimeSeries; +import org.jfree.data.time.RegularTimePeriod; import de.intevation.artifactdatabase.state.ArtifactAndFacet; import de.intevation.artifactdatabase.state.Facet; @@ -64,7 +68,6 @@ protected int plotAxisIndex; - public TimeseriesAxisDataset(int axisSymbol) { this.axisSymbol = axisSymbol; this.datasets = new ArrayList(); @@ -145,6 +148,11 @@ /** List of annotations to insert in plot. */ protected List annotations; + protected List domainMarker; + + protected List valueMarker; + + protected boolean domainZeroLineVisible; private static final Logger logger = Logger.getLogger(TimeseriesChartGenerator.class); @@ -167,6 +175,8 @@ xBounds = new HashMap(); yBounds = new HashMap(); + domainMarker = new ArrayList(); + valueMarker = new ArrayList(); } @@ -193,11 +203,11 @@ adjustPlot(plot); addDatasets(plot); adjustAxes(plot); - + addDomainAxisMarker(plot); + addValueAxisMarker(plot); adaptZoom(plot); addAnnotationsToRenderer(plot); - return chart; } @@ -648,6 +658,22 @@ } } + public void addDomainAxisMarker(XYPlot plot) { + logger.debug("domainmarkers: " + domainMarker.size()); + for (Marker marker: domainMarker) { + logger.debug("adding domain marker"); + plot.addDomainMarker(marker, Layer.BACKGROUND); + } + domainMarker.clear(); + } + + public void addValueAxisMarker(XYPlot plot) { + for (Marker marker: valueMarker) { + logger.debug("adding value marker.."); + plot.addRangeMarker(marker, Layer.BACKGROUND); + } + valueMarker.clear(); + } /** Two Ranges that span a rectangular area. */ public static class Area {