changeset 7981:45cced06490c facet-metadata

merged with default.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 30 Jun 2014 11:29:45 +0200
parents 42076d94977e (diff) cacff0246a81 (current diff)
children 62befca02480
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffEpochFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffEpochFilterFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffEpochResult.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightEpochData.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/PorosityFacet.java artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffEpochInfoGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/FlowVelocityProcessor.java backend/doc/documentation/de/importer-hydr-morph.tex backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightEpoch.java backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightEpochValue.java backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightEpochParser.java backend/src/main/java/org/dive4elements/river/model/BedHeightEpoch.java backend/src/main/java/org/dive4elements/river/model/BedHeightEpochValue.java
diffstat 32 files changed, 274 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FlowVelocityFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FlowVelocityFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -40,6 +40,8 @@
         String      hash
     ) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.flow_velocity.section.yaxis.label");
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FlowVelocityFilterFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FlowVelocityFilterFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -44,6 +44,8 @@
         String      hash
     ) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.flow_velocity.section.yaxis.label");
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MiddleBedHeightFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MiddleBedHeightFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -42,6 +42,8 @@
         String      hash
     ) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedheight_middle.section.yaxis.label");
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensityFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensityFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -36,6 +36,8 @@
     public BedDensityFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.density");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterDataFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterDataFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -28,6 +28,8 @@
         String hash
     ) {
         super(ndx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -36,6 +36,8 @@
     public BedDiameterFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -30,6 +30,8 @@
     public BedDiffYearFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.axis.label.y");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFilterFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFilterFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -34,6 +34,8 @@
     public BedDiffYearFilterFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.height.yaxis.label");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -28,6 +28,8 @@
         this.description = description;
         this.type = type;
         this.index = 0;
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedheight.height.yaxis.label");
     }
 
     /**
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedPorosityFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedPorosityFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -36,6 +36,8 @@
     public BedPorosityFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.porosity");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -29,6 +29,8 @@
         String hash
     ) {
         super(ndx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -37,6 +37,8 @@
     public BedloadDiameterFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/FlowVelocityMeasurementFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/FlowVelocityMeasurementFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -29,6 +29,8 @@
         this.name = name;
         this.description = description;
         this.index = 0;
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.flow_velocity.section.yaxis.label");
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MorphologicWidthFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MorphologicWidthFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -36,6 +36,8 @@
     public MorphologicWidthFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.yaxis.label.morph");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/PorosityFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/PorosityFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -42,6 +42,8 @@
     public PorosityFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.porosity");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -39,6 +39,8 @@
     public SedimentDensityFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.yaxis.label.sedimentdensity");
     }
 
     @Override
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -54,6 +54,8 @@
     public SedimentLoadFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "");
     }
 
     @Override
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadUnknownFacet.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadUnknownFacet.java	Mon Jun 30 11:29:45 2014 +0200
@@ -22,6 +22,8 @@
     public SedimentLoadUnknownFacet(int idx, String name, String description,
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "");
     }
 
     /** Get data from SedimentLoad with unknown type, from factory. */
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java	Mon Jun 30 11:29:45 2014 +0200
@@ -20,8 +20,6 @@
 import java.awt.Graphics2D;
 import java.awt.Transparency;
 
-import java.awt.geom.Rectangle2D.Double;
-
 import java.awt.geom.Rectangle2D;
 
 import java.io.IOException;
@@ -30,6 +28,7 @@
 import java.io.UnsupportedEncodingException;
 
 import java.text.NumberFormat;
+import java.util.Map;
 
 import org.jfree.chart.ChartRenderingInfo;
 
@@ -50,6 +49,7 @@
 
 import org.dive4elements.artifacts.common.utils.XMLUtils;
 
+import org.dive4elements.river.jfree.XYMetaSeriesCollection;
 import org.dive4elements.river.utils.Formatter;
 
 
@@ -317,7 +317,11 @@
             for (int j = 0; j < scount; j++) {
                 Comparable seriesKey = data.getSeriesKey(j);
                 log.debug("series key: " + seriesKey.toString());
-                writeCSVHeader(writer, seriesKey.toString());
+                Map<String, String> metaData = null;
+                if (data instanceof XYMetaSeriesCollection) {
+                    metaData = ((XYMetaSeriesCollection) data).getMetaData();
+                }
+                writeCSVHeader(writer, seriesKey.toString(), metaData);
                 writeCSVData(writer, data, format);
             }
         }
