annotate flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 3212:abc2db630815

Work in generalized annotations for chart generators flys-artifacts/trunk@4835 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Fri, 29 Jun 2012 12:35:06 +0000
parents 12440c6b8b66
children ed07dd55f487
rev   line source
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
1 package de.intevation.flys.exports;
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
2
2553
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
3 import java.awt.BasicStroke;
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
4 import java.awt.Color;
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
5 import java.awt.Font;
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
6 import java.awt.Paint;
2553
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
7 import java.awt.Stroke;
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
8 import java.awt.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
9 import java.awt.geom.Rectangle2D;
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
10 import java.awt.image.BufferedImage;
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
11
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
12 import java.io.IOException;
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
13 import java.io.OutputStream;
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
14
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
15 import java.util.ArrayList;
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
16 import java.util.List;
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
17 import java.util.Locale;
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
18 import java.util.Map;
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
19 import java.util.TreeMap;
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
20 import java.util.SortedMap;
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
21
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
22 import javax.xml.xpath.XPathConstants;
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
23
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
24 import org.apache.log4j.Logger;
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
25
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
26 import org.w3c.dom.Document;
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
27 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
28
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
29 import org.jfree.chart.JFreeChart;
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
30 import org.jfree.chart.LegendItem;
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
31 import org.jfree.chart.LegendItemCollection;
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
32 import org.jfree.chart.axis.NumberAxis;
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
33 import org.jfree.chart.plot.XYPlot;
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
34 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
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
35 import org.jfree.data.Range;
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
36 import org.jfree.data.general.Series;
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
37 import org.jfree.data.xy.XYDataset;
2553
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
38 import org.jfree.ui.RectangleInsets;
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
39
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
40 import de.intevation.artifacts.Artifact;
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
41 import de.intevation.artifacts.CallContext;
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
42 import de.intevation.artifacts.CallMeta;
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
43 import de.intevation.artifacts.PreferredLocale;
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
44
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
45 import de.intevation.artifacts.ArtifactNamespaceContext;
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
46 import de.intevation.artifacts.common.utils.XMLUtils;
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
47
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
48 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
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
49 import de.intevation.artifactdatabase.state.Settings;
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
50
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
51 import de.intevation.flys.model.River;
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
52
2132
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2057
diff changeset
53 import de.intevation.flys.artifacts.FLYSArtifact;
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
54 import de.intevation.flys.artifacts.resources.Resources;
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
55 import de.intevation.flys.jfree.Bounds;
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
56 import de.intevation.flys.jfree.DoubleBounds;
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
57 import de.intevation.flys.jfree.EnhancedLineAndShapeRenderer;
3212
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
58 import de.intevation.flys.jfree.FLYSAnnotation;
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
59 import de.intevation.flys.jfree.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
60 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
61 import de.intevation.flys.jfree.Style;
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
62 import de.intevation.flys.jfree.StyledSeries;
1095
f465785ed1ae Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1055
diff changeset
63 import de.intevation.flys.utils.FLYSUtils;
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
64 import de.intevation.flys.utils.ThemeAccess;
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
65
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
66
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
67 /**
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
68 * 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
69 * 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
70 *
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 * @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
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 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
74
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 private static Logger logger = Logger.getLogger(ChartGenerator.class);
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
76
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
77 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
78 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
79 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
80 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
81 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
82 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
83 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
84
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
85
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
86 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
87 "/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
88
1735
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
89 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
90 "/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
91
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
92 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
93 "/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
94
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
95 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
96 "/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
97
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
98
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
99 /** 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
100 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
101
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
102 /** 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
103 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
104
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
105 /** 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
106 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
107
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
108 /** The artifact that is used to decorate the chart with meta information.*/
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
109 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
110
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
111 /** 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
112 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
113
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
114 /** 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
115 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
116
3212
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
117 /** List of annotations to insert in plot. */
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
118 protected List<FLYSAnnotation> annotations;
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
119
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
120 /**
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
121 * 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
122 * 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
123 */
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
124 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
125
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
126 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
127
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
128 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
129 } // 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
130
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
131
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
132
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
133 public interface 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
134
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
135 void addDataset(XYDataset 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
136
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
137 XYDataset[] 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
138
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
139 boolean isEmpty();
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
140
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
141 void setRange(Range range);
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
142
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
143 Range getRange();
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
144
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
145 boolean isArea(XYDataset 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
146
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
147 void setPlotAxisIndex(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
148
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
149 int getPlotAxisIndex();
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
150
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
151 } // end of AxisDataset 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
152
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
153
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
154
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
155 /**
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
156 * 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
157 */
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
158 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
159 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
160 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
161
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
162
3212
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
163 /**
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
164 * 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
165 */
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
166 public void addAnnotations(FLYSAnnotation annotation) {
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
167 if (annotations == null) {
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
168 annotations = new ArrayList<FLYSAnnotation>();
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
169 }
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
170
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
171 annotations.add(annotation);
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
172 }
abc2db630815 Work in generalized annotations for chart generators
Christian Lins <christian.lins@intevation.de>
parents: 3184
diff changeset
173
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
174
2234
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 * 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
177 * 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
178 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
179 * @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
180 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
181 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
182
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
183
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
184 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
185 ArtifactAndFacet bundle,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
186 Document attr,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
187 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
188
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
189
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
190 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
191
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
192
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
193 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
194
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
195 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
196 * 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
197 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
198 * @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
199 */
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
200 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
201
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
202
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
203 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
204 * 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
205 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
206 * @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
207 */
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
208 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
209
2234
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 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
212 * 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
213 * 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 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
215 * @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
216 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
217 * @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
218 */
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
219 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
220
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
221
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
222 /**
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
223 * 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
224 * 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
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 * @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
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 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
229
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
230
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 /**
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 * 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
233 *
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
234 * @param range A new range.
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
235 * @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
236 * <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
237 */
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
238 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: 2553
diff changeset
239
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
240
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
241 /**
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
242 * 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: 2553
diff changeset
243 *
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
244 * @param range A new range.
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
245 * @param idx The index of the Y axis that should be comined with
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
246 * <i>range</i>.
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
247 */
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
248 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
249
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
250
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
251 /**
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
252 * 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
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 * @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
255 *
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
256 * @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
257 */
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
258 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
259
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
260 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
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 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
263
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
264 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
265
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
266 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
267
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
268
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
269 /**
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
270 * This method should be used by concrete subclasses to add subtitle to
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
271 * <i>chart</i>. <b>The method in this implementation is empty</b>.
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) {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
276 // do nothing
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
277 }
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
278
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
279
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
280 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
281 * 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
282 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
283 @Override
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
284 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
285 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
286 {
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
287 logger.debug("ChartGenerator.generate");
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
288
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
289 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
290
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
291 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
292 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
293
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
294 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
295 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
296 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
297
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
298 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
299 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
300
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
301 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
302 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
303
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
304 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
305 out,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
306 chart,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
307 context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
308 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
309 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
310 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
311
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
312 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
313 out,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
314 chart,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
315 context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
316 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
317 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
318 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
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 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
321 out,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
322 chart,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
323 context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
324 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
325 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
326 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
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 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
329 out,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
330 chart,
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
331 context);
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
332 }
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
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
336 @Override
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
337 public void init(Document request, OutputStream out, 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
338 logger.debug("ChartGenerator.init");
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
339
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
340 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
341 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
342 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
343 }
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
344
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
345
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
346 @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
347 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
348 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
349 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
350
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
351
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
352 @Override
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
353 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
354 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
355 }
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
356
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
357
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
358 /**
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
359 * Returns an instance of <i>ChartSettings</i> with a chart specific section
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
360 * 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
361 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
362 * @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
363 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
364 @Override
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
365 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
366 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
367 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
368 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
369
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
370 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
371
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
372 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
373 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
374 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
375
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
376 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
377 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
378 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
379
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
380 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
381 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
382 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
383 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
384
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
385 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
386 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
387
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
388
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
389 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
390 * 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
391 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
392 * @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
393 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
394 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
395 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
396 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
397 chartSection.setSubtitle(getChartSubtitle());
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
398 chartSection.setDisplayGird(isGridVisible());
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
399 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
400 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
401
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
402
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
403 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
404 * 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
405 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
406 * @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
407 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
408 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
409 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
410 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
411 legendSection.setFontSize(getLegendFontSize());
3150
40147510e2d7 Initialize legend aggregation threshold.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3134
diff changeset
412 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
413 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
414 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
415
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
416
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
417 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
418 * 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
419 * 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
420 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
421 * @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
422 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
423 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
424 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
425 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
426 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
427 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
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
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 * Creates a list of Sections that contains all axes of the chart (including
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
433 * 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
434 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
435 * @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
436 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
437 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
438 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
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 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
441 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
442
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
443 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
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
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 * 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
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 * @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
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 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
453 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
454
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
455 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
456
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
457 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
458 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
459 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
460 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
461 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
462
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
463 // 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
464 // 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
465 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
466 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
467
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
468 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
469
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
470 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
471 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
472
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
473
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
474 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
475 * 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
476 * 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
477 * subclasses.
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 * @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
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 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
482 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
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 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
485 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
486 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
487 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
488 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
489 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
490 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
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 // 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
493 // 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
494 // 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
495 // 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
496 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
497 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
498
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
499 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
500 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
501
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
502 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
503 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
504
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 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
507 * 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
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 * @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
510 * <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
511 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
512 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
513 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
514 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
515 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
516
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
517 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
518 }
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
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
521 /**
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
522 * 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
523 *
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
524 * @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
525 *
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
526 * @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
527 * <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
528 *
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
529 * @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
530 */
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
531 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
532 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
533 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
534 }
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
535
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
536
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
537 /**
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
538 * 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
539 *
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
540 * @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
541 *
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
542 * @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
543 * <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
544 *
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
545 * @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
546 */
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
547 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
548 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
549 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
550 }
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
551
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
552
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
553 /**
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
554 * 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
555 * 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
556 * 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
557 *
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
558 * @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
559 *
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
560 * @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
561 *
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
562 * @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
563 */
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
564 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
565 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
566 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
567
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
568 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
569 }
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
570
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
571
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
572 /**
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
573 * 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
574 * 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
575 * 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
576 *
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
577 * @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
578 *
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
579 * @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
580 *
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
581 * @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
582 */
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
583 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
584 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
585 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
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 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
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
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
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 * 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
593 * <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
594 *
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 * @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
596 *
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 * @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
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 * @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
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 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
602 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
603 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
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
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
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
607 /**
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
608 * 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
609 * 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
610 * 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
611 * getDefaultChartTitle().
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
612 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
613 * @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
614 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
615 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
616 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
617
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
618 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
619 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
620 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
621
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
622 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
623 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
624
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
625
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
626 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
627 * 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
628 * 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
629 * 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
630 * 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
631 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
632 * @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
633 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
634 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
635 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
636
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
637 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
638 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
639 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
640
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
641 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
642 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
643
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
644
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
645 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
646 * 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
647 * subtitles.
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
648 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
649 * @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
650 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
651 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
652 // 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
653 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
654 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
655
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
656
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
657 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
658 * 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
659 * 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
660 * 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
661 * <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
662 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
663 * @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
664 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
665 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
666 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
667 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
668 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
669 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
670
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
671 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
672 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
673
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
674
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 * 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
677 * 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
678 * 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
679 * 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
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 * @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
682 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
683 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
684 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
685
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
686 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
687 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
688 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
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
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
691 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
692 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
693
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 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
696 * 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
697 * 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
698 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
699 * @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
700 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
701 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
702 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
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
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 * 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
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 * @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
710 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
711 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
712 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
713 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
714 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
715 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
716
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
717 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
718 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
719 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
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 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
722 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
723 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
724 }
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 getDefaultXAxisLabel();
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
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
729
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
730 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
731 * 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
732 * 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
733 * 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
734 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
735 * @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
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 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
738 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
739 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
740 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
741 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
742
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
743 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
744 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
745
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
746 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
747 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
748
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
749
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
750 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
751 * 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
752 * 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
753 * 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
754 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
755 * @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
756 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
757 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
758 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
759 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
760 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
761 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
762
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
763 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
764
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
765 AxisSection as = chartSettings.getAxisSection(walker.getId(pos));
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
766 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
767
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
768 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
769 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
770
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
771
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
772 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
773 * 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
774 * 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
775 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
776 * @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
777 */
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
778 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
779 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
780 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
781 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
782 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
783
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
784 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
785 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
786 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
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 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
789 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
790 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
791
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
792 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
793 }
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
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
796 /**
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
797 * 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
798 *
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
799 * @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
800 */
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
801 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
802 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
803 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
804 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
805 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
806
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
807 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
808 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
809 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
810 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
811
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
812 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
813 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
814 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
815 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
816
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
817 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
818 }
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
819
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
820
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
821 /**
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
822 * 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
823 * <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
824 * 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
825 * 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
826 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
827 * @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
828 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
829 * @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
830 * 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
831 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
832 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
833 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
834 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
835 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
836 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
837
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
838 AxisSection as = chartSettings.getAxisSection(axisId);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
839 Boolean fixed = as.isFixed();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
840
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
841 if (fixed != null && fixed) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
842 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
843 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
844
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
845 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
846 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
847 ? 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
848 : 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
849 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
850 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
851
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
852 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
853 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
854
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
855
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
856 /**
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
857 * 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
858 *
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
859 * @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
860 * @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
861 * @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
862 */
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
863 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
864 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
865 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
866 }
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
867
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
868 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
869
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
870 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
871
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
872 if (xyBounds == 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
873 logger.warn("Skip XYDataset for Axis (invalid ranges): " + 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
874 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
875 }
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
876
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
877 if (visible) {
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
878 if (logger.isDebugEnabled()) {
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
879 logger.debug("Add new AxisDataset at index: " + idx);
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
880 logger.debug("X extent: " + xyBounds[0]);
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
881 logger.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
882 }
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
883
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
884 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
885 }
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
886
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
887 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: 2553
diff changeset
888 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
889 }
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
890
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
891
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
892 /**
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
893 * 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
894 * 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
895 * 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
896 *
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
897 * @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
898 *
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
899 * @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
900 */
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
901 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
902 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
903
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
904 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
905 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
906 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
907 }
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
908
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
909 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
910 }
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
911
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
912
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
913 /**
2553
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
914 * Adjust some Stroke/Grid parameters for <i>plot</i>. The chart
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
915 * <i>Settings</i> are applied in this method.
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
916 *
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
917 * @param plot The XYPlot which is adapted.
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
918 */
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
919 protected void adjustPlot(XYPlot plot) {
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
920 Stroke gridStroke = new BasicStroke(
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
921 DEFAULT_GRID_LINE_WIDTH,
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
922 BasicStroke.CAP_BUTT,
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
923 BasicStroke.JOIN_MITER,
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
924 3.0f,
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
925 new float[] { 3.0f },
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
926 0.0f);
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
927
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
928 ChartSettings cs = getChartSettings();
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
929 boolean isGridVisible = cs != null ? isGridVisible(cs) : true;
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
930
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
931 plot.setDomainGridlineStroke(gridStroke);
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
932 plot.setDomainGridlinePaint(DEFAULT_GRID_COLOR);
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
933 plot.setDomainGridlinesVisible(isGridVisible);
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
934
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
935 plot.setRangeGridlineStroke(gridStroke);
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
936 plot.setRangeGridlinePaint(DEFAULT_GRID_COLOR);
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
937 plot.setRangeGridlinesVisible(isGridVisible);
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
938
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
939 plot.setAxisOffset(new RectangleInsets(0d, 0d, 0d, 0d));
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
940 }
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
941
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
942
c7b0dfa6a52c Some refactoring in chart creation; timeseries charts are now able to apply plot specific settings as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2407
diff changeset
943 /**
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
944 * 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
945 * 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
946 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
947 * @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
948 */
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
949 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
950 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
951 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
952
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
953 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
954
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
955 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
956
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
957 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
958 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
959 }
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
960
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
961 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
962 }
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
963
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
964
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
965 protected String msg(String key, String def) {
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
966 return Resources.getMsg(context.getMeta(), key, def);
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
967 }
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
968
2407
dce0cc856357 'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2398
diff changeset
969 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
970 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
971 }
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
972
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
973 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
974 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
975 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
976
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
977
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
978 protected String getRiverName() {
2132
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2057
diff changeset
979 FLYSArtifact flys = (FLYSArtifact) 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
980
1104
9383a4608d9f Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1095
diff changeset
981 River river = FLYSUtils.getRiver(flys);
9383a4608d9f Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1095
diff changeset
982 return (river != null) ? river.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
983 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
984
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
985
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
986 protected double[] getRange() {
2132
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2057
diff changeset
987 FLYSArtifact flys = (FLYSArtifact) 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
988
1095
f465785ed1ae Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1055
diff changeset
989 return FLYSUtils.getKmRange(flys);
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
990 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
991
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
992
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
993 /**
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
994 * 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
995 * 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
996 *
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
997 * @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
998 * 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
999 */
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1000 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
1001 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
1002
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1003 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
1004 request,
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1005 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
1006 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
1007 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
1008
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1009 if (sizeEl != null) {
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1010 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
1011
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1012 String w = sizeEl.getAttributeNS(uri, "width");
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1013 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
1014
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1015 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
1016 try {
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1017 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
1018 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
1019 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1020 catch (NumberFormatException nfe) {
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1021 logger.warn("Wrong values for chart 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
1022 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1023 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1024 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1025
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
1026 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
1027 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1028
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1029
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1030 /**
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1031 * 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
1032 * 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
1033 * <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
1034 *
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1035 * @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
1036 */
1735
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1037 protected String getFormat() {
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1038 String format = (String) XMLUtils.xpath(
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1039 request,
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1040 XPATH_CHART_FORMAT,
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1041 XPathConstants.STRING,
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1042 ArtifactNamespaceContext.INSTANCE);
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1043
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1044 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
1045 ? DEFAULT_CHART_FORMAT
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1046 : format;
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1047 }
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1048
5966a20fc72c Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
1049
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
1050 /**
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
1051 * Returns the X-Axis range as String array from request document.
cd4fb19ab892 Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2321
diff changeset
1052 *
cd4fb19ab892 Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2321
diff changeset
1053 * @return a String array with [lower, upper].
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
1054 */
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
1055 protected String[] getDomainAxisRangeFromRequest() {
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1056 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
1057 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
1058 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
1059 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
1060 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
1061
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
1062 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
1063 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
1064 }
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
1065
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1066 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
1067
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1068 String lower = xrange.getAttributeNS(uri, "from");
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1069 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
1070
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
1071 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
1072 }
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
1073
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
1074
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
1075 protected String[] getValueAxisRangeFromRequest() {
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1076 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
1077 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
1078 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
1079 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
1080 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
1081
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
1082 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
1083 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
1084 }
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
1085
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
1086
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1087 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
1088
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1089 String lower = yrange.getAttributeNS(uri, "from");
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
1090 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
1091
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
1092 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
1093 }
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
1094
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
1095
423
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1096 /**
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1097 * 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
1098 *
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1099 * @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
1100 */
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1101 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
1102 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
1103 }
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1104
bab867fb37e8 Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
1105
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
1106 /**
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
1107 * 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
1108 * <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
1109 * 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
1110 *
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
1111 * @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
1112 */
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
1113 protected void addDatasets(XYPlot plot) {
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3150
diff changeset
1114 logger.debug("addDatasets()");
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
1115
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
1116 // 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
1117 // 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
1118 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
1119 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
1120
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
1121 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
1122 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
1123 // 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
1124 AxisDataset axisDataset = entry.getValue();
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3150
diff changeset
1125 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
1126
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
1127 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
1128
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
1129 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
1130 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
1131 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
1132 }
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
1133
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1134 setYBounds(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
1135
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
1136 // 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
1137 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
1138 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
1139 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
1140
2677
57d6670ddda3 Minimal cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2590
diff changeset
1141 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
1142 datasetIndex,
2677
57d6670ddda3 Minimal cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2590
diff changeset
1143 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
1144
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
1145 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
1146 }
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
1147
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
1148 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
1149 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
1150 }
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
1151 }
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
1152 }
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
1153
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
1154
2677
57d6670ddda3 Minimal cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2590
diff changeset
1155 /**
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
1156 * @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
1157 * 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
1158 * @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
1159 * 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
1160 * @return idx increased by number of items addded.
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
1161 */
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
1162 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
1163 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
1164 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
1165 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
1166 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
1167 ) {
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
1168 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
1169 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
1170 }
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
1171 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
1172 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
1173 }
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
1174 }
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
1175
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
1176
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
1177 /**
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
1178 * 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
1179 * <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
1180 * 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
1181 *
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
1182 * @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
1183 * @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
1184 * @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
1185 */
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
1186 protected void applyLineTheme(XYPlot plot, XYDataset dataset, int idx) {
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1187 logger.debug("Apply LineTheme for dataset at index: " + idx);
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1188
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
1189 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
1190 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
1191
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
1192 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
1193
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
1194 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
1195
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
1196 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
1197 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
1198
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1199 if (series instanceof StyledSeries) {
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1200 Style style = ((StyledSeries) series).getStyle();
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2261
diff changeset
1201 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
1202 }
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
1203
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
1204 // 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
1205 // 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
1206 // 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
1207 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
1208 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
1209 }
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
1210
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
1211 LegendItem legendItem = renderer.getLegendItem(idx, s);
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3167
diff changeset
1212 if (legendItem.getLabel().endsWith(" ") ||
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3167
diff changeset
1213 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
1214 legendItem = null;
5a0aef74c316 Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3088
diff changeset
1215 }
3167
6f1a102ec14a Do not add entries ending with " " to legend.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
1216
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
1217 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
1218 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
1219 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
1220 }
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
1221 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
1222 logger.warn("Could not get LegentItem for 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
1223 + 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
1224 }
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
1225 }
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
1226
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
1227 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
1228 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
1229 }
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
1230
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
1231 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
1232
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
1233 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
1234 }
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
1235
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
1236
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
1237 /**
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
1238 * @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
1239 * @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
1240 * @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
1241 *
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
1242 * @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
1243 */
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
1244 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
1245 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
1246 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
1247 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
1248 ) {
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
1249 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
1250 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
1251
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
1252 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
1253
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
1254 logger.debug("Registering an 'area'renderer at idx: " + 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
1255
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
1256 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
1257 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
1258
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
1259 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
1260 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
1261 }
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
1262
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
1263 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
1264
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 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
1266
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 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
1268 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
1269 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
1270 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
1271 }
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
1272 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
1273 logger.warn("Could not get LegentItem for 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
1274 + 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
1275 }
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
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 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
1278 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
1279 }
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
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 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
1282 }
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
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 * 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
1287 *
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 * @param Range to be expanded if upper == lower bound.
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 */
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1290 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: 2553
diff changeset
1291 if (range == null) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1292 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
1293 }
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1294 else if (range.getLowerBound() == range.getUpperBound()) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1295 double hi = range.getUpperBound();
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1296 double lo = range.getLowerBound();
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1297 double add = (hi - lo) / 100 * 5;
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1298
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1299 return new DoubleBounds(lo-add, hi+add);
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1300 }
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1301
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2553
diff changeset
1302 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
1303 }
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 /**
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 * 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
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 * @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
1310 * @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
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 * @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
1313 */
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 protected XYLineAndShapeRenderer createRenderer(XYPlot plot, 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
1315 logger.debug("Create EnhancedLineAndShapeRenderer for idx: " + 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
1316
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 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
1318 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
1319
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 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
1321
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 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
1323 }
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
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 /**
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
1327 * 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
1328 *
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1329 * @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
1330 * @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
1331 *
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1332 * @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
1333 */
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1334 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
1335 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
1336
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2141
diff changeset
1337 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
1338 }
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1339
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1340
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1341 /**
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
1342 * 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
1343 * 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
1344 */
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
1345 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
1346 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
1347
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
1348 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
1349 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
1350 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
1351 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
1352
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
1353 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
1354 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
1355 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
1356
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
1357 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
1358 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
1359 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
1360
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
1361 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
1362 }
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
1363
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
1364
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
1365 /**
2236
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1366 * 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
1367 * <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
1368 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1369 * @param theme The theme of the chart line.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1370 * @param The displayed name of the item.
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1371 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1372 * @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
1373 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1374 public LegendItem createLegendItem(Document theme, String name) {
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1375 // 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
1376 ThemeAccess themeAccess = new ThemeAccess(theme);
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1377
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1378 Color color = themeAccess.parseLineColorField();
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1379 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
1380
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1381 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
1382 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
1383 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1384
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1385
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1386 /**
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1387 * 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
1388 * 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
1389 *
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1390 * @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
1391 */
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1392 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
1393 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
1394 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
1395 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
1396 getLegendFontSize()
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1397 );
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1398 }
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1399
c2b15d9c0f43 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2234
diff changeset
1400
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
1401 /**
3184
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1402 * Create new legend entries, dependent on settings.
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1403 * @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
1404 */
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1405 public void aggregateLegendEntries(XYPlot plot) {
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1406 int AGGR_THRESHOLD = 0;
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1407
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1408 Integer threshold = getChartSettings().getLegendSection()
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1409 .getAggregationThreshold();
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1410
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1411 AGGR_THRESHOLD = (threshold != null) ? threshold.intValue() : 0;
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1412
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1413 LegendProcessor.aggregateLegendEntries(plot, AGGR_THRESHOLD);
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1414 }
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1415
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1416
12440c6b8b66 Refactored legend item aggregation again.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3169
diff changeset
1417 /**
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
1418 * 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
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 * @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
1421 */
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
1422 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
1423 // 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
1424 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
1425 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
1426
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
1427 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
1428 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
1429 }
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
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
2234
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1432 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
1433 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
1434
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1435 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
1436 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
1437 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
1438 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
1439 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
1440 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
1441 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
1442 "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
1443 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
1444 }
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1445
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1446
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1447 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
1448 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
1449
46ec09c7f578 Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
1450 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
1451 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
1452 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
1453 "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
1454 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
1455 }
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
1456 }
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
1457 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org