annotate artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents 6dfc3a1fc70d
children a7f1d4c9add4 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
9 package org.dive4elements.river.exports;
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
11 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
12 import org.dive4elements.artifactdatabase.state.Settings;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
13 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
14 import org.dive4elements.artifacts.ArtifactNamespaceContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
15 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
16 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
17 import org.dive4elements.artifacts.PreferredLocale;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
18 import org.dive4elements.artifacts.common.utils.XMLUtils;
8248
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
19
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
20 import org.dive4elements.river.artifacts.access.RiverAccess;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
21 import org.dive4elements.river.artifacts.access.RangeAccess;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
22 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
23 import org.dive4elements.river.artifacts.resources.Resources;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
24 import org.dive4elements.river.collections.D4EArtifactCollection;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
25 import org.dive4elements.river.jfree.Bounds;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
26 import org.dive4elements.river.jfree.DoubleBounds;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
27 import org.dive4elements.river.jfree.EnhancedLineAndShapeRenderer;
5864
f2e46a668fe6 River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
28 import org.dive4elements.river.jfree.RiverAnnotation;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
29 import org.dive4elements.river.jfree.StableXYDifferenceRenderer;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
30 import org.dive4elements.river.jfree.Style;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
31 import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
32 import org.dive4elements.river.jfree.StyledSeries;
7034
557cb3a3d772 Combine AxisDataset implementations and remove / simplify handling code.
Andre Heinecke <aheinecke@intevation.de>
parents: 6908
diff changeset
33 import org.dive4elements.river.jfree.AxisDataset;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6900
diff changeset
34 import org.dive4elements.river.themes.ThemeDocument;
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
35
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
36 import java.awt.BasicStroke;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
37 import java.awt.Color;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
38 import java.awt.Font;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
39 import java.awt.Paint;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
40 import java.awt.Stroke;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
41 import java.awt.TexturePaint;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
42 import java.awt.geom.Rectangle2D;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
43 import java.awt.image.BufferedImage;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
44 import java.io.IOException;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
45 import java.io.OutputStream;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
46 import java.util.ArrayList;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
47 import java.util.List;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
48 import java.util.Locale;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
49 import java.util.Map;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
50 import java.util.SortedMap;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
51 import java.util.TreeMap;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
52
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
53 import javax.xml.xpath.XPathConstants;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
54
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
55 import org.apache.log4j.Logger;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
56 import org.jfree.chart.JFreeChart;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
57 import org.jfree.chart.LegendItem;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
58 import org.jfree.chart.LegendItemCollection;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
59 import org.jfree.chart.axis.NumberAxis;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
60 import org.jfree.chart.plot.XYPlot;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
61 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
3409
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
62 import org.jfree.chart.title.TextTitle;
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
63 import org.jfree.data.Range;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
64 import org.jfree.data.general.Series;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
65 import org.jfree.data.xy.XYDataset;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
66 import org.jfree.ui.RectangleInsets;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
67 import org.w3c.dom.Document;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3250
diff changeset
68 import org.w3c.dom.Element;
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4858
diff changeset
70 import org.dive4elements.river.utils.Formatter;
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 /**
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 * The base class for chart creation. It should provide some basic things that
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 * equal in all chart types.
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 *
5864
f2e46a668fe6 River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
76 * Annotations are added as RiverAnnotations and come in mutliple basic forms:
4276
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
77 * TextAnnotations are labels somewhere in data space, StickyAnnotations are
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
78 * labels of a slice or line in one data dimension (i.e. visualized as label
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
79 * on a single axis).
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
80 *
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 */
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 public abstract class ChartGenerator implements OutGenerator {
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
85 private static Logger log = Logger.getLogger(ChartGenerator.class);
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
87 public static final int DEFAULT_CHART_WIDTH = 600;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
88 public static final int DEFAULT_CHART_HEIGHT = 400;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
89 public static final String DEFAULT_CHART_FORMAT = "png";
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
90 public static final Color DEFAULT_GRID_COLOR = Color.GRAY;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
91 public static final float DEFAULT_GRID_LINE_WIDTH = 0.3f;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
92 public static final int DEFAULT_FONT_SIZE = 12;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
93 public static final String DEFAULT_FONT_NAME = "Tahoma";
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
94
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
95 protected static float ANNOTATIONS_AXIS_OFFSET = 0.02f;
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
96
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
97 public static final String XPATH_CHART_SIZE =
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
98 "/art:action/art:attributes/art:size";
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
99
1735
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
100 public static final String XPATH_CHART_FORMAT =
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
101 "/art:action/art:attributes/art:format/@art:value";
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
102
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
103 public static final String XPATH_CHART_X_RANGE =
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
104 "/art:action/art:attributes/art:xrange";
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
105
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
106 public static final String XPATH_CHART_Y_RANGE =
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
107 "/art:action/art:attributes/art:yrange";
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
108
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
109
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 /** The document of the incoming out() request.*/
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 protected Document request;
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 /** The output stream where the data should be written to.*/
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 protected OutputStream out;
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 /** The CallContext object.*/
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 protected CallContext context;
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
119 protected D4EArtifactCollection collection;
3422
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3409
diff changeset
120
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
121 /** Artifact that is used to decorate the chart with meta information.*/
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
122 protected Artifact master;
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
123
2047
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
124 /** The settings that should be used during output creation.*/
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
125 protected Settings settings;
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
126
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
127 /** Map of datasets ("index"). */
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
128 protected SortedMap<Integer, AxisDataset> datasets;
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
129
3212
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
130 /** List of annotations to insert in plot. */
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
131 protected List<RiverAnnotation> annotations =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
132 new ArrayList<RiverAnnotation>();
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
7077
0a337f0005c2 Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7037
diff changeset
134 protected String outName;
0a337f0005c2 Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7037
diff changeset
135
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
136 /**
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
137 * A mini interface that allows to walk over the YAXIS enums defined in
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
138 * subclasses.
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
139 */
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
140 public interface YAxisWalker {
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
141
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
142 int length();
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
143
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
144 String getId(int idx);
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
145 } // end of YAxisWalker interface
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
146
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
147
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
148 /**
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
149 * Default constructor that initializes internal data structures.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
150 */
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
151 public ChartGenerator() {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
152 datasets = new TreeMap<Integer, AxisDataset>();
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
153 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
154
7037
5c6fd2c010dd Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7034
diff changeset
155 @Override
7087
ada424214b02 Use Object instead of DOM Element as argument for setup of out generators. First step to remove dependency to XML DOM when using configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7077
diff changeset
156 public void setup(Object config) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
157 log.debug("ChartGenerator.setup");
7037
5c6fd2c010dd Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7034
diff changeset
158 }
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
159
3212
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
160 /**
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
161 * Adds annotations to list. The given annotation will be visible.
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
162 */
5864
f2e46a668fe6 River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
163 public void addAnnotations(RiverAnnotation annotation) {
3212
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
164 annotations.add(annotation);
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
165 }
3245
dd3ddc8ecb14 Remove HYK references/code from ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3242
diff changeset
166
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
167
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
168 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
169 * This method needs to be implemented by concrete subclasses to create new
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
170 * instances of JFreeChart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
171 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
172 * @return a new instance of a JFreeChart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
173 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
174 public abstract JFreeChart generateChart();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
175
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
176
4589
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
177 /** For every outable (i.e. facets), this function is
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
178 * called and handles the data accordingly. */
3278
c27c4e06dd87 Re-add HYK rendering code to CrossSectionGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3270
diff changeset
179 @Override
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
180 public abstract void doOut(
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
181 ArtifactAndFacet bundle,
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6900
diff changeset
182 ThemeDocument attr,
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
183 boolean visible);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
184
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
185
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
186 protected abstract YAxisWalker getYAxisWalker();
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
187
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
188
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
189 protected abstract Series getSeriesOf(XYDataset dataset, int idx);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
190
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
191 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
192 * Returns the default title of a chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
193 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
194 * @return the default title of a chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
195 */
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
196 protected abstract String getDefaultChartTitle();
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
197
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
198
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
199 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
200 * Returns the default X-Axis label of a chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
201 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
202 * @return the default X-Axis label of a chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
203 */
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
204 protected abstract String getDefaultXAxisLabel();
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
205
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
206
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
207 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
208 * This method is called to retrieve the default label for an Y axis at
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
209 * position <i>pos</i>.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
210 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
211 * @param pos The position of an Y axis.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
212 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
213 * @return the default Y axis label at position <i>pos</i>.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
214 */
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
215 protected abstract String getDefaultYAxisLabel(int pos);
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
216
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
217
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
218 /**
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
219 * This method is used to create new AxisDataset instances which may differ
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
220 * in concrete subclasses.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
221 *
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
222 * @param idx The index of an axis.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
223 */
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
224 protected abstract AxisDataset createAxisDataset(int idx);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
225
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
226
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
227 /**
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
228 * Combines the ranges of the X axis at index <i>idx</i>.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
229 *
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3257
diff changeset
230 * @param bounds A new Bounds.
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
231 * @param idx The index of the X axis that should be comined with
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
232 * <i>range</i>.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
233 */
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
234 protected abstract void combineXBounds(Bounds bounds, int idx);
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
235
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
236
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
237 /**
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
238 * Combines the ranges of the Y axis at index <i>idx</i>.
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
239 *
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3257
diff changeset
240 * @param bounds A new Bounds.
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3278
diff changeset
241 * @param index The index of the Y axis that should be comined with.
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
242 * <i>range</i>.
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
243 */
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
244 protected abstract void combineYBounds(Bounds bounds, int index);
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
245
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
246
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
247 /**
2261
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
248 * This method is used to determine the ranges for axes at a given index.
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
249 *
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
250 * @param index The index of the axes at the plot.
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
251 *
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
252 * @return a Range[] with [xrange, yrange];
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
253 */
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
254 public abstract Range[] getRangesForAxis(int index);
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
255
2398
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
256 public abstract Bounds getXBounds(int axis);
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
257
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
258 protected abstract void setXBounds(int axis, Bounds bounds);
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
259
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
260 public abstract Bounds getYBounds(int axis);
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
261
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
262 protected abstract void setYBounds(int axis, Bounds bounds);
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
263
2261
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
264
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2242
diff changeset
265 /**
3409
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
266 * This method retrieves the chart subtitle by calling getChartSubtitle()
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
267 * and adds it as TextTitle to the chart.
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
268 * The default implementation of getChartSubtitle() returns the same
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
269 * as getDefaultChartSubtitle() which must be implemented by derived
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
270 * classes. If you want to add multiple subtitles to the chart override
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
271 * this method and add your subtitles manually.
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
272 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
273 * @param chart The JFreeChart chart object.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
274 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
275 protected void addSubtitles(JFreeChart chart) {
3409
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
276 String subtitle = getChartSubtitle();
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
277
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
278 if (subtitle != null && subtitle.length() > 0) {
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
279 chart.addSubtitle(new TextTitle(subtitle));
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 3296
diff changeset
280 }
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
281 }
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
282
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
283
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
284 /**
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
285 * Register annotations like MainValues for later plotting
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
286 *
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
287 * @param annotations list of annotations (data of facet).
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
288 * @param aandf Artifact and the facet.
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
289 * @param theme Theme document for given annotations.
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
290 * @param visible The visibility of the annotations.
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
291 */
6900
a38640f273ae ChartGenerator: Changed visibility of doAnnotations,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6422
diff changeset
292 public void doAnnotations(
5864
f2e46a668fe6 River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
293 RiverAnnotation annotations,
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
294 ArtifactAndFacet aandf,
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6900
diff changeset
295 ThemeDocument theme,
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
296 boolean visible
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
297 ){
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
298 log.debug("doAnnotations");
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
299
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
300 // Add all annotations to our annotation pool.
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
301 annotations.setTheme(theme);
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
302 if (aandf != null) {
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
303 annotations.setLabel(aandf.getFacetDescription());
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
304 }
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
305 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
306 log.error(
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
307 "Art/Facet for Annotations is null. " +
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
308 "This should never happen!");
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
309 }
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
310
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
311 if (visible) {
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
312 addAnnotations(annotations);
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
313 }
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
314 }
3245
dd3ddc8ecb14 Remove HYK references/code from ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3242
diff changeset
315
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
316
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
317 /**
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
318 * Generate chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
319 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
320 @Override
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
321 public void generate()
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
322 throws IOException
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
323 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
324 log.debug("ChartGenerator.generate");
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
325
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
326 JFreeChart chart = generateChart();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
327
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
328 String format = getFormat();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
329 int[] size = getSize();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
330
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
331 if (size == null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
332 size = getExportDimension();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
333 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
334
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
335 context.putContextValue("chart.width", size[0]);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
336 context.putContextValue("chart.height", size[1]);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
337
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
338 if (format.equals(ChartExportHelper.FORMAT_PNG)) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
339 context.putContextValue("chart.image.format", "png");
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
340
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
341 ChartExportHelper.exportImage(
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
342 out,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
343 chart,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
344 context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
345 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
346 else if (format.equals(ChartExportHelper.FORMAT_PDF)) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
347 preparePDFContext(context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
348
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
349 ChartExportHelper.exportPDF(
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
350 out,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
351 chart,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
352 context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
353 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
354 else if (format.equals(ChartExportHelper.FORMAT_SVG)) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
355 prepareSVGContext(context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
356
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
357 ChartExportHelper.exportSVG(
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
358 out,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
359 chart,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
360 context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
361 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
362 else if (format.equals(ChartExportHelper.FORMAT_CSV)) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
363 context.putContextValue("chart.image.format", "csv");
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
364
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
365 ChartExportHelper.exportCSV(
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
366 out,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
367 chart,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
368 context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
369 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
370 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
371
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
372
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
373 @Override
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
374 public void init(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
375 String outName,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
376 Document request,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
377 OutputStream out,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
378 CallContext context
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
379 ) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
380 log.debug("ChartGenerator.init");
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
381
7077
0a337f0005c2 Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7037
diff changeset
382 this.outName = outName;
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
383 this.request = request;
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
384 this.out = out;
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
385 this.context = context;
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
386 }
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
387
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
388
4589
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
389 /** Sets the master artifact. */
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
390 @Override
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
391 public void setMasterArtifact(Artifact master) {
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
392 this.master = master;
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
393 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
394
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
395
6422
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
396 /**
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
397 * Gets the master artifact.
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
398 * @return the master artifact.
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
399 */
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
400 public Artifact getMaster() {
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
401 return master;
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
402 }
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
403
cc96f7a9f9ef ChartGenerator: Added getter for master artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
404
4589
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
405 /** Sets the collection. */
2047
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
406 @Override
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
407 public void setCollection(D4EArtifactCollection collection) {
3422
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3409
diff changeset
408 this.collection = collection;
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3409
diff changeset
409 }
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3409
diff changeset
410
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3409
diff changeset
411
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3409
diff changeset
412 @Override
2047
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
413 public void setSettings(Settings settings) {
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
414 this.settings = settings;
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
415 }
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
416
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
417
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
418 /**
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
419 * Returns instance of <i>ChartSettings</i> with a chart specific section
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
420 * but with no axes settings.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
421 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
422 * @return an instance of <i>ChartSettings</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
423 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
424 @Override
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
425 public Settings getSettings() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
426 if (this.settings != null) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
427 return this.settings;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
428 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
429
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
430 ChartSettings settings = new ChartSettings();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
431
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
432 ChartSection chartSection = buildChartSection();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
433 LegendSection legendSection = buildLegendSection();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
434 ExportSection exportSection = buildExportSection();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
435
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
436 settings.setChartSection(chartSection);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
437 settings.setLegendSection(legendSection);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
438 settings.setExportSection(exportSection);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
439
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
440 List<AxisSection> axisSections = buildAxisSections();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
441 for (AxisSection axisSection: axisSections) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
442 settings.addAxisSection(axisSection);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
443 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
444
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
445 return settings;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
446 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
447
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
448
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
449 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
450 * Creates a new <i>ChartSection</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
451 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
452 * @return a new <i>ChartSection</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
453 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
454 protected ChartSection buildChartSection() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
455 ChartSection chartSection = new ChartSection();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
456 chartSection.setTitle(getChartTitle());
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
457 chartSection.setSubtitle(getChartSubtitle());
3613
dd6e25980c91 Fixed typo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3555
diff changeset
458 chartSection.setDisplayGrid(isGridVisible());
3615
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
459 chartSection.setDisplayLogo(showLogo());
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
460 chartSection.setLogoVPlacement(logoVPlace());
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
461 chartSection.setLogoHPlacement(logoHPlace());
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
462 return chartSection;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
463 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
464
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
465
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
466 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
467 * Creates a new <i>LegendSection</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
468 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
469 * @return a new <i>LegendSection</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
470 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
471 protected LegendSection buildLegendSection() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
472 LegendSection legendSection = new LegendSection();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
473 legendSection.setVisibility(isLegendVisible());
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
474 legendSection.setFontSize(getLegendFontSize());
3150
40147510e2d7 Initialize legend aggregation threshold.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3134
diff changeset
475 legendSection.setAggregationThreshold(10);
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
476 return legendSection;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
477 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
478
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
479
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
480 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
481 * Creates a new <i>ExportSection</i> with default values <b>WIDTH=600</b>
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
482 * and <b>HEIGHT=400</b>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
483 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
484 * @return a new <i>ExportSection</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
485 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
486 protected ExportSection buildExportSection() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
487 ExportSection exportSection = new ExportSection();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
488 exportSection.setWidth(600);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
489 exportSection.setHeight(400);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
490 return exportSection;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
491 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
492
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
493
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
494 /**
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
495 * Create list of Sections that contains all axes of the chart (including
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
496 * X and Y axes).
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
497 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
498 * @return a list of Sections for each axis in this chart.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
499 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
500 protected List<AxisSection> buildAxisSections() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
501 List<AxisSection> axisSections = new ArrayList<AxisSection>();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
502
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
503 axisSections.addAll(buildXAxisSections());
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
504 axisSections.addAll(buildYAxisSections());
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
505
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
506 return axisSections;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
507 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
508
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
509
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
510 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
511 * Creates a new Section for chart's X axis.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
512 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
513 * @return a List that contains a Section for the X axis.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
514 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
515 protected List<AxisSection> buildXAxisSections() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
516 List<AxisSection> axisSections = new ArrayList<AxisSection>();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
517
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
518 String identifier = "X";
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
519
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
520 AxisSection axisSection = new AxisSection();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
521 axisSection.setIdentifier(identifier);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
522 axisSection.setLabel(getXAxisLabel());
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
523 axisSection.setFontSize(14);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
524 axisSection.setFixed(false);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
525
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
526 // XXX We are able to find better default ranges that [0,0], but the Y
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
527 // axes currently have no better ranges set.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
528 axisSection.setUpperRange(0d);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
529 axisSection.setLowerRange(0d);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
530
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
531 axisSections.add(axisSection);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
532
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
533 return axisSections;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
534 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
535
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
536
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
537 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
538 * Creates a list of Section for the chart's Y axes. This method makes use
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
539 * of <i>getYAxisWalker</i> to be able to access all Y axes defined in
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
540 * subclasses.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
541 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
542 * @return a list of Y axis sections.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
543 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
544 protected List<AxisSection> buildYAxisSections() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
545 List<AxisSection> axisSections = new ArrayList<AxisSection>();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
546
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
547 YAxisWalker walker = getYAxisWalker();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
548 for (int i = 0, n = walker.length(); i < n; i++) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
549 AxisSection ySection = new AxisSection();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
550 ySection.setIdentifier(walker.getId(i));
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
551 ySection.setLabel(getYAxisLabel(i));
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
552 ySection.setFontSize(14);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
553 ySection.setFixed(false);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
554
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
555 // XXX We are able to find better default ranges that [0,0], the
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
556 // only problem is, that we do NOT have a better range than [0,0]
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
557 // for each axis, because the initial chart will not have a dataset
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
558 // for each axis set!
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
559 ySection.setUpperRange(0d);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
560 ySection.setLowerRange(0d);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
561
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
562 axisSections.add(ySection);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
563 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
564
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
565 return axisSections;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
566 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
567
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
568
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
569 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
570 * Returns the <i>settings</i> as <i>ChartSettings</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
571 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
572 * @return the <i>settings</i> as <i>ChartSettings</i> or null, if
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
573 * <i>settings</i> is not an instance of <i>ChartSettings</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
574 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
575 public ChartSettings getChartSettings() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
576 if (settings instanceof ChartSettings) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
577 return (ChartSettings) settings;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
578 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
579
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
580 return null;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
581 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
582
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
583
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
584 /**
2047
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
585 * Returns the chart title provided by <i>settings</i>.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
586 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
587 * @param settings A ChartSettings object.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
588 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
589 * @return the title provided by <i>settings</i> or null if no
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
590 * <i>ChartSection</i> is provided by <i>settings</i>.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
591 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
592 * @throws NullPointerException if <i>settings</i> is null.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
593 */
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
594 public String getChartTitle(ChartSettings settings) {
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
595 ChartSection cs = settings.getChartSection();
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
596 return cs != null ? cs.getTitle() : null;
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
597 }
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
598
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
599
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
600 /**
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
601 * Returns the chart subtitle provided by <i>settings</i>.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
602 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
603 * @param settings A ChartSettings object.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
604 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
605 * @return the subtitle provided by <i>settings</i> or null if no
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
606 * <i>ChartSection</i> is provided by <i>settings</i>.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
607 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
608 * @throws NullPointerException if <i>settings</i> is null.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
609 */
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
610 public String getChartSubtitle(ChartSettings settings) {
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
611 ChartSection cs = settings.getChartSection();
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
612 return cs != null ? cs.getSubtitle() : null;
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
613 }
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
614
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
615
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
616 /**
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
617 * Returns a boolean object that determines if the chart grid should be
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
618 * visible or not. This information needs to be provided by <i>settings</i>,
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
619 * otherweise the default is true.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
620 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
621 * @param settings A ChartSettings object.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
622 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
623 * @return true, if the chart grid should be visible otherwise false.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
624 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
625 * @throws NullPointerException if <i>settings</i> is null.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
626 */
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
627 public boolean isGridVisible(ChartSettings settings) {
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
628 ChartSection cs = settings.getChartSection();
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
629 Boolean displayGrid = cs.getDisplayGrid();
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
630
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
631 return displayGrid != null ? displayGrid : true;
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
632 }
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
633
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
634
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
635 /**
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
636 * Returns a boolean object that determines if the chart legend should be
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
637 * visible or not. This information needs to be provided by <i>settings</i>,
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
638 * otherwise the default is true.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
639 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
640 * @param settings A ChartSettings object.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
641 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
642 * @return true, if the chart legend should be visible otherwise false.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
643 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
644 * @throws NullPointerException if <i>settings</i> is null.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
645 */
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
646 public boolean isLegendVisible(ChartSettings settings) {
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
647 LegendSection ls = settings.getLegendSection();
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
648 Boolean displayLegend = ls.getVisibility();
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
649
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
650 return displayLegend != null ? displayLegend : true;
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
651 }
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
652
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
653
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
654 /**
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
655 * Returns the legend font size specified in <i>settings</i> or null if no
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
656 * <i>LegendSection</i> is provided by <i>settings</i>.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
657 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
658 * @param settings A ChartSettings object.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
659 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
660 * @return the legend font size or null.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
661 *
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
662 * @throws NullPointerException if <i>settings</i> is null.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
663 */
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
664 public Integer getLegendFontSize(ChartSettings settings) {
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
665 LegendSection ls = settings.getLegendSection();
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
666 return ls != null ? ls.getFontSize() : null;
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
667 }
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
668
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
669
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
670 /**
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
671 * Returns the title of a chart. The return value depends on the existence
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
672 * of ChartSettings: if there are ChartSettings set, this method returns the
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
673 * chart title provided by those settings. Otherwise, this method returns
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
674 * getDefaultChartTitle().
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
675 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
676 * @return the title of a chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
677 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
678 protected String getChartTitle() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
679 ChartSettings chartSettings = getChartSettings();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
680
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
681 if (chartSettings != null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
682 return getChartTitle(chartSettings);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
683 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
684
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
685 return getDefaultChartTitle();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
686 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
687
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
688
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
689 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
690 * Returns the subtitle of a chart. The return value depends on the
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
691 * existence of ChartSettings: if there are ChartSettings set, this method
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
692 * returns the chart title provided by those settings. Otherwise, this
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
693 * method returns getDefaultChartSubtitle().
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
694 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
695 * @return the subtitle of a chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
696 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
697 protected String getChartSubtitle() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
698 ChartSettings chartSettings = getChartSettings();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
699
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
700 if (chartSettings != null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
701 return getChartSubtitle(chartSettings);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
702 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
703
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
704 return getDefaultChartSubtitle();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
705 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
706
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
707
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
708 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
709 * This method always returns null. Override it in subclasses that require
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
710 * subtitles.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
711 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
712 * @return null.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
713 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
714 protected String getDefaultChartSubtitle() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
715 // Override this method in subclasses
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
716 return null;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
717 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
718
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
719
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
720 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
721 * This method is used to determine, if the chart's legend is visible or
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
722 * not. If a <i>settings</i> instance is set, this instance determines the
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
723 * visibility otherwise, this method returns true as default if no
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
724 * <i>settings</i> is set.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
725 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
726 * @return true, if the legend should be visible, otherwise false.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
727 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
728 protected boolean isLegendVisible() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
729 ChartSettings chartSettings = getChartSettings();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
730 if (chartSettings != null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
731 return isLegendVisible(chartSettings);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
732 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
733
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
734 return true;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
735 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
736
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
737
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
738 /** Where to place the logo. */
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
739 protected String logoHPlace() {
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
740 ChartSettings chartSettings = getChartSettings();
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
741 if (chartSettings != null) {
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
742 ChartSection cs = chartSettings.getChartSection();
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
743 String place = cs.getLogoHPlacement();
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
744
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
745 return place;
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
746 }
3639
695e8005e199 Default horizontal and vertical logo placement to top/center instead of 'none'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
747 return "center";
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
748 }
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
749
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
750
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
751 /** Where to place the logo. */
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
752 protected String logoVPlace() {
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
753 ChartSettings chartSettings = getChartSettings();
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
754 if (chartSettings != null) {
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
755 ChartSection cs = chartSettings.getChartSection();
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
756 String place = cs.getLogoVPlacement();
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
757
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
758 return place;
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
759 }
3639
695e8005e199 Default horizontal and vertical logo placement to top/center instead of 'none'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
760 return "top";
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
761 }
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
762
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
763
3615
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
764 /** Return the logo id from settings. */
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
765 protected String showLogo(ChartSettings chartSettings) {
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
766 if (chartSettings != null) {
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
767 ChartSection cs = chartSettings.getChartSection();
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
768 String logo = cs.getDisplayLogo();
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
769
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
770 return logo;
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
771 }
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3615
diff changeset
772 return "none";
3615
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
773 }
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
774
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
775
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
776 /**
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
777 * This method is used to determine if a logo should be added to the plot.
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
778 *
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
779 * @return logo name (null if none).
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
780 */
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
781 protected String showLogo() {
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
782 ChartSettings chartSettings = getChartSettings();
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
783 return showLogo(chartSettings);
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
784 }
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
785
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
786
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
787 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
788 * This method is used to determine the font size of the chart's legend. If
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
789 * a <i>settings</i> instance is set, this instance determines the font
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
790 * size, otherwise this method returns 12 as default if no <i>settings</i>
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
791 * is set or if it doesn't provide a legend font size.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
792 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
793 * @return a legend font size.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
794 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
795 protected int getLegendFontSize() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
796 Integer fontSize = null;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
797
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
798 ChartSettings chartSettings = getChartSettings();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
799 if (chartSettings != null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
800 fontSize = getLegendFontSize(chartSettings);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
801 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
802
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
803 return fontSize != null ? fontSize : DEFAULT_FONT_SIZE;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
804 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
805
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
806
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
807 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
808 * This method is used to determine if the resulting chart should display
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
809 * grid lines or not. <b>Note: this method always returns true!</b>
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
810 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
811 * @return true, if the chart should display grid lines, otherwise false.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
812 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
813 protected boolean isGridVisible() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
814 return true;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
815 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
816
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
817
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
818 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
819 * Returns the X-Axis label of a chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
820 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
821 * @return the X-Axis label of a chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
822 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
823 protected String getXAxisLabel() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
824 ChartSettings chartSettings = getChartSettings();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
825 if (chartSettings == null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
826 return getDefaultXAxisLabel();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
827 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
828
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
829 AxisSection as = chartSettings.getAxisSection("X");
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
830 if (as != null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
831 String label = as.getLabel();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
832
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
833 if (label != null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
834 return label;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
835 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
836 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
837
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
838 return getDefaultXAxisLabel();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
839 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
840
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
841
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
842 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
843 * This method returns the font size for the X axis. If the font size is
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
844 * specified in ChartSettings (if <i>chartSettings</i> is set), this size is
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
845 * returned. Otherwise the default font size 12 is returned.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
846 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
847 * @return the font size for the x axis.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
848 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
849 protected int getXAxisLabelFontSize() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
850 ChartSettings chartSettings = getChartSettings();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
851 if (chartSettings == null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
852 return DEFAULT_FONT_SIZE;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
853 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
854
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
855 AxisSection as = chartSettings.getAxisSection("X");
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
856 Integer fontSize = as.getFontSize();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
857
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
858 return fontSize != null ? fontSize : DEFAULT_FONT_SIZE;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
859 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
860
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
861
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
862 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
863 * This method returns the font size for an Y axis. If the font size is
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
864 * specified in ChartSettings (if <i>chartSettings</i> is set), this size is
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
865 * returned. Otherwise the default font size 12 is returned.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
866 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
867 * @return the font size for the x axis.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
868 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
869 protected int getYAxisFontSize(int pos) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
870 ChartSettings chartSettings = getChartSettings();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
871 if (chartSettings == null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
872 return DEFAULT_FONT_SIZE;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
873 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
874
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
875 YAxisWalker walker = getYAxisWalker();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
876
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
877 AxisSection as = chartSettings.getAxisSection(walker.getId(pos));
4376
3c8964855270 Avoid NullPointerExceptions if no settings are available
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4276
diff changeset
878 if (as == null) {
3c8964855270 Avoid NullPointerExceptions if no settings are available
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4276
diff changeset
879 return DEFAULT_FONT_SIZE;
3c8964855270 Avoid NullPointerExceptions if no settings are available
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4276
diff changeset
880 }
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
881 Integer fontSize = as.getFontSize();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
882
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
883 return fontSize != null ? fontSize : DEFAULT_FONT_SIZE;
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
884 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
885
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
886
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
887 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
888 * This method returns the export dimension specified in ChartSettings as
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
889 * int array [width,height].
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
890 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
891 * @return an int array with [width,height].
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
892 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
893 protected int[] getExportDimension() {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
894 ChartSettings chartSettings = getChartSettings();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
895 if (chartSettings == null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
896 return new int[] { 600, 400 };
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
897 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
898
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
899 ExportSection export = chartSettings.getExportSection();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
900 Integer width = export.getWidth();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
901 Integer height = export.getHeight();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
902
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
903 if (width != null && height != null) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
904 return new int[] { width, height };
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
905 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
906
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
907 return new int[] { 600, 400 };
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
908 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
909
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
910
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
911 /**
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
912 * Returns the Y-Axis label of a chart at position <i>pos</i>.
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
913 *
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
914 * @return the Y-Axis label of a chart at position <i>0</i>.
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
915 */
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
916 protected String getYAxisLabel(int pos) {
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
917 ChartSettings chartSettings = getChartSettings();
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
918 if (chartSettings == null) {
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
919 return getDefaultYAxisLabel(pos);
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
920 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
921
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
922 YAxisWalker walker = getYAxisWalker();
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
923 AxisSection as = chartSettings.getAxisSection(walker.getId(pos));
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
924 if (as != null) {
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
925 String label = as.getLabel();
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
926
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
927 if (label != null) {
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
928 return label;
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
929 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
930 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
931
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
932 return getDefaultYAxisLabel(pos);
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
933 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
934
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
935
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
936 /**
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
937 * This method searches for a specific axis in the <i>settings</i> if
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
938 * <i>settings</i> is set. If the axis was found, this method returns the
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
939 * specified axis range if the axis range is fixed. Otherwise, this method
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
940 * returns null.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
941 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
942 * @param axisId The identifier of an axis.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
943 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
944 * @return the specified axis range from <i>settings</i> if the axis is
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
945 * fixed, otherwise null.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
946 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
947 public Range getRangeForAxisFromSettings(String axisId) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
948 ChartSettings chartSettings = getChartSettings();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
949 if (chartSettings == null) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
950 return null;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
951 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
952
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
953 AxisSection as = chartSettings.getAxisSection(axisId);
4376
3c8964855270 Avoid NullPointerExceptions if no settings are available
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4276
diff changeset
954
3c8964855270 Avoid NullPointerExceptions if no settings are available
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4276
diff changeset
955 if (as == null) {
3c8964855270 Avoid NullPointerExceptions if no settings are available
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4276
diff changeset
956 return null;
3c8964855270 Avoid NullPointerExceptions if no settings are available
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4276
diff changeset
957 }
3c8964855270 Avoid NullPointerExceptions if no settings are available
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4276
diff changeset
958
7622
c9b82ffbb7dc Whistespace.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7087
diff changeset
959 Boolean fixed = as.isFixed();
c9b82ffbb7dc Whistespace.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7087
diff changeset
960
8455
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
961 if (fixed != null && fixed) {
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
962
8455
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
963 /* Only time series charts have time ranges so prefer those. */
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
964 if (axisId.equals("X")) {
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
965 Long lowerTime = as.getLowerTimeRange();
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
966 Long upperTime = as.getUpperTimeRange();
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
967 if ( lowerTime != null && upperTime != null ) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
968 log.debug("Using time range: "
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
969 + lowerTime + " - " + upperTime);
8455
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
970 return lowerTime < upperTime
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
971 ? new Range(lowerTime, upperTime)
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
972 : new Range(upperTime, lowerTime);
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
973 }
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
974 }
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8346
diff changeset
975
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
976 Double upper = as.getUpperRange();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
977 Double lower = as.getLowerRange();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
978
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
979 if (upper != null && lower != null) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
980 return lower < upper
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
981 ? new Range(lower, upper)
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
982 : new Range(upper, lower);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
983 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
984 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
985
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
986 return null;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
987 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
988
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
989
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
990 /**
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
991 * Adds a new AxisDataset which contains <i>dataset</i> at index <i>idx</i>.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
992 *
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
993 * @param dataset An XYDataset.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
994 * @param idx The axis index.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
995 * @param visible Determines, if the dataset should be visible or not.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
996 */
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
997 public void addAxisDataset(XYDataset dataset, int idx, boolean visible) {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
998 if (dataset == null || idx < 0) {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
999 return;
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1000 }
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1001
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1002 AxisDataset axisDataset = getAxisDataset(idx);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1003
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1004 Bounds[] xyBounds = ChartHelper.getBounds(dataset);
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1005
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1006 if (xyBounds == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1007 log.warn("Skip XYDataset for Axis (invalid ranges): " + idx);
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1008 return;
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1009 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1010
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1011 if (visible) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1012 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1013 log.debug("Add new AxisDataset at index: " + idx);
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1014 log.debug("X extent: " + xyBounds[0]);
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1015 log.debug("Y extent: " + xyBounds[1]);
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1016 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1017
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1018 axisDataset.addDataset(dataset);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1019 }
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1020
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1021 combineXBounds(xyBounds[0], 0);
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1022 combineYBounds(xyBounds[1], idx);
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1023 }
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1024
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1025
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1026 /**
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1027 * This method grants access to the AxisDatasets stored in <i>datasets</i>.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1028 * If no AxisDataset exists for index <i>idx</i>, a new AxisDataset is
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1029 * created using <i>createAxisDataset()</i>.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1030 *
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1031 * @param idx The index of the desired AxisDataset.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1032 *
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1033 * @return an existing or new AxisDataset.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1034 */
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1035 public AxisDataset getAxisDataset(int idx) {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1036 AxisDataset axisDataset = datasets.get(idx);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1037
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1038 if (axisDataset == null) {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1039 axisDataset = createAxisDataset(idx);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1040 datasets.put(idx, axisDataset);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1041 }
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1042
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1043 return axisDataset;
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1044 }
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1045
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1046
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1047 /**
2422
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1048 * Adjust some Stroke/Grid parameters for <i>plot</i>. The chart
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1049 * <i>Settings</i> are applied in this method.
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1050 *
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1051 * @param plot The XYPlot which is adapted.
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1052 */
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1053 protected void adjustPlot(XYPlot plot) {
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1054 Stroke gridStroke = new BasicStroke(
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1055 DEFAULT_GRID_LINE_WIDTH,
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1056 BasicStroke.CAP_BUTT,
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1057 BasicStroke.JOIN_MITER,
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1058 3.0f,
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1059 new float[] { 3.0f },
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1060 0.0f);
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1061
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1062 ChartSettings cs = getChartSettings();
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1063 boolean isGridVisible = cs != null ? isGridVisible(cs) : true;
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1064
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1065 plot.setDomainGridlineStroke(gridStroke);
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1066 plot.setDomainGridlinePaint(DEFAULT_GRID_COLOR);
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1067 plot.setDomainGridlinesVisible(isGridVisible);
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1068
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1069 plot.setRangeGridlineStroke(gridStroke);
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1070 plot.setRangeGridlinePaint(DEFAULT_GRID_COLOR);
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1071 plot.setRangeGridlinesVisible(isGridVisible);
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1072
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1073 plot.setAxisOffset(new RectangleInsets(0d, 0d, 0d, 0d));
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1074 }
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1075
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1076
44dc117aa2b7 Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
1077 /**
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1078 * This helper mehtod is used to extract the current locale from instance
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1079 * vairable <i>context</i>.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1080 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1081 * @return the current locale.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1082 */
1645
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1083 protected Locale getLocale() {
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1084 CallMeta meta = context.getMeta();
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1085 PreferredLocale[] prefs = meta.getLanguages();
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1086
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1087 int len = prefs != null ? prefs.length : 0;
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1088
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1089 Locale[] locales = new Locale[len];
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1090
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1091 for (int i = 0; i < len; i++) {
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1092 locales[i] = prefs[i].getLocale();
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1093 }
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1094
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1095 return meta.getPreferredLocale(locales);
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1096 }
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1097
4a8251eae217 Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1104
diff changeset
1098
4589
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1099 /**
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1100 * Look up \param key in i18n dictionary.
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1101 * @param key key for which to find i18nd version.
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1102 * @param def default, returned if lookup failed.
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1103 * @return value found in i18n dictionary, \param def if no value found.
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1104 */
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
1105 protected String msg(String key, String def) {
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
1106 return Resources.getMsg(context.getMeta(), key, def);
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
1107 }
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
1108
4589
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1109 /**
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1110 * Look up \param key in i18n dictionary.
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1111 * @param key key for which to find i18nd version.
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1112 * @return value found in i18n dictionary, key itself if failed.
afd817b006b7 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4444
diff changeset
1113 */
2407
dce0cc856357 'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2398
diff changeset
1114 protected String msg(String key) {
dce0cc856357 'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2398
diff changeset
1115 return Resources.getMsg(context.getMeta(), key, key);
dce0cc856357 'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2398
diff changeset
1116 }
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
1117
8248
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1118 protected String msg(String key, Object[] args) {
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1119 return Resources.getMsg(context.getMeta(), key, key, args);
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1120 }
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1121
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1122 protected String msg(String key, String def, Object[] args) {
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1123 return Resources.getMsg(context.getMeta(), key, def, args);
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1124 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1125
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1126
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1127 protected String getRiverName() {
8248
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1128 return new RiverAccess((D4EArtifact)master).getRiver().getName();
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1129 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1130
8248
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1131 protected String getRiverUnit() {
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1132 return new RiverAccess((D4EArtifact)master).getRiver()
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1133 .getWstUnit().getName();
2b0ff11cef3f Fix duration curve i18n.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1134 }
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1135
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1136 protected double[] getRange() {
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
1137 D4EArtifact flys = (D4EArtifact) master;
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1138
6101
a0078e5e3b39 Removed unused context from RangeAccess and subclasses leading to some dead code removal.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
1139 RangeAccess rangeAccess = new RangeAccess(flys);
4858
56fbdcdb7ff2 ChartGenerator, DurationCurveExporter: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4589
diff changeset
1140 return rangeAccess.getKmRange();
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1141 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1142
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
1143
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1144 /**
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1145 * Returns the size of a chart export as array which has been specified by
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1146 * the incoming request document.
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1147 *
2057
49b7c2b1a6a7 Make use of the export size for charts specified in ChartSettings if a chart export is requested.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2047
diff changeset
1148 * @return the size of a chart as [width, height] or null if no width or
49b7c2b1a6a7 Make use of the export size for charts specified in ChartSettings if a chart export is requested.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2047
diff changeset
1149 * height are given in the request document.
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1150 */
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1151 protected int[] getSize() {
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1152 int[] size = new int[2];
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1153
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1154 Element sizeEl = (Element)XMLUtils.xpath(
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1155 request,
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1156 XPATH_CHART_SIZE,
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1157 XPathConstants.NODE,
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1158 ArtifactNamespaceContext.INSTANCE);
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1159
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1160 if (sizeEl != null) {
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1161 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1162
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1163 String w = sizeEl.getAttributeNS(uri, "width");
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1164 String h = sizeEl.getAttributeNS(uri, "height");
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1165
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1166 if (w.length() > 0 && h.length() > 0) {
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1167 try {
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1168 size[0] = Integer.parseInt(w);
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1169 size[1] = Integer.parseInt(h);
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1170 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1171 catch (NumberFormatException nfe) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1172 log.warn("Wrong values for chart width/height.");
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1173 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1174 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1175 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1176
2057
49b7c2b1a6a7 Make use of the export size for charts specified in ChartSettings if a chart export is requested.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2047
diff changeset
1177 return size[0] > 0 && size[1] > 0 ? size : null;
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1178 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1179
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1180
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1181 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1182 * This method returns the format specified in the <i>request</i> document
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1183 * or <i>DEFAULT_CHART_FORMAT</i> if no format is specified in
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1184 * <i>request</i>.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1185 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1186 * @return the format used to export this chart.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1187 */
1735
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1188 protected String getFormat() {
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1189 String format = (String) XMLUtils.xpath(
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1190 request,
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1191 XPATH_CHART_FORMAT,
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1192 XPathConstants.STRING,
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1193 ArtifactNamespaceContext.INSTANCE);
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1194
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1195 return format == null || format.length() == 0
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1196 ? DEFAULT_CHART_FORMAT
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1197 : format;
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1198 }
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1199
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1200
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
1201 /**
2395
cd4fb19ab892 Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2321
diff changeset
1202 * Returns the X-Axis range as String array from request document.
4276
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
1203 * If the (x|y)range elements are not found in request document, return
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
1204 * null (i.e. not zoomed).
2395
cd4fb19ab892 Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2321
diff changeset
1205 *
4276
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
1206 * @return a String array with [lower, upper], null if not in document.
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
1207 */
2395
cd4fb19ab892 Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2321
diff changeset
1208 protected String[] getDomainAxisRangeFromRequest() {
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1209 Element xrange = (Element)XMLUtils.xpath(
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1210 request,
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1211 XPATH_CHART_X_RANGE,
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1212 XPathConstants.NODE,
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1213 ArtifactNamespaceContext.INSTANCE);
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1214
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1215 if (xrange == null) {
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1216 return null;
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1217 }
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1218
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1219 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1220
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1221 String lower = xrange.getAttributeNS(uri, "from");
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1222 String upper = xrange.getAttributeNS(uri, "to");
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1223
2395
cd4fb19ab892 Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2321
diff changeset
1224 return new String[] { lower, upper };
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1225 }
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1226
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1227
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
1228 /** Returns null if the (x|y)range-element was not found in
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
1229 * request document.
4276
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
1230 * This usally means that the axis are not manually zoomed, i.e. showing
0aa42c9d58e9 Documentation in ChartGenerator added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4236
diff changeset
1231 * full data extent. */
2398
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
1232 protected String[] getValueAxisRangeFromRequest() {
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1233 Element yrange = (Element)XMLUtils.xpath(
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1234 request,
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1235 XPATH_CHART_Y_RANGE,
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1236 XPathConstants.NODE,
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1237 ArtifactNamespaceContext.INSTANCE);
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1238
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1239 if (yrange == null) {
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1240 return null;
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1241 }
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1242
4433
5b8919ef601d Backed out changeset e8a4d2fd25cc
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4432
diff changeset
1243
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1244 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1245
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1246 String lower = yrange.getAttributeNS(uri, "from");
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1247 String upper = yrange.getAttributeNS(uri, "to");
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1248
2398
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
1249 return new String[] { lower, upper };
652
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1250 }
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1251
8fa4c5c9cd1a Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 423
diff changeset
1252
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1253 /**
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1254 * Returns the default size of a chart export as array.
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1255 *
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1256 * @return the default size of a chart as [width, height].
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1257 */
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1258 protected int[] getDefaultSize() {
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1259 return new int[] { DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT };
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1260 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1261
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1262
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
1263 /**
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1264 * Add datasets stored in instance variable <i>datasets</i> to plot.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1265 * <i>datasets</i> actually stores instances of AxisDataset, so each of this
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1266 * datasets is mapped to a specific axis as well.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1267 *
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1268 * @param plot plot to add datasets to.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1269 */
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1270 protected void addDatasets(XYPlot plot) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1271 log.debug("addDatasets()");
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
1272
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1273 // AxisDatasets are sorted, but some might be empty.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1274 // Thus, generate numbering on the fly.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1275 int axisIndex = 0;
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1276 int datasetIndex = 0;
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1277
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1278 for (Map.Entry<Integer, AxisDataset> entry: datasets.entrySet()) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1279 if (!entry.getValue().isEmpty()) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1280 // Add axis and range information.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1281 AxisDataset axisDataset = entry.getValue();
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3150
diff changeset
1282 NumberAxis axis = createYAxis(entry.getKey());
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1283
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1284 plot.setRangeAxis(axisIndex, axis);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1285
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1286 if (axis.getAutoRangeIncludesZero()) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1287 axisDataset.setRange(
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1288 Range.expandToInclude(axisDataset.getRange(), 0d));
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1289 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1290
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
1291 setYBounds(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
1292 axisIndex, expandPointRange(axisDataset.getRange()));
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1293
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1294 // Add contained datasets, mapping to axis.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1295 for (XYDataset dataset: axisDataset.getDatasets()) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1296 plot.setDataset(datasetIndex, dataset);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1297 plot.mapDatasetToRangeAxis(datasetIndex, axisIndex);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1298
2677
57d6670ddda3 Minimal cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2590
diff changeset
1299 applyThemes(plot, dataset,
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1300 datasetIndex,
2677
57d6670ddda3 Minimal cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2590
diff changeset
1301 axisDataset.isArea(dataset));
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1302
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1303 datasetIndex++;
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1304 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1305
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1306 axisDataset.setPlotAxisIndex(axisIndex);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1307 axisIndex++;
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1308 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1309 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1310 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1311
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1312
2677
57d6670ddda3 Minimal cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2590
diff changeset
1313 /**
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1314 * @param idx "index" of dataset/series (first dataset to be drawn has
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1315 * index 0), correlates with renderer index.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1316 * @param isArea true if the series describes an area and shall be rendered
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1317 * as such.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1318 */
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1319 protected void applyThemes(
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1320 XYPlot plot,
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1321 XYDataset series,
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1322 int idx,
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1323 boolean isArea
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1324 ) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1325 if (isArea) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1326 applyAreaTheme(plot, (StyledAreaSeriesCollection) series, idx);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1327 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1328 else {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1329 applyLineTheme(plot, series, idx);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1330 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1331 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1332
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1333
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1334 /**
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1335 * This method applies the themes defined in the series itself. Therefore,
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1336 * <i>StyledXYSeries.applyTheme()</i> is called, which modifies the renderer
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1337 * for the series.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1338 *
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1339 * @param plot The plot.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1340 * @param dataset The XYDataset which needs to support Series objects.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1341 * @param idx The index of the renderer / dataset.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1342 */
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1343 protected void applyLineTheme(XYPlot plot, XYDataset dataset, int idx) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1344 log.debug("Apply LineTheme for dataset at index: " + idx);
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1345
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1346 LegendItemCollection lic = new LegendItemCollection();
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1347 LegendItemCollection anno = plot.getFixedLegendItems();
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1348
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1349 Font legendFont = createLegendLabelFont();
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1350
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1351 XYLineAndShapeRenderer renderer = createRenderer(plot, idx);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1352
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1353 for (int s = 0, num = dataset.getSeriesCount(); s < num; s++) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1354 Series series = getSeriesOf(dataset, s);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1355
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1356 if (series instanceof StyledSeries) {
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1357 Style style = ((StyledSeries) series).getStyle();
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1358 style.applyTheme(renderer, s);
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1359 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1360
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1361 // special case: if there is just one single item, we need to enable
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1362 // points for this series, otherwise we would not see anything in
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1363 // the chart area.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1364 if (series.getItemCount() == 1) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1365 renderer.setSeriesShapesVisible(s, true);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1366 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1367
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1368 LegendItem legendItem = renderer.getLegendItem(idx, s);
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3167
diff changeset
1369 if (legendItem.getLabel().endsWith(" ") ||
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3167
diff changeset
1370 legendItem.getLabel().endsWith("interpol")) {
3134
5a0aef74c316 Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3088
diff changeset
1371 legendItem = null;
5a0aef74c316 Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3088
diff changeset
1372 }
3167
6f1a102ec14a Do not add entries ending with " " to legend.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
1373
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1374 if (legendItem != null) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1375 legendItem.setLabelFont(legendFont);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1376 lic.add(legendItem);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1377 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1378 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1379 log.warn("Could not get LegentItem for renderer: "
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1380 + idx + ", series-idx " + s);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1381 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1382 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1383
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1384 if (anno != null) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1385 lic.addAll(anno);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1386 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1387
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1388 plot.setFixedLegendItems(lic);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1389
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1390 plot.setRenderer(idx, renderer);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1391 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1392
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1393
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1394 /**
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1395 * @param plot The plot.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1396 * @param area A StyledAreaSeriesCollection object.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1397 * @param idx The index of the dataset.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1398 */
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1399 protected void applyAreaTheme(
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1400 XYPlot plot,
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1401 StyledAreaSeriesCollection area,
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1402 int idx
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1403 ) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1404 LegendItemCollection lic = new LegendItemCollection();
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1405 LegendItemCollection anno = plot.getFixedLegendItems();
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1406
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1407 Font legendFont = createLegendLabelFont();
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1408
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1409 log.debug("Registering an 'area'renderer at idx: " + idx);
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1410
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1411 StableXYDifferenceRenderer dRenderer =
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1412 new StableXYDifferenceRenderer();
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1413
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1414 if (area.getMode() == StyledAreaSeriesCollection.FILL_MODE.UNDER) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1415 dRenderer.setPositivePaint(createTransparentPaint());
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1416 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1417
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1418 plot.setRenderer(idx, dRenderer);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1419
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1420 area.applyTheme(dRenderer);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1421
3785
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3639
diff changeset
1422 // i18n
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
1423 dRenderer.setAreaLabelNumberFormat(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
1424 Formatter.getFormatter(context.getMeta(), 2, 4));
3785
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3639
diff changeset
1425
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3639
diff changeset
1426 dRenderer.setAreaLabelTemplate(Resources.getMsg(
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3639
diff changeset
1427 context.getMeta(), "area.label.template", "Area=%sm2"));
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3639
diff changeset
1428
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1429 LegendItem legendItem = dRenderer.getLegendItem(idx, 0);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1430 if (legendItem != null) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1431 legendItem.setLabelFont(legendFont);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1432 lic.add(legendItem);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1433 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1434 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1435 log.warn("Could not get LegentItem for renderer: "
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1436 + idx + ", series-idx " + 0);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1437 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1438
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1439 if (anno != null) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1440 lic.addAll(anno);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1441 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1442
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1443 plot.setFixedLegendItems(lic);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1444 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1445
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1446
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1447 /**
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1448 * Expands a given range if it collapses into one point.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1449 *
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3257
diff changeset
1450 * @param range Range to be expanded if upper == lower bound.
3248
4eb91fb1e73e Fix weird code with help of new ChartHelper.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3245
diff changeset
1451 *
4eb91fb1e73e Fix weird code with help of new ChartHelper.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3245
diff changeset
1452 * @return Bounds of point plus 5 percent in each direction.
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1453 */
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1454 private Bounds expandPointRange(Range range) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1455 if (range == null) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1456 return null;
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1457 }
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1458 else if (range.getLowerBound() == range.getUpperBound()) {
3248
4eb91fb1e73e Fix weird code with help of new ChartHelper.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3245
diff changeset
1459 Range expandedRange = ChartHelper.expandRange(range, 5d);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
1460 return new DoubleBounds(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
1461 expandedRange.getLowerBound(), expandedRange.getUpperBound());
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1462 }
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1463
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2422
diff changeset
1464 return new DoubleBounds(range.getLowerBound(), range.getUpperBound());
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1465 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1466
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1467
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1468 /**
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1469 * Creates a new instance of EnhancedLineAndShapeRenderer.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1470 *
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1471 * @param plot The plot which is set for the new renderer.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1472 * @param idx This value is not used in the current implementation.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1473 *
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1474 * @return a new instance of EnhancedLineAndShapeRenderer.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1475 */
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1476 protected XYLineAndShapeRenderer createRenderer(XYPlot plot, int idx) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7622
diff changeset
1477 log.debug("Create EnhancedLineAndShapeRenderer for idx: " + idx);
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1478
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1479 EnhancedLineAndShapeRenderer r =
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1480 new EnhancedLineAndShapeRenderer(true, false);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1481
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1482 r.setPlot(plot);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1483
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1484 return r;
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1485 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1486
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1487
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1488 /**
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1489 * Creates a new instance of <i>IdentifiableNumberAxis</i>.
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1490 *
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1491 * @param idx The index of the new axis.
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1492 * @param label The label of the new axis.
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1493 *
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1494 * @return an instance of IdentifiableNumberAxis.
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1495 */
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1496 protected NumberAxis createNumberAxis(int idx, String label) {
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1497 YAxisWalker walker = getYAxisWalker();
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1498
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1499 return new IdentifiableNumberAxis(walker.getId(idx), label);
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1500 }
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1501
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1502
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1503 /**
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1504 * Create Y (range) axis for given index.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1505 * Shall be overriden by subclasses.
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1506 */
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1507 protected NumberAxis createYAxis(int index) {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1508 YAxisWalker walker = getYAxisWalker();
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1509
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1510 Font labelFont = new Font(
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1511 DEFAULT_FONT_NAME,
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1512 Font.BOLD,
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1513 getYAxisFontSize(index));
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1514
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1515 IdentifiableNumberAxis axis = new IdentifiableNumberAxis(
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1516 walker.getId(index),
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1517 getYAxisLabel(index));
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1518
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1519 axis.setAutoRangeIncludesZero(false);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1520 axis.setLabelFont(labelFont);
2590
d75b427da50a #522 Modified axes creation: label and tick label fonts will now always be the same.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
1521 axis.setTickLabelFont(labelFont);
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1522
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1523 return axis;
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1524 }
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1525
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1526
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
1527 /**
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1528 * Creates a new LegendItem with <i>name</i> and font provided by
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1529 * <i>createLegendLabelFont()</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1530 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1531 * @param theme The theme of the chart line.
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3257
diff changeset
1532 * @param name The displayed name of the item.
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1533 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1534 * @return a new LegendItem instance.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1535 */
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6900
diff changeset
1536 public LegendItem createLegendItem(ThemeDocument theme, String name) {
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1537 // OPTIMIZE Pass font, parsed Theme items.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1538
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
1539 Color color = theme.parseLineColorField();
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
1540 if (color == null) {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
1541 color = Color.BLACK;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
1542 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
1543
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1544 LegendItem legendItem = new LegendItem(name, color);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1545
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1546 legendItem.setLabelFont(createLegendLabelFont());
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1547 return legendItem;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1548 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1549
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1550
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1551 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1552 * Creates Font (Family and size) to use when creating Legend Items. The
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1553 * font size depends in the return value of <i>getLegendFontSize()</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1554 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1555 * @return a new Font instance with <i>DEFAULT_FONT_NAME</i>.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1556 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1557 protected Font createLegendLabelFont() {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1558 return new Font(
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1559 DEFAULT_FONT_NAME,
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1560 Font.PLAIN,
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1561 getLegendFontSize()
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1562 );
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1563 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1564
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1565
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1566 /**
3184
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1567 * Create new legend entries, dependent on settings.
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1568 * @param plot The plot for which to modify the legend.
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1569 */
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1570 public void aggregateLegendEntries(XYPlot plot) {
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1571 int AGGR_THRESHOLD = 0;
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1572
3296
45af081061e7 Added overview output for sq relation. Currently the overview generator is
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3284
diff changeset
1573 if (getChartSettings() == null) {
45af081061e7 Added overview output for sq relation. Currently the overview generator is
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3284
diff changeset
1574 return;
45af081061e7 Added overview output for sq relation. Currently the overview generator is
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3284
diff changeset
1575 }
3184
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1576 Integer threshold = getChartSettings().getLegendSection()
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1577 .getAggregationThreshold();
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1578
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1579 AGGR_THRESHOLD = (threshold != null) ? threshold.intValue() : 0;
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1580
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1581 LegendProcessor.aggregateLegendEntries(plot, AGGR_THRESHOLD);
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1582 }
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1583
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1584
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1585 /**
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1586 * Returns a transparently textured paint.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1587 *
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1588 * @return a transparently textured paint.
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1589 */
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1590 protected static Paint createTransparentPaint() {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1591 // TODO why not use a transparent color?
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1592 BufferedImage texture = new BufferedImage(
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1593 1, 1, BufferedImage.TYPE_4BYTE_ABGR);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1594
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1595 return new TexturePaint(
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1596 texture, new Rectangle2D.Double(0d, 0d, 0d, 0d));
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1597 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1598
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
1599
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1600 protected void preparePDFContext(CallContext context) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1601 int[] dimension = getExportDimension();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1602
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1603 context.putContextValue("chart.width", dimension[0]);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1604 context.putContextValue("chart.height", dimension[1]);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1605 context.putContextValue("chart.marginLeft", 5f);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1606 context.putContextValue("chart.marginRight", 5f);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1607 context.putContextValue("chart.marginTop", 5f);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1608 context.putContextValue("chart.marginBottom", 5f);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1609 context.putContextValue(
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1610 "chart.page.format",
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1611 ChartExportHelper.DEFAULT_PAGE_SIZE);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1612 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1613
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1614
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1615 protected void prepareSVGContext(CallContext context) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1616 int[] dimension = getExportDimension();
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1617
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1618 context.putContextValue("chart.width", dimension[0]);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1619 context.putContextValue("chart.height", dimension[1]);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1620 context.putContextValue(
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1621 "chart.encoding",
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1622 ChartExportHelper.DEFAULT_ENCODING);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1623 }
4444
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1624
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1625 /**
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1626 * Retuns the call context. May be null if init hasn't been called yet.
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1627 *
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1628 * @return the CallContext instance
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1629 */
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1630 public CallContext getCallContext() {
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1631 return context;
47d50572844a Add method to a access the CallContext of a ChartGenerator
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1632 }
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1633 }
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1634 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org