@@ -330,11 +334,31 @@
     }
 
 
-    protected static void writeCSVHeader(CSVWriter writer, String key) {
+    protected static void writeCSVHeader(
+        CSVWriter writer,
+        String key,
+        Map<String, String> metaData)
+    {
         writer.writeNext(new String[] {"#"});
-        writer.writeNext(new String[] {"# " + key});
-        writer.writeNext(new String[] {"#"});
-        writer.writeNext(new String[] {"X", "Y"});
+        if (metaData != null) {
+            writer.writeNext(new String[] {"# " + key});
+            for (Map.Entry<String, String> entry: metaData.entrySet()) {
+                if (entry.getKey().equals("X") || entry.getKey().equals("Y")) {
+                    continue;
+                }
+                writer.writeNext(new String[]
+                    {"# " + entry.getKey() + " " + entry.getValue()});
+            }
+            writer.writeNext(new String[] {"#"});
+            writer.writeNext(new String[] {
+                metaData.get("X") != null ? metaData.get("X") : "X",
+                metaData.get("Y") != null ? metaData.get("Y") : "Y"});
+        }
+        else {
+            writer.writeNext(new String[] {"# " + key});
+            writer.writeNext(new String[] {"#"});
+            writer.writeNext(new String[] {"X", "Y"});
+        }
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java	Mon Jun 30 11:29:45 2014 +0200
@@ -44,6 +44,7 @@
 import org.dive4elements.river.jfree.Bounds;
 import org.dive4elements.river.jfree.DoubleBounds;
 import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
+import org.dive4elements.river.jfree.XYMetaSeriesCollection;
 
 import org.dive4elements.river.themes.ThemeDocument;
 import org.dive4elements.river.utils.RiverUtils;
@@ -494,7 +495,7 @@
         logger.debug("Y Range of XYSeries: " +
             series.getMinY() + " | " + series.getMaxY());
 
-        addAxisDataset(new XYSeriesCollection(series), index, visible);
+        addAxisDataset(new XYMetaSeriesCollection(series), index, visible);
     }
 
     /**
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -8,6 +8,8 @@
 
 package org.dive4elements.river.exports.process;
 
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
 
@@ -50,6 +52,8 @@
             boolean          visible) {
         CallContext context = generator.getCallContext();
         Object data = bundle.getData(context);
+        Map<String, String> metaData = bundle.getFacet().getMetaData(
+            bundle.getArtifact(), context);
 
         if (!(data instanceof BedDiffYearResult)) {
             // Should not happen if canHandle is correct
@@ -73,7 +77,8 @@
                 new Object[] { radius }));
         }
         BedDiffYearResult bData = (BedDiffYearResult) data;
-        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
         StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE);
 
         generator.addAxisSeries(series, axisName, visible);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -8,6 +8,8 @@
 
 package org.dive4elements.river.exports.process;
 
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
 
@@ -34,6 +36,8 @@
 
     protected static double GAP_TOLERANCE = 0.101d;
 
+    protected String yAxisLabel;
+
     public static final String I18N_AXIS_LABEL =
         "chart.beddifference.yaxis.label.diff";
     public static final String I18N_AXIS_LABEL_DEFAULT =
@@ -49,6 +53,9 @@
             boolean          visible) {
         CallContext context = generator.getCallContext();
         Object data = bundle.getData(context);
+        Map<String, String> metaData =
+            bundle.getFacet().getMetaData(bundle.getArtifact(), context);
+        yAxisLabel = metaData.get("Y");
         if (data instanceof BedDiffYearResult) {
             Double start = (Double)context.getContextValue("startkm");
             Double end = (Double)context.getContextValue("endkm");
@@ -66,10 +73,10 @@
                     I18N_SUBTITLE_RADIUS,
                     new Object[] { radius }));
             }
-            String facetType = bundle.getFacetName();
             BedDiffYearResult bData = (BedDiffYearResult) data;
 
-            XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+            StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+            series.putMetaData(metaData, bundle.getArtifact(), context);
             StyledSeriesBuilder.addPointsFactorY(series,
                 bData.getDifferencesData(),
                 false,
@@ -91,9 +98,12 @@
 
     @Override
     public String getAxisLabel(DiagramGenerator generator) {
+        if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
+            return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
+        }
         return generator.msg(
-                I18N_AXIS_LABEL,
-                I18N_AXIS_LABEL_DEFAULT);
+            I18N_AXIS_LABEL,
+            I18N_AXIS_LABEL_DEFAULT);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -9,6 +9,7 @@
 package org.dive4elements.river.exports.process;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
@@ -39,6 +40,8 @@
 
     protected static final double GAP_TOLERANCE = 0.101d;
 
+    protected String yAxisLabel;
+
     @Override
     public void doOut(
             DiagramGenerator generator,
@@ -65,8 +68,12 @@
     private XYSeries prepareSeries(ArtifactAndFacet bundle,
         ThemeDocument theme, CallContext context) {
         Object data = bundle.getData(context);
-        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+        Map<String, String> metaData = bundle.getFacet().getMetaData(
+            bundle.getArtifact(), context);
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
+        yAxisLabel = metaData.get("Y");
         if (data instanceof BedDiffYearResult) {
             BedDiffYearResult bData = (BedDiffYearResult) data;
 
@@ -135,6 +142,12 @@
 
         String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
 
+        if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
+            return generator.msg(
+                yAxisLabel,
+                I18N_AXIS_LABEL_DEFAULT,
+                new Object[] {unit});
+        }
         return generator.msg(
                 I18N_AXIS_LABEL,
                 I18N_AXIS_LABEL_DEFAULT,
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -8,6 +8,8 @@
 
 package org.dive4elements.river.exports.process;
 
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
 
@@ -31,6 +33,7 @@
     public static final String I18N_AXIS_LABEL =
         "chart.bedquality.yaxis.label.density";
 
+    protected String yAxisLabel;
     @Override
     public void doOut(
             DiagramGenerator generator,
@@ -38,9 +41,12 @@
             ThemeDocument    theme,
             boolean          visible) {
         CallContext context = generator.getCallContext();
-        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
         Object data = bundle.getData(context);
+        Map<String, String> metaData = bundle.getFacet().getMetaData();
+        series.putMetaData(metaData, bundle.getArtifact(), context);
+        yAxisLabel = metaData.get("Y");
         String facetName = bundle.getFacetName();
         double [][] points;
 
@@ -65,6 +71,9 @@
 
     @Override
     public String getAxisLabel(DiagramGenerator generator) {
+        if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
+            return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
+        }
         return generator.msg(
                 I18N_AXIS_LABEL,
                 I18N_AXIS_LABEL_DEFAULT);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -8,6 +8,9 @@
 
 package org.dive4elements.river.exports.process;
 
+import java.awt.Dialog.ModalExclusionType;
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
 
@@ -33,6 +36,7 @@
     public static final String I18N_AXIS_LABEL =
         "chart.bedquality.yaxis.label.diameter";
 
+    protected String yAxisLabel;
     @Override
     public void doOut(
             DiagramGenerator generator,
@@ -40,8 +44,11 @@
             ThemeDocument    theme,
             boolean          visible) {
         CallContext context = generator.getCallContext();
-        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+        Map<String, String> metaData = bundle.getFacet().getMetaData();
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
+        yAxisLabel = metaData.get("Y");
         Object data = bundle.getData(context);
         String facetName = bundle.getFacetName();
         double [][] points;
@@ -77,6 +84,9 @@
 
     @Override
     public String getAxisLabel(DiagramGenerator generator) {
+        if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
+            return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
+        }
         return generator.msg(
                 I18N_AXIS_LABEL,
                 I18N_AXIS_LABEL_DEFAULT);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -8,6 +8,8 @@
 
 package org.dive4elements.river.exports.process;
 
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
 
@@ -32,6 +34,8 @@
     public static final String I18N_AXIS_LABEL =
         "chart.bedquality.yaxis.label.porosity";
 
+    protected String yAxisLabel;
+
     @Override
     public void doOut(
             DiagramGenerator generator,
@@ -39,8 +43,11 @@
             ThemeDocument    theme,
             boolean          visible) {
         CallContext context = generator.getCallContext();
-        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+        Map<String, String> metaData = bundle.getFacet().getMetaData();
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
+        yAxisLabel = metaData.get("Y");
         Object data = bundle.getData(context);
         String facetName = bundle.getFacetName();
         double [][] points;
@@ -69,6 +76,9 @@
 
     @Override
     public String getAxisLabel(DiagramGenerator generator) {
+        if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
+            return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
+        }
         return generator.msg(
                 I18N_AXIS_LABEL,
                 I18N_AXIS_LABEL_DEFAULT);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -12,6 +12,7 @@
 import org.jfree.data.xy.XYSeries;
 
 import java.util.List;
+import java.util.Map;
 
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifacts.CallContext;
@@ -38,6 +39,8 @@
     public static final String I18N_AXIS_LABEL =
         "chart.beddifference.yaxis.label.morph";
 
+    protected String yAxisLabel;
+
     public static final double GAP_WIDTH = 100.0;
 
     @Override
@@ -47,8 +50,11 @@
             ThemeDocument    theme,
             boolean          visible) {
         CallContext context = generator.getCallContext();
-        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+        Map<String, String> metaData = bundle.getFacet().getMetaData();
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
+        yAxisLabel = metaData.get("Y");
         Object data = bundle.getData(context);
         String facetName = bundle.getFacetName();
 
@@ -105,6 +111,9 @@
 
     @Override
     public String getAxisLabel(DiagramGenerator generator) {
+        if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
+            return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
+        }
         return generator.msg(
                 I18N_AXIS_LABEL,
                 I18N_AXIS_LABEL_DEFAULT);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FlowVelocityProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FlowVelocityProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -8,6 +8,8 @@
 
 package org.dive4elements.river.exports.process;
 
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
 
@@ -39,6 +41,9 @@
     public static final String I18N_SUBTITLE_RADIUS =
         "chart.subtitle.radius";
 
+
+    protected String yAxisLabel;
+
     @Override
     public void doOut(
             DiagramGenerator generator,
@@ -46,8 +51,11 @@
             ThemeDocument    theme,
             boolean          visible) {
         CallContext context = generator.getCallContext();
-        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+        Map<String, String> metaData = bundle.getFacet().getMetaData();
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
+        yAxisLabel = metaData.get("Y");
         String facetName = bundle.getFacetName();
         Object data = bundle.getData(context);
         if (data == null) {
@@ -107,6 +115,9 @@
 
     @Override
     public String getAxisLabel(DiagramGenerator generator) {
+        if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
+            return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
+        }
         return generator.msg(
                 I18N_AXIS_LABEL,
                 I18N_AXIS_LABEL_DEFAULT);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/MiddleBedHeightProcessor.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/MiddleBedHeightProcessor.java	Mon Jun 30 11:29:45 2014 +0200
@@ -8,6 +8,8 @@
 
 package org.dive4elements.river.exports.process;
 
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 
 import org.jfree.data.xy.XYSeries;
@@ -36,6 +38,8 @@
     public static final String I18N_AXIS_LABEL_DEFAULT =
         "mittlere Sohlhöhen [müNN]";
 
+    protected String yAxisLabel;
+
     @Override
     public void doOut(
             DiagramGenerator generator,
@@ -44,11 +48,14 @@
             boolean          visible) {
         CallContext context = generator.getCallContext();
         logger.debug("Processing: " + bundle.getFacetName());
+        Map<String, String> metaData = bundle.getFacet().getMetaData();
+        yAxisLabel = metaData.get("Y");
         MiddleBedHeightData data =
             (MiddleBedHeightData) bundle.getData(context);
 
-        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
 
         StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(),
                 false, 0.110d);
@@ -62,6 +69,12 @@
 
         String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
 
+        if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
+            return generator.msg(
+                yAxisLabel,
+                I18N_AXIS_LABEL_DEFAULT,
+                new Object[] { unit });
+        }
         return generator.msg(
                 I18N_AXIS_LABEL,
                 I18N_AXIS_LABEL_DEFAULT,
--- a/artifacts/src/main/java/org/dive4elements/river/jfree/StyledXYSeries.java	Fri Jun 27 19:28:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StyledXYSeries.java	Mon Jun 30 11:29:45 2014 +0200
@@ -9,9 +9,17 @@
 package org.dive4elements.river.jfree;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.resources.Resources;
+import org.dive4elements.river.model.Unit;
 import org.dive4elements.river.themes.ThemeDocument;
+import org.dive4elements.river.utils.RiverUtils;
 
 import org.jfree.data.xy.XYDataItem;
 import org.jfree.data.xy.XYSeries;
@@ -21,7 +29,9 @@
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public class StyledXYSeries extends XYSeries implements StyledSeries, HasLabel {
+public class StyledXYSeries
+extends XYSeries
+implements StyledSeries, HasLabel, XYMetaDataset {
 
     private static final Logger logger = Logger.getLogger(StyledXYSeries.class);
 
@@ -30,6 +40,8 @@
     /** If this Series is to be labelled, use this String as label. */
     protected String label;
 
+    /** The meta data for this series. */
+    protected Map<String, String> metaData;
 
     public StyledXYSeries(String key, ThemeDocument theme) {
         this(key, true, theme, (Shape)null);
@@ -115,5 +127,35 @@
             add(item.getXValue(), item.getYValue());
         }
     }
+
+
+    @Override
+    public Map<String, String> getMetaData() {
+        return metaData;
+    }
+
+
+    @Override
+    public void putMetaData(Map<String, String> metaData,
+        Artifact artifact,
+        CallContext context) {
+        this.metaData = metaData;
+        D4EArtifact d4e = (D4EArtifact) artifact;
+        RiverAccess access = new RiverAccess(d4e);
+        Unit unit = RiverUtils.getRiver(d4e).getWstUnit();
+        if (metaData.containsKey("X")) {
+            this.metaData.put("X",
+                Resources.getMsg(
+                    context.getMeta(),
+                    metaData.get("X"),
+                    new Object[] { access.getRiverName() }));
+        }
+        if (metaData.containsKey("Y")) {
+            this.metaData.put("Y",
+                Resources.getMsg(
+                    context.getMeta(),
+                    metaData.get("Y"), new Object[] { unit.getName() }));
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/jfree/XYMetaDataset.java	Mon Jun 30 11:29:45 2014 +0200
@@ -0,0 +1,32 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.jfree;
+
+import java.util.Map;
+
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+
+
+public interface XYMetaDataset
+{
+
+    /**
+     * The meta data for this data set.
+     */
+    Map<String, String> getMetaData();
+
+    /**
+     * Add meta data for this data set.
+     */
+    void putMetaData(
+        Map<String, String> metaData,
+        Artifact artifact,
+        CallContext context);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/jfree/XYMetaSeriesCollection.java	Mon Jun 30 11:29:45 2014 +0200
@@ -0,0 +1,28 @@
+package org.dive4elements.river.jfree;
+
+import java.util.Map;
+
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+
+public class XYMetaSeriesCollection
+extends XYSeriesCollection
+{
+
+    protected Map<String, String> metaData;
+
+    public XYMetaSeriesCollection(XYSeries series) {
+        super(series);
+        if (series instanceof XYMetaDataset) {
+            this.metaData = ((XYMetaDataset) series).getMetaData();
+        }
+        else {
+            metaData = null;
+        }
+    }
+
+    public Map<String, String> getMetaData() {
+        return this.metaData;
+    }
+}

http://dive4elements.wald.intevation.org