Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 2234:46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
flys-artifacts/trunk@3878 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 02 Feb 2012 12:50:33 +0000 |
parents | 958a10e2e246 |
children | c2b15d9c0f43 |
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 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
3 import java.awt.Color; |
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
|
4 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
|
5 import java.io.OutputStream; |
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
|
6 import java.util.Locale; |
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
|
7 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
8 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
|
9 |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 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
|
11 |
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 org.w3c.dom.Document; |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
13 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
|
14 |
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
|
15 import org.jfree.chart.JFreeChart; |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
16 import org.jfree.chart.axis.NumberAxis; |
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
|
17 import org.jfree.data.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
|
18 |
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
|
19 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
|
20 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
|
21 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
|
22 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
|
23 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
24 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
|
25 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
|
26 |
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
|
27 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
|
28 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
|
29 |
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
|
30 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
|
31 |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2057
diff
changeset
|
32 import de.intevation.flys.artifacts.FLYSArtifact; |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
33 import de.intevation.flys.artifacts.resources.Resources; |
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
|
34 import de.intevation.flys.utils.FLYSUtils; |
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
|
35 |
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
|
36 |
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
|
37 /** |
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
|
38 * 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
|
39 * 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
|
40 * |
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
|
41 * @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
|
42 */ |
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
|
43 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
|
44 |
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
|
45 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
|
46 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
55 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
56 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
|
57 "/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
|
58 |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
59 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
|
60 "/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
|
61 |
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
|
62 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
|
63 "/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
|
64 |
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
|
65 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
|
66 "/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
|
67 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
68 |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 /** 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
|
70 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
|
71 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 /** 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
|
73 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
|
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 /** 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
|
76 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
|
77 |
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
|
78 /** 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
|
79 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
|
80 |
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
|
81 /** 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
|
82 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
|
83 |
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
|
84 |
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
|
85 /** |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
86 * 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
|
87 * 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
|
88 */ |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
89 public interface YAxisWalker { |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
90 int length(); |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
91 String getId(int idx); |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
92 } |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
93 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
94 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
95 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
96 * 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
|
97 * 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
|
98 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
99 * @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
|
100 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
101 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
|
102 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
103 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
104 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
|
105 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
|
106 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
|
107 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
|
108 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
109 |
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
|
110 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
|
111 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
112 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
113 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
114 * 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
|
115 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
116 * @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
|
117 */ |
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
|
118 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
|
119 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
120 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
121 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
122 * 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
|
123 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
124 * @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
|
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 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
|
127 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
128 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
129 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
130 * 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
|
131 * 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
|
132 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
133 * @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
|
134 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
135 * @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
|
136 */ |
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
|
137 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
|
138 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
139 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
140 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
141 * 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
|
142 * <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
|
143 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
144 * @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
|
145 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
146 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
|
147 // 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
|
148 } |
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
|
149 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
150 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
151 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
152 * 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
|
153 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
154 @Override |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
155 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
|
156 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
|
157 { |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
158 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
|
159 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
160 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
|
161 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
162 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
|
163 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
|
164 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
165 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
|
166 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
|
167 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
168 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
169 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
|
170 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
|
171 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
172 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
|
173 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
|
174 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
175 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
|
176 out, |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
177 chart, |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
178 context); |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
179 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
180 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
|
181 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
|
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 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
|
184 out, |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
185 chart, |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
186 context); |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
187 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
188 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
|
189 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
|
190 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
191 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
|
192 out, |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
193 chart, |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
194 context); |
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 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
|
197 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
|
198 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
199 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
|
200 out, |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
201 chart, |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
202 context); |
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 } |
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 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
207 @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
|
208 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
|
209 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
|
210 |
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
|
211 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
|
212 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
|
213 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
|
214 } |
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
|
215 |
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
|
216 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
217 @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
|
218 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
|
219 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
|
220 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
221 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
222 |
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
|
223 @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
|
224 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
|
225 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
|
226 } |
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
|
227 |
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
|
228 |
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
|
229 /** |
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
|
230 * 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
|
231 * |
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
|
232 * @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
|
233 * |
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
|
234 * @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
|
235 * <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
|
236 * |
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
|
237 * @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
|
238 */ |
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
|
239 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
|
240 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
|
241 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
|
242 } |
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
|
243 |
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
|
244 |
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
|
245 /** |
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
|
246 * 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
|
247 * |
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
|
248 * @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
|
249 * |
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
|
250 * @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
|
251 * <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
|
252 * |
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
|
253 * @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
|
254 */ |
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
|
255 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
|
256 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
|
257 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
|
258 } |
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
|
259 |
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
|
260 |
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
|
261 /** |
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
|
262 * 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
|
263 * 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
|
264 * 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
|
265 * |
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
|
266 * @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
|
267 * |
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
|
268 * @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
|
269 * |
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
|
270 * @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
|
271 */ |
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
|
272 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
|
273 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
|
274 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
|
275 |
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
|
276 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
|
277 } |
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
|
278 |
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
|
279 |
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
|
280 /** |
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
|
281 * 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
|
282 * 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
|
283 * 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
|
284 * |
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
|
285 * @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
|
286 * |
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
|
287 * @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
|
288 * |
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
|
289 * @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
|
290 */ |
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
|
291 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
|
292 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
|
293 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
|
294 |
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
|
295 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
|
296 } |
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
|
297 |
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
|
298 |
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
|
299 /** |
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
|
300 * 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
|
301 * <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
|
302 * |
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
|
303 * @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
|
304 * |
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
|
305 * @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
|
306 * |
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
|
307 * @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
|
308 */ |
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
|
309 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
|
310 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
|
311 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
|
312 } |
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
|
313 |
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
|
314 |
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
|
315 /** |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
316 * 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
|
317 * 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
|
318 * 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
|
319 * getDefaultChartTitle(). |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
320 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
321 * @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
|
322 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
323 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
|
324 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
|
325 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
326 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
|
327 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
|
328 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
329 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
330 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
|
331 } |
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 * 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
|
336 * 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
|
337 * 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
|
338 * 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
|
339 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
340 * @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
|
341 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
342 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
|
343 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
|
344 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
345 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
|
346 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
|
347 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
348 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
349 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
|
350 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
351 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
352 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
353 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
354 * 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
|
355 * subtitles. |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
356 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
357 * @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
|
358 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
359 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
|
360 // 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
|
361 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
|
362 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
363 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
364 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
365 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
366 * 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
|
367 * 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
|
368 * 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
|
369 * <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
|
370 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
371 * @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
|
372 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 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
|
377 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
378 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
379 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
|
380 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
381 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
382 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
383 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
384 * 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
|
385 * 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
|
386 * 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
|
387 * 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
|
388 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
389 * @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
|
390 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
391 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
|
392 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
|
393 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
394 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
|
395 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
|
396 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
|
397 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
398 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
399 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
|
400 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
401 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
402 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
403 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
404 * 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
|
405 * 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
|
406 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
407 * @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
|
408 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
409 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
|
410 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
|
411 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
412 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
413 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
414 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
415 * 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
|
416 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
417 * @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
|
418 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
419 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
|
420 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
|
421 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
|
422 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
|
423 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
424 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
425 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
|
426 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
|
427 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
|
428 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
429 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
|
430 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
|
431 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
432 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
433 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
434 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
|
435 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
436 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
437 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
438 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
439 * 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
|
440 * 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
|
441 * 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
|
442 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
443 * @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
|
444 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
445 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
|
446 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
|
447 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
|
448 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
|
449 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
450 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
451 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
|
452 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
|
453 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
454 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
|
455 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
456 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
457 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
458 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
459 * 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
|
460 * 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
|
461 * 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
|
462 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
463 * @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
|
464 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
465 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
|
466 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
|
467 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
|
468 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
|
469 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
470 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
471 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
|
472 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
473 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
|
474 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
|
475 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
476 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
|
477 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
478 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
479 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
480 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
481 * 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
|
482 * 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
|
483 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
484 * @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
|
485 */ |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
486 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
|
487 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
|
488 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
|
489 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
|
490 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
491 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
492 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
|
493 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
|
494 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
|
495 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
496 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
|
497 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
|
498 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
499 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
500 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
|
501 } |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
502 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
503 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
504 /** |
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
|
505 * 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
|
506 * |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
507 * @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
|
508 */ |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
509 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
|
510 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
|
511 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
|
512 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
|
513 } |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
514 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
515 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
|
516 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
|
517 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
|
518 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
|
519 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
520 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
|
521 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
|
522 } |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
523 } |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
524 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
525 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
|
526 } |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
527 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
528 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
529 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
530 * 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
|
531 * 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
|
532 * |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
533 * @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
|
534 */ |
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
|
535 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
|
536 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
|
537 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
|
538 |
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
|
539 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
|
540 |
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
|
541 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
|
542 |
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
|
543 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
|
544 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
|
545 } |
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
|
546 |
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
|
547 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
|
548 } |
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
|
549 |
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
|
550 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
551 protected String msg(String key, String def) { |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
552 return Resources.getMsg(context.getMeta(), key, def); |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
553 } |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
554 |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
555 |
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
|
556 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
|
557 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
|
558 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
559 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
560 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
561 protected String getRiverName() { |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2057
diff
changeset
|
562 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
|
563 |
1104
9383a4608d9f
Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
564 River river = FLYSUtils.getRiver(flys); |
9383a4608d9f
Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
565 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
|
566 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
567 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
568 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
569 protected double[] getRange() { |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2057
diff
changeset
|
570 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
|
571 |
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
|
572 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
|
573 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
574 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
575 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
576 /** |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
577 * 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
|
578 * 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
|
579 * |
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
|
580 * @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
|
581 * 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
|
582 */ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
583 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
|
584 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
|
585 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
586 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
|
587 request, |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
588 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
|
589 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
|
590 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
|
591 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
592 if (sizeEl != null) { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
593 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
|
594 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
595 String w = sizeEl.getAttributeNS(uri, "width"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
596 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
|
597 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
598 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
|
599 try { |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
600 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
|
601 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
|
602 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
603 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
|
604 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
|
605 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
606 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
607 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
608 |
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
|
609 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
|
610 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
611 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
612 |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
613 /** |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
614 * 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
|
615 * 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
|
616 * <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
|
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 * @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
|
619 */ |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
620 protected String getFormat() { |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
621 String format = (String) XMLUtils.xpath( |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
622 request, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
623 XPATH_CHART_FORMAT, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
624 XPathConstants.STRING, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
625 ArtifactNamespaceContext.INSTANCE); |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
626 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
627 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
|
628 ? DEFAULT_CHART_FORMAT |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
629 : format; |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
630 } |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
631 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
632 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
633 /** |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
634 * Get Range of Domain ("X"-) Axis from request. |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
635 */ |
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
|
636 protected Range getDomainAxisRange() { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
637 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
|
638 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
|
639 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
|
640 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
|
641 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
|
642 |
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
|
643 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
|
644 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
|
645 } |
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
|
646 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
647 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
|
648 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
649 String lower = xrange.getAttributeNS(uri, "from"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
650 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
|
651 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
652 if (lower.length() > 0 && upper.length() > 0) { |
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
|
653 try { |
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
|
654 double from = Double.parseDouble(lower); |
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
|
655 double to = Double.parseDouble(upper); |
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
|
656 |
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
|
657 if (from == 0 && to == 0) { |
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
|
658 logger.debug("No range specified. Lower and upper X == 0"); |
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
|
659 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
|
660 } |
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
|
661 |
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
|
662 if (from > to) { |
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
|
663 double tmp = to; |
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
|
664 to = from; |
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
|
665 from = tmp; |
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
|
666 } |
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
|
667 |
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
|
668 return new Range(from, to); |
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
|
669 } |
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
|
670 catch (NumberFormatException nfe) { |
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
|
671 logger.warn("Wrong values for domain axis 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
|
672 } |
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
|
673 } |
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
|
674 |
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
|
675 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
|
676 } |
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
|
677 |
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
|
678 |
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
|
679 protected Range getValueAxisRange() { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
680 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
|
681 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
|
682 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
|
683 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
|
684 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
|
685 |
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
|
686 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
|
687 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
|
688 } |
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
|
689 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
690 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
691 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
|
692 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
693 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
694 String lower = yrange.getAttributeNS(uri, "from"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
695 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
|
696 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
697 if (lower.length() > 0 && upper.length() > 0) { |
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
|
698 try { |
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
|
699 double from = Double.parseDouble(lower); |
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
|
700 double to = Double.parseDouble(upper); |
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
|
701 |
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
|
702 if (from == 0 && to == 0) { |
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
|
703 logger.debug("No range specified. Lower and upper Y == 0"); |
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
|
704 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
|
705 } |
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
|
706 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
707 return from > to |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
708 ? new Range(to, from) |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
709 : new Range(from, 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
|
710 } |
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
|
711 catch (NumberFormatException nfe) { |
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
|
712 logger.warn("Wrong values for value axis 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
|
713 } |
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
|
714 } |
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
|
715 |
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
|
716 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
|
717 } |
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
|
718 |
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
|
719 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
720 /** |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
721 * 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
|
722 * |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
723 * @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
|
724 */ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
725 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
|
726 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
|
727 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
728 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
729 |
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
|
730 /** |
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
|
731 * Returns an instance of <i>EmptySettings</i> currently! |
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
|
732 * |
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
|
733 * @return an instance of <i>EmptySettings</i>. |
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
|
734 */ |
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
|
735 public Settings getSettings() { |
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
|
736 return settings != null ? settings : new EmptySettings(); |
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
|
737 } |
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
|
738 |
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
|
739 |
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
|
740 /** |
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
|
741 * Returns the <i>settings</i> as <i>ChartSettings</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
|
742 * |
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
|
743 * @return the <i>settings</i> as <i>ChartSettings</i> or null, if |
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
|
744 * <i>settings</i> is not an instance of <i>ChartSettings</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
|
745 */ |
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
|
746 public ChartSettings getChartSettings() { |
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
|
747 if (settings instanceof ChartSettings) { |
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
|
748 return (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
|
749 } |
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
|
750 |
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
|
751 return null; |
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
|
752 } |
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
|
753 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
754 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
755 /** |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
756 * 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
|
757 * |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
758 * @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
|
759 * @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
|
760 * |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
761 * @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
|
762 */ |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
763 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
|
764 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
|
765 |
958a10e2e246
Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2141
diff
changeset
|
766 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
|
767 } |
2234
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
768 |
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 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
|
771 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
|
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 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
|
774 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
|
775 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
|
776 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
|
777 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
|
778 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
|
779 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
|
780 "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
|
781 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
|
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 |
46ec09c7f578
Refactoring: moved more base code from XYChartGenerator into its parent class ChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2233
diff
changeset
|
785 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
|
786 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
|
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 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
|
789 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
|
790 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
|
791 "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
|
792 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
|
793 } |
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
|
794 } |
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
|
795 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |