diff gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java @ 492:79e80c289018

Added labels and titles to 'Profilschnitt' charts. gnv-artifacts/trunk@569 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 19 Jan 2010 10:06:03 +0000
parents 20a480753ff9
children 1bf058f1a2d1
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java	Mon Jan 18 15:49:12 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java	Tue Jan 19 10:06:03 2010 +0000
@@ -27,6 +27,7 @@
 import org.jfree.chart.axis.SymbolAxis;
 
 import org.jfree.chart.title.PaintScaleLegend;
+import org.jfree.chart.title.TextTitle;
 
 import org.jfree.chart.renderer.LookupPaintScale;
 
@@ -80,6 +81,7 @@
     protected AttributedXYColumns columns;
     protected Palette             palette;
     protected Locale              locale;
+    protected ChartLabels         labels;
 
     public VerticalCrossSectionChart() {
     }
@@ -87,21 +89,20 @@
     public VerticalCrossSectionChart(
         AttributedXYColumns columns,
         Palette             palette,
-        Locale              locale
+        Locale              locale,
+        ChartLabels         labels
     ) {
         this.columns = columns;
         this.palette = palette;
         this.locale  = locale;
+        this.labels  = labels;
     }
 
     protected JFreeChart createChart() {
 
-        String title        = "Neues 2D-Diagramm";
-        String xAxis        = "x-Achse des Diagramms";
-        String yAxis        = "y-Achse des Diagramms";
-        boolean legendB     = false;
-        boolean tooltips    = false;
-        boolean urls        = false;
+        boolean legendB  = false;
+        boolean tooltips = false;
+        boolean urls     = false;
 
         PlotOrientation po  = PlotOrientation.HORIZONTAL;
         PolygonDataset data = columns.getPolygonDataset();
@@ -124,8 +125,8 @@
             new PalettePaintLookup(palette),
             new LocalizedLabelGenerator(format));
 
-        ValueAxis domainAxis = new NumberAxis(xAxis);
-        ValueAxis rangeAxis  = new NumberAxis(yAxis);
+        ValueAxis domainAxis = new NumberAxis(this.labels.getDomainAxisLabel());
+        ValueAxis rangeAxis  = new NumberAxis(this.labels.getRangeAxisLabel());
 
         PolygonPlot plot = new PolygonPlot(
             data,
@@ -153,14 +154,15 @@
         }
 
         JFreeChart chart = new JFreeChart(
-            title,
+            this.labels.getTitle(),
             JFreeChart.DEFAULT_TITLE_FONT,
             plot,
             legendB);
 
         chart.removeLegend();
+        chart.addSubtitle(new TextTitle(this.labels.getSubtitle()));
 
-        SymbolAxis scale = new SymbolAxis("Temperatur", labels);
+        SymbolAxis scale = new SymbolAxis(this.labels.getParameterName(), labels);
         scale.setRange(-1.5d, labels.length+0.5d);
         scale.setGridBandsVisible(false);
         scale.setPlot(plot);

http://dive4elements.wald.intevation.org