Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 2161:c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
flys-artifacts/trunk@3747 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 23 Jan 2012 10:44:34 +0000 |
parents | 2336927cb096 |
children | 105097966111 |
rev | line source |
---|---|
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.exports; |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
3 import java.awt.BasicStroke; |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.awt.Color; |
2053
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
5 import java.awt.Font; |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
6 import java.awt.Paint; |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
7 import java.awt.Stroke; |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
8 import java.awt.TexturePaint; |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
9 |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
10 import java.awt.geom.Rectangle2D; |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
11 |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
12 import java.awt.image.BufferedImage; |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import java.io.IOException; |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
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:
1623
diff
changeset
|
16 import java.text.NumberFormat; |
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:
1623
diff
changeset
|
17 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
18 import java.util.ArrayList; |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
19 import java.util.HashMap; |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
20 import java.util.TreeMap; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
21 import java.util.List; |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
22 import java.util.Map; |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
23 import java.util.SortedMap; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
24 |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
25 import org.w3c.dom.Document; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
26 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 import org.apache.log4j.Logger; |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 import org.jfree.chart.ChartFactory; |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 import org.jfree.chart.JFreeChart; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
31 import org.jfree.chart.LegendItem; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
32 import org.jfree.chart.LegendItemCollection; |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
33 import org.jfree.chart.annotations.XYBoxAnnotation; |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
34 import org.jfree.chart.annotations.XYLineAnnotation; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
35 import org.jfree.chart.annotations.XYTextAnnotation; |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 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
|
37 import org.jfree.chart.axis.ValueAxis; |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 import org.jfree.chart.plot.PlotOrientation; |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 import org.jfree.chart.plot.XYPlot; |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
40 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
41 import org.jfree.data.Range; |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
42 import org.jfree.data.xy.XYSeries; |
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
43 import org.jfree.data.xy.XYSeriesCollection; |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
44 import org.jfree.data.xy.XYDataset; |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
45 |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
46 import org.jfree.ui.RectangleInsets; |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
47 import org.jfree.ui.TextAnchor; |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
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:
2056
diff
changeset
|
49 import de.intevation.artifacts.CallContext; |
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:
2056
diff
changeset
|
50 |
1849
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
51 import de.intevation.artifactdatabase.state.Facet; |
1986
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
52 import de.intevation.artifactdatabase.state.Settings; |
1849
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
53 |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
54 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 import de.intevation.flys.exports.ChartExportHelper; |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
56 import de.intevation.flys.jfree.EnhancedLineAndShapeRenderer; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
57 import de.intevation.flys.jfree.FLYSAnnotation; |
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:
2056
diff
changeset
|
58 import de.intevation.flys.jfree.StableXYDifferenceRenderer; |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1736
diff
changeset
|
59 import de.intevation.flys.jfree.StickyAxisAnnotation; |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
60 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
61 import de.intevation.flys.jfree.StyledAreaSeriesCollection; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
62 import de.intevation.flys.jfree.StyledXYSeries; |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
1754
8e6615ad60b8
Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1738
diff
changeset
|
64 import de.intevation.flys.utils.ThemeAccess; |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
66 import de.intevation.flys.artifacts.model.HYKFactory; |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
67 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 /** |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * An abstract base class for creating XY charts. |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 * |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
71 * With respect to datasets, ranges and axis, there are following requirements: |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
72 * <ul> |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
73 * <li> First in, first drawn: "Early" datasets should be of lower Z-Oder |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
74 * than later ones (only works per-axis). </li> |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
75 * <li> Visible axis should initially show the range of all datasets that |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
76 * show data for this axis (even invisible ones). Motivation: Once |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
77 * a dataset (theme) has been activated, it should be on screen. </li> |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
78 * <li> There should always be a Y-Axis on the "left". </li> |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
79 * </ul> |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
80 * |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 */ |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 public abstract class XYChartGenerator extends ChartGenerator { |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
85 // TODO Consider storing the renderer here. |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
86 private class AxisDataset { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
87 /** Symbolic integer, but also coding the priority (0 goes first). */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
88 protected int axisSymbol; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
89 /** List of assigned datasets (in order). */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
90 protected List<XYDataset> datasets; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
91 /** Range to use to include all given datasets. */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
92 protected Range range; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
93 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
94 /** Create AxisDataset. */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
95 public AxisDataset(int symb) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
96 this.axisSymbol = symb; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
97 datasets = new ArrayList<XYDataset>(); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
98 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
99 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
100 /** Merge (or create given range with range so far (if any). */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
101 private void mergeRanges(Range subRange) { |
1959
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
102 // Avoid merging NaNs, as they take min/max place forever. |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
103 if (subRange == null || |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
104 Double.isNaN(subRange.getLowerBound()) || |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
105 Double.isNaN(subRange.getUpperBound())) { |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
106 return; |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
107 } |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
108 if (range == null) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
109 range = subRange; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
110 return; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
111 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
112 range = Range.combine(range, subRange); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
113 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
114 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
115 /** Add a dataset, include its range. */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
116 public void addDataset(XYSeries dataset) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
117 this.datasets.add(new XYSeriesCollection(dataset)); |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
118 includeYRange(dataset); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
119 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
120 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
121 public void addArea(StyledAreaSeriesCollection series) { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
122 this.datasets.add(series); |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
123 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
124 |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
125 /** True if to be renedered as area. */ |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
126 public boolean isArea(XYSeriesCollection series) { |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
127 return (series instanceof StyledAreaSeriesCollection); |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
128 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
129 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
130 /** Adjust range to include given dataset. */ |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
131 public void includeYRange(XYSeries dataset) { |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
132 mergeRanges(new Range(dataset.getMinY(), dataset.getMaxY())); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
133 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
134 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
135 /** True if no datasets given. */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
136 public boolean isEmpty() { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
137 return this.datasets.isEmpty(); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
138 } |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
139 } // class AxisDataset |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
140 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
141 |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
142 /** |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
143 * A mini interface that allows to walk over the YAXIS enums defined in |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
144 * subclasses. |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
145 */ |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
146 public interface YAxisWalker { |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
147 int length(); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
148 String getId(int idx); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
149 } |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
150 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
151 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
152 /** Override to make axis information available. */ |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
153 protected YAxisWalker getYAxisWalker() { |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
154 return new YAxisWalker() { |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
155 /** Get number of items. */ |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
156 @Override |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
157 public int length() { |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
158 return 0; |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
159 } |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
160 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
161 /** Get identifier for this index. */ |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
162 @Override |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
163 public String getId(int idx) { |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
164 return null; |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
165 } |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
166 }; |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
167 } |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
168 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
169 |
1048
fd5c70973e0b
Picky white-space cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
924
diff
changeset
|
170 /** The logger that is used in this generator. */ |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
171 private static Logger logger = Logger.getLogger(XYChartGenerator.class); |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
173 /** Map of datasets ("index"). */ |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
174 protected SortedMap<Integer, AxisDataset> datasets; |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
175 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
176 /** List of annotations to insert in plot. */ |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
177 protected List<FLYSAnnotation> annotations; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
178 |
1685
022f62c75878
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
179 /** The max X range to include all X values of all series for each axis. */ |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
180 protected Map<Integer, Range> xRanges; |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
181 |
1685
022f62c75878
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
182 /** The max Y range to include all Y values of all series for each axis. */ |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
183 protected Map<Integer, Range> yRanges; |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
184 |
2053
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
185 public static final Color DEFAULT_GRID_COLOR = Color.GRAY; |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
186 public static final float DEFAULT_GRID_LINE_WIDTH = 0.3f; |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
187 public static final int DEFAULT_FONT_SIZE = 12; |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
188 public static final String DEFAULT_FONT_NAME = "Tahoma"; |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
189 |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
190 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
191 public XYChartGenerator() { |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
192 xRanges = new HashMap<Integer, Range>(); |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
193 yRanges = new HashMap<Integer, Range>(); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
194 datasets = new TreeMap<Integer, AxisDataset>(); |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
195 } |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
196 |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
197 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 /** |
2048
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
199 * Returns the title of a chart. The return value depends on the existence |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
200 * of ChartSettings: if there are ChartSettings set, this method returns the |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
201 * chart title provided by those settings. Otherwise, this method returns |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
202 * getDefaultChartTitle(). |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 * |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 * @return the title of a chart. |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 */ |
2048
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
206 protected String getChartTitle() { |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
207 ChartSettings chartSettings = getChartSettings(); |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
208 |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
209 if (chartSettings != null) { |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
210 return getChartTitle(chartSettings); |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
211 } |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
212 |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
213 return getDefaultChartTitle(); |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
214 } |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
215 |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
216 |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
217 protected abstract String getDefaultChartTitle(); |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
219 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 /** |
2048
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
221 * Returns the subtitle of a chart. The return value depends on the |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
222 * existence of ChartSettings: if there are ChartSettings set, this method |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
223 * returns the chart title provided by those settings. Otherwise, this |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
224 * method returns getDefaultChartSubtitle(). |
1989
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
225 * |
2048
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
226 * @return the subtitle of a chart. |
1989
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
227 */ |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
228 protected String getChartSubtitle() { |
2048
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
229 ChartSettings chartSettings = getChartSettings(); |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
230 |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
231 if (chartSettings != null) { |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
232 return getChartSubtitle(chartSettings); |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
233 } |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
234 |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
235 return getDefaultChartSubtitle(); |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
236 } |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
237 |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
238 |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
239 /** |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
240 * This method always returns null. Override it in subclasses that require |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
241 * subtitles. |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
242 * |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
243 * @return null. |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
244 */ |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
245 protected String getDefaultChartSubtitle() { |
3157a78e6494
Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
246 // Override this method in subclasses |
1989
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
247 return null; |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
248 } |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
249 |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
250 |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
251 /** |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
252 * This method is used to determine, if the chart's legend is visible or |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
253 * not. If a <i>settings</i> instance is set, this instance determines the |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
254 * visibility otherwise, this method returns true as default 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:
2034
diff
changeset
|
255 * <i>settings</i> is set. |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
256 * |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
257 * @return true, if the legend should be visible, otherwise false. |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
258 */ |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
259 protected boolean isLegendVisible() { |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
260 ChartSettings 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:
2034
diff
changeset
|
261 if (chartSettings != null) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
262 return isLegendVisible(chartSettings); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
263 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
264 |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
265 return true; |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
266 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
267 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
268 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
269 /** |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
270 * This method is used to determine the font size of the chart's legend. If |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
271 * a <i>settings</i> instance is set, this instance determines the font |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
272 * size, otherwise this method returns 12 as default if no <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:
2034
diff
changeset
|
273 * is set or if it doesn't provide a legend font size. |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
274 * |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
275 * @return a legend font size. |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
276 */ |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
277 protected int getLegendFontSize() { |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
278 Integer fontSize = null; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
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:
2034
diff
changeset
|
280 ChartSettings 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:
2034
diff
changeset
|
281 if (chartSettings != null) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
282 fontSize = getLegendFontSize(chartSettings); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
283 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
284 |
2053
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
285 return fontSize != null ? fontSize : DEFAULT_FONT_SIZE; |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
286 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
287 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
288 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
289 /** |
1989
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
290 * This method is used to determine if the resulting chart should display |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
291 * grid lines or not. <b>Note: this method always returns true!</b> |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
292 * |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
293 * @return true, if the chart should display grid lines, otherwise false. |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
294 */ |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
295 protected boolean isGridVisible() { |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
296 return true; |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
297 } |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
298 |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
299 |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
300 /** |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
301 * Returns the X-Axis label of a chart. |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
302 * |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
303 * @return the X-Axis label of a chart. |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
304 */ |
2051
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
305 protected String getXAxisLabel() { |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
306 ChartSettings chartSettings = getChartSettings(); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
307 if (chartSettings == null) { |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
308 return getDefaultXAxisLabel(); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
309 } |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
310 |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
311 AxisSection as = chartSettings.getAxisSection("X"); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
312 if (as != null) { |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
313 String label = as.getLabel(); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
314 |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
315 if (label != null) { |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
316 return label; |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
317 } |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
318 } |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
319 |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
320 return getDefaultXAxisLabel(); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
321 } |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
322 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
323 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
324 /** |
2051
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
325 * Returns the default X-Axis label of a chart. |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
326 * |
2051
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
327 * @return the default X-Axis label of a chart. |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
328 */ |
2051
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
329 protected abstract String getDefaultXAxisLabel(); |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
330 |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
331 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
332 /** |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
333 * Returns the Y-Axis label of a chart at position <i>pos</i>. |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
334 * |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
335 * @return the Y-Axis label of a chart at position <i>0</i>. |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
336 */ |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
337 protected String getYAxisLabel(int pos) { |
2051
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
338 ChartSettings chartSettings = getChartSettings(); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
339 if (chartSettings == null) { |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
340 return getDefaultYAxisLabel(pos); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
341 } |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
342 |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
343 YAxisWalker walker = getYAxisWalker(); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
344 AxisSection as = chartSettings.getAxisSection(walker.getId(pos)); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
345 if (as != null) { |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
346 String label = as.getLabel(); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
347 |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
348 if (label != null) { |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
349 return label; |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
350 } |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
351 } |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
352 |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
353 return getDefaultYAxisLabel(pos); |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
354 } |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
355 |
2051
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
356 |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
357 /** |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
358 * This method is called to retrieve the default label for an Y axis at |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
359 * position <i>pos</i>. |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
360 * |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
361 * @param pos The position of an Y axis. |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
362 * |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
363 * @return the default Y axis label at position <i>pos</i>. |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
364 */ |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
365 protected abstract String getDefaultYAxisLabel(int pos); |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
366 |
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
367 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
368 /** |
2053
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
369 * This method returns the font size for the X axis. If the font size is |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
370 * specified in ChartSettings (if <i>chartSettings</i> is set), this size is |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
371 * returned. Otherwise the default font size 12 is returned. |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
372 * |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
373 * @return the font size for the x axis. |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
374 */ |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
375 protected int getXAxisLabelFontSize() { |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
376 ChartSettings chartSettings = getChartSettings(); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
377 if (chartSettings == null) { |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
378 return DEFAULT_FONT_SIZE; |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
379 } |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
380 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
381 AxisSection as = chartSettings.getAxisSection("X"); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
382 Integer fontSize = as.getFontSize(); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
383 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
384 return fontSize != null ? fontSize : DEFAULT_FONT_SIZE; |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
385 } |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
386 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
387 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
388 /** |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
389 * This method returns the font size for an Y axis. If the font size is |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
390 * specified in ChartSettings (if <i>chartSettings</i> is set), this size is |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
391 * returned. Otherwise the default font size 12 is returned. |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
392 * |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
393 * @return the font size for the x axis. |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
394 */ |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
395 protected int getYAxisFontSize(int pos) { |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
396 ChartSettings chartSettings = getChartSettings(); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
397 if (chartSettings == null) { |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
398 return DEFAULT_FONT_SIZE; |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
399 } |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
400 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
401 YAxisWalker walker = getYAxisWalker(); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
402 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
403 AxisSection as = chartSettings.getAxisSection(walker.getId(pos)); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
404 Integer fontSize = as.getFontSize(); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
405 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
406 return fontSize != null ? fontSize : DEFAULT_FONT_SIZE; |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
407 } |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
408 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
409 |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
410 /** |
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:
2056
diff
changeset
|
411 * This method returns the export dimension specified in ChartSettings as |
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:
2056
diff
changeset
|
412 * int array [width,height]. |
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:
2056
diff
changeset
|
413 * |
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:
2056
diff
changeset
|
414 * @return an int array with [width,height]. |
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:
2056
diff
changeset
|
415 */ |
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:
2056
diff
changeset
|
416 protected int[] getExportDimension() { |
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:
2056
diff
changeset
|
417 ChartSettings chartSettings = getChartSettings(); |
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:
2056
diff
changeset
|
418 if (chartSettings == null) { |
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:
2056
diff
changeset
|
419 return new int[] { 600, 400 }; |
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:
2056
diff
changeset
|
420 } |
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:
2056
diff
changeset
|
421 |
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:
2056
diff
changeset
|
422 ExportSection export = chartSettings.getExportSection(); |
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:
2056
diff
changeset
|
423 Integer width = export.getWidth(); |
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:
2056
diff
changeset
|
424 Integer height = export.getHeight(); |
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:
2056
diff
changeset
|
425 |
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:
2056
diff
changeset
|
426 if (width != null && height != null) { |
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:
2056
diff
changeset
|
427 return new int[] { width, height }; |
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:
2056
diff
changeset
|
428 } |
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:
2056
diff
changeset
|
429 |
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:
2056
diff
changeset
|
430 return new int[] { 600, 400 }; |
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:
2056
diff
changeset
|
431 } |
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:
2056
diff
changeset
|
432 |
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:
2056
diff
changeset
|
433 |
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:
2056
diff
changeset
|
434 /** |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
435 * Generate chart. |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
436 */ |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
437 public void generate() |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
438 throws IOException |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
439 { |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
440 logger.debug("XYChartGenerator.generate"); |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
441 |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
442 JFreeChart chart = generateChart(); |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
443 |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
444 String format = getFormat(); |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
445 int[] size = getSize(); |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
446 |
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:
2056
diff
changeset
|
447 if (size == null) { |
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:
2056
diff
changeset
|
448 size = getExportDimension(); |
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:
2056
diff
changeset
|
449 } |
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:
2056
diff
changeset
|
450 |
1930
de0c2bbb27f9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1861
diff
changeset
|
451 context.putContextValue("chart.width", size[0]); |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
452 context.putContextValue("chart.height", size[1]); |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
453 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
454 if (format.equals(ChartExportHelper.FORMAT_PNG)) { |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
455 context.putContextValue("chart.image.format", "png"); |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
456 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
457 ChartExportHelper.exportImage( |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
458 out, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
459 chart, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
460 context); |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
461 } |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
462 else if (format.equals(ChartExportHelper.FORMAT_PDF)) { |
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:
2056
diff
changeset
|
463 preparePDFContext(context); |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
464 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
465 ChartExportHelper.exportPDF( |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
466 out, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
467 chart, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
468 context); |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
469 } |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
470 else if (format.equals(ChartExportHelper.FORMAT_SVG)) { |
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:
2056
diff
changeset
|
471 prepareSVGContext(context); |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
472 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
473 ChartExportHelper.exportSVG( |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
474 out, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
475 chart, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
476 context); |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1711
diff
changeset
|
477 } |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
478 } |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
479 |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
480 |
1930
de0c2bbb27f9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1861
diff
changeset
|
481 /** |
de0c2bbb27f9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1861
diff
changeset
|
482 * Generate the chart anew (including localized axis and all). |
de0c2bbb27f9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1861
diff
changeset
|
483 */ |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
484 public JFreeChart generateChart() { |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
485 logger.debug("XYChartGenerator.generateChart"); |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
486 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
487 JFreeChart chart = ChartFactory.createXYLineChart( |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
488 getChartTitle(), |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
489 getXAxisLabel(), |
2051
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
490 getYAxisLabel(0), |
375
60f63539d004
Ws and Qs of a longitudinal section chart are mapped to an own range axis now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
369
diff
changeset
|
491 null, |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
492 PlotOrientation.VERTICAL, |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
493 isLegendVisible(), |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
494 false, |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
495 false); |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
496 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
497 XYPlot plot = (XYPlot) chart.getPlot(); |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
498 chart.setBackgroundPaint(Color.WHITE); |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
499 plot.setBackgroundPaint(Color.WHITE); |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
500 addSubtitles(chart); |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
501 adjustPlot(plot); |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
502 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
503 //debugAxis(plot); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
504 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
505 addDatasets(plot); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
506 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
507 //debugDatasets(plot); |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
508 |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
509 recoverEmptyPlot(plot); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
510 preparePointRanges(plot); |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
511 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
512 //debugAxis(plot); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
513 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
514 localizeAxes(plot); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
515 adjustAxes(plot); |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
516 autoZoom(plot); |
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
|
517 |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
518 // These have to go after the autozoom. |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
519 addAnnotationsToRenderer(plot); |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
520 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
521 return chart; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
522 } |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
523 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
524 |
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:
2056
diff
changeset
|
525 protected void preparePDFContext(CallContext context) { |
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:
2056
diff
changeset
|
526 int[] dimension = getExportDimension(); |
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:
2056
diff
changeset
|
527 |
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:
2056
diff
changeset
|
528 context.putContextValue("chart.width", dimension[0]); |
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:
2056
diff
changeset
|
529 context.putContextValue("chart.height", dimension[1]); |
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:
2056
diff
changeset
|
530 context.putContextValue("chart.marginLeft", 5f); |
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:
2056
diff
changeset
|
531 context.putContextValue("chart.marginRight", 5f); |
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:
2056
diff
changeset
|
532 context.putContextValue("chart.marginTop", 5f); |
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:
2056
diff
changeset
|
533 context.putContextValue("chart.marginBottom", 5f); |
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:
2056
diff
changeset
|
534 context.putContextValue( |
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:
2056
diff
changeset
|
535 "chart.page.format", |
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:
2056
diff
changeset
|
536 ChartExportHelper.DEFAULT_PAGE_SIZE); |
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:
2056
diff
changeset
|
537 } |
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:
2056
diff
changeset
|
538 |
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:
2056
diff
changeset
|
539 |
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:
2056
diff
changeset
|
540 protected void prepareSVGContext(CallContext context) { |
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:
2056
diff
changeset
|
541 int[] dimension = getExportDimension(); |
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:
2056
diff
changeset
|
542 |
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:
2056
diff
changeset
|
543 context.putContextValue("chart.width", dimension[0]); |
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:
2056
diff
changeset
|
544 context.putContextValue("chart.height", dimension[1]); |
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:
2056
diff
changeset
|
545 context.putContextValue( |
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:
2056
diff
changeset
|
546 "chart.encoding", |
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:
2056
diff
changeset
|
547 ChartExportHelper.DEFAULT_ENCODING); |
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:
2056
diff
changeset
|
548 } |
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:
2056
diff
changeset
|
549 |
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:
2056
diff
changeset
|
550 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
551 /** |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
552 * Put debug output about datasets. |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
553 */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
554 public void debugDatasets(XYPlot plot) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
555 logger.debug("Number of datasets: " + plot.getDatasetCount()); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
556 for (int i = 0; i < plot.getDatasetCount(); i++) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
557 if (plot.getDataset(i) == null) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
558 logger.debug("Dataset #" + i + " is null"); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
559 continue; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
560 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
561 logger.debug("Dataset #" + i + ":" + plot.getDataset(i)); |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
562 XYSeriesCollection series = (XYSeriesCollection) plot.getDataset(i); |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
563 logger.debug("X-Extend of Dataset: " + series.getSeries(0).getMinX() |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
564 + " " + series.getSeries(0).getMaxX()); |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
565 logger.debug("Y-Extend of Dataset: " + series.getSeries(0).getMinY() |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
566 + " " + series.getSeries(0).getMaxY()); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
567 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
568 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
569 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
570 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
571 /** |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
572 * Put debug output about axes. |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
573 */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
574 public void debugAxis(XYPlot plot) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
575 logger.debug("..............."); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
576 for (int i = 0; i < plot.getRangeAxisCount(); i++) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
577 if (plot.getRangeAxis(i) == null) |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
578 logger.debug("Range-Axis #" + i + " == null"); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
579 else { |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
580 logger.debug("Range-Axis " + i + " != null [" + |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
581 plot.getRangeAxis(i).getRange().getLowerBound() + |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
582 " " + plot.getRangeAxis(i).getRange().getUpperBound() + |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
583 "]"); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
584 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
585 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
586 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
587 logger.debug("..............."); |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
588 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
589 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
590 |
1685
022f62c75878
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
591 /** |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
592 * Add datasets to plot. |
1685
022f62c75878
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
593 * @param plot plot to add datasets to. |
022f62c75878
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
594 */ |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
595 protected void addDatasets(XYPlot plot) { |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
596 // AxisDatasets are sorted, but some might be empty. |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
597 // Thus, generate numbering on the fly. |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
598 int axisIndex = 0; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
599 int datasetIndex = 0; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
600 for (Map.Entry<Integer, AxisDataset> entry: datasets.entrySet()) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
601 if (!entry.getValue().isEmpty()) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
602 // Add axis and range information. |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
603 AxisDataset axisDataset = entry.getValue(); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
604 NumberAxis axis = createYAxis(entry.getKey()); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
605 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
606 plot.setRangeAxis(axisIndex, axis); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
607 if (axis.getAutoRangeIncludesZero()) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
608 axisDataset.range = Range.expandToInclude(axisDataset.range, 0d); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
609 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
610 yRanges.put(axisIndex, expandPointRange(axisDataset.range)); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
611 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
612 // Add contained datasets, mapping to axis. |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
613 for (XYDataset dataset: axisDataset.datasets) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
614 plot.setDataset(datasetIndex, dataset); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
615 plot.mapDatasetToRangeAxis(datasetIndex, axisIndex); |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
616 applyThemes(plot, (XYSeriesCollection) dataset, |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
617 datasetIndex, |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
618 axisDataset.isArea((XYSeriesCollection)dataset)); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
619 datasetIndex++; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
620 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
621 axisIndex++; |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
622 } |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
623 } |
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
624 } |
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
625 |
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
626 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
627 /** |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
628 * Registers an area to be drawn. |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
629 * @param lower the lower curve to draw the area from. |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
630 * @param upper the upper curve to draw the ara from. |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
631 */ |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
632 public void addAreaSeries(StyledAreaSeriesCollection area, int index, boolean visible) { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
633 if (area == null) { |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
634 logger.warn("Cannot yet render above/under curve."); |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
635 return; |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
636 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
637 AxisDataset axisDataset = datasets.get(index); |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
638 |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
639 if (axisDataset == null) { |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
640 axisDataset = new AxisDataset(index); |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
641 datasets.put(index, axisDataset); |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
642 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
643 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
644 if (visible) { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
645 axisDataset.addArea(area); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
646 } |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
647 else { |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
648 // TODO only range merging. |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
649 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
650 //TODO range merging. |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
651 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
652 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
653 |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
654 /** |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
655 * Add given series if visible, if not visible adjust ranges (such that |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
656 * all points in data would be plotted once visible). |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
657 * @param series the dataseries to include in plot. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
658 * @param index index of the series and of its axis. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
659 * @param visible whether or not the data should be plotted. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
660 */ |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
661 public void addAxisSeries(XYSeries series, int index, boolean visible) { |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
662 if (series == null) { |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
663 return; |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
664 } |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
665 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
666 AxisDataset axisDataset = datasets.get(index); |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
667 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
668 if (axisDataset == null) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
669 axisDataset = new AxisDataset(index); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
670 datasets.put(index, axisDataset); |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
671 } |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
672 |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
673 logger.debug("addAxisSeries: extent X " + series.getMinX() + " : " + series.getMaxX() |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
674 + " extent y " + series.getMinY() + " : " + series.getMaxY()); |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
675 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
676 if (visible) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
677 axisDataset.addDataset(series); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
678 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
679 else { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
680 // Do this also when not visible to have axis scaled by default such |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
681 // that every data-point could be seen (except for annotations). |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
682 axisDataset.includeYRange(series); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
683 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
684 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
685 combineXRanges(new Range(series.getMinX(), series.getMaxX()), 0); |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
686 } |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
687 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
688 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
689 /** |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
690 * Effect: extend range of x axis to include given limits. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
691 * @param range the given ("minimal") range. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
692 * @param index index of axis to be merged. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
693 */ |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
694 private void combineXRanges(Range range, int index) { |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
695 |
1959
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
696 if (range == null |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
697 || Double.isNaN(range.getLowerBound()) |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
698 || Double.isNaN(range.getUpperBound())) { |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
699 return; |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
700 } |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
701 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
702 Range old = xRanges.get(index); |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
703 |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
704 if (old != null) { |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
705 range = Range.combine(old, range); |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
706 } |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
707 |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
708 xRanges.put(index, range); |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
709 } |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
710 |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
711 |
1930
de0c2bbb27f9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1861
diff
changeset
|
712 /** |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1699
diff
changeset
|
713 * Adds annotations to list (if visible is true). |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1699
diff
changeset
|
714 */ |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
715 public void addAnnotations(FLYSAnnotation annotation, boolean visible) { |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
716 if (!visible) { |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
717 return; |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
718 } |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
719 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
720 if (annotations == null) { |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
721 annotations = new ArrayList<FLYSAnnotation>(); |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
722 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
723 |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
724 annotations.add(annotation); |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
725 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
726 |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
727 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
728 /** |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
729 * Create Y (range) axis for given index. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
730 * Shall be overriden by subclasses. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
731 */ |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
732 protected NumberAxis createYAxis(int index) { |
2052
c7f18fa0d685
Added missing getYAxisWalker() in CrossSectionGenerator and create new instances of IdentfifiableNumberAxis in XYChartGenerator.createYAxis(int).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2051
diff
changeset
|
733 YAxisWalker walker = getYAxisWalker(); |
c7f18fa0d685
Added missing getYAxisWalker() in CrossSectionGenerator and create new instances of IdentfifiableNumberAxis in XYChartGenerator.createYAxis(int).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2051
diff
changeset
|
734 |
2053
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
735 Font labelFont = new Font( |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
736 DEFAULT_FONT_NAME, |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
737 Font.BOLD, |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
738 getYAxisFontSize(index)); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
739 |
2052
c7f18fa0d685
Added missing getYAxisWalker() in CrossSectionGenerator and create new instances of IdentfifiableNumberAxis in XYChartGenerator.createYAxis(int).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2051
diff
changeset
|
740 IdentifiableNumberAxis axis = new IdentifiableNumberAxis( |
c7f18fa0d685
Added missing getYAxisWalker() in CrossSectionGenerator and create new instances of IdentfifiableNumberAxis in XYChartGenerator.createYAxis(int).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2051
diff
changeset
|
741 walker.getId(index), |
c7f18fa0d685
Added missing getYAxisWalker() in CrossSectionGenerator and create new instances of IdentfifiableNumberAxis in XYChartGenerator.createYAxis(int).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2051
diff
changeset
|
742 getYAxisLabel(index)); |
c7f18fa0d685
Added missing getYAxisWalker() in CrossSectionGenerator and create new instances of IdentfifiableNumberAxis in XYChartGenerator.createYAxis(int).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2051
diff
changeset
|
743 |
1943
06d8d371d244
Fix compilation, default 0-excluding behavior of axes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1940
diff
changeset
|
744 axis.setAutoRangeIncludesZero(false); |
2053
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
745 axis.setLabelFont(labelFont); |
f9a972d375ba
Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2052
diff
changeset
|
746 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
747 return axis; |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
748 } |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
749 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
750 |
2083
b52012d538af
Fixed issue432 (legenditem-size ignored for area legend items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2077
diff
changeset
|
751 /** Creates Font (Family and size) to use when creating Legend Items. */ |
2055
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
752 protected Font createLegendLabelFont() { |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
753 return new Font( |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
754 DEFAULT_FONT_NAME, |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
755 Font.PLAIN, |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
756 getLegendFontSize() |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
757 ); |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
758 } |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
759 |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
760 |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
761 /** |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
762 * If no data is visible, draw at least empty axis. |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
763 */ |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
764 private void recoverEmptyPlot(XYPlot plot) { |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
765 if (plot.getRangeAxis() == null) { |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
766 logger.debug("debug: No range axis"); |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
767 plot.setRangeAxis(createYAxis(0)); |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
768 } |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
769 } |
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
770 |
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
771 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
772 /** |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
773 * Expands a given range if it collapses into one point. |
1983
ddb7b7da6199
Fix/survive certain minor malconditions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1959
diff
changeset
|
774 * @param Range to be expanded if upper == lower bound. |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
775 */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
776 private Range expandPointRange(Range range) { |
1983
ddb7b7da6199
Fix/survive certain minor malconditions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1959
diff
changeset
|
777 if (range != null && range.getLowerBound() == range.getUpperBound()) { |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
778 return expandRange(range, 5); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
779 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
780 return range; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
781 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
782 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
783 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
784 /** |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
785 * Expands X axes if only a point is shown. |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
786 */ |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
787 private void preparePointRanges(XYPlot plot) { |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
788 for (int i = 0, num = plot.getDomainAxisCount(); i < num; i++) { |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
789 logger.debug("Check whether to expand a x axis."); |
1698
6e935087f6a1
XYChartGenerator: s/new Integer(small)/Integer.valueOf(small)/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1688
diff
changeset
|
790 Integer key = Integer.valueOf(i); |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
791 |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
792 Range r = xRanges.get(key); |
1687
19c4cf5163e8
Take care on empty ranges (null) while preparing single point ranges.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1686
diff
changeset
|
793 if (r != null && r.getLowerBound() == r.getUpperBound()) { |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
794 xRanges.put(key, expandRange(r, 5)); |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
795 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
796 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
797 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
798 |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
799 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
800 /** |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
801 * Expand range by percent. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
802 */ |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
803 public static Range expandRange(Range range, double percent) { |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
804 if (range == null) { |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
805 return null; |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
806 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
807 |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
808 double value = range.getLowerBound(); |
2110
7c5bcb0e03e1
Prevent range collapsing when negative values are given.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2097
diff
changeset
|
809 double expand = Math.abs(value / 100 * percent); |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
810 |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
811 return expand != 0 |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
812 ? new Range(value-expand, value+expand) |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
813 : new Range(-0.01 * percent, 0.01 * percent); |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
814 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
815 |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
816 |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
817 /** |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
818 * This method zooms the plot to the specified ranges in the attribute |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
819 * document or to the ranges specified by the min/max values in the |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
820 * datasets. <b>Note:</b> We determine the range manually if no zoom ranges |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
821 * are given, because JFreeCharts auto-zoom adds a margin to the left and |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
822 * right of the data area. |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
823 * |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
824 * @param plot The XYPlot. |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
825 */ |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
826 protected void autoZoom(XYPlot plot) { |
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
|
827 logger.debug("Zoom to specified ranges."); |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
828 |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
829 Range xrange = getDomainAxisRange(); |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
830 Range yrange = getValueAxisRange(); |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
831 |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
832 ValueAxis xAxis = plot.getDomainAxis(); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
833 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
834 Range fixedXRange = getRangeForAxisFromSettings("X"); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
835 if (fixedXRange != null) { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
836 xAxis.setRange(fixedXRange); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
837 } |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
838 else { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
839 zoomX(plot, xAxis, xRanges.get(0), xrange); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
840 } |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
841 |
1699
608859aa5a7e
Bugfix: #383 Add further y-axes before adjusting the ranges for each y-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1698
diff
changeset
|
842 for (int i = 0, num = plot.getRangeAxisCount(); i < num; i++) { |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
843 ValueAxis yaxis = plot.getRangeAxis(i); |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
844 |
2049
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
845 if (yaxis instanceof IdentifiableNumberAxis) { |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
846 IdentifiableNumberAxis idAxis = (IdentifiableNumberAxis) yaxis; |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
847 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
848 Range fixedRange = getRangeForAxisFromSettings(idAxis.getId()); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
849 if (fixedRange != null) { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
850 yaxis.setRange(fixedRange); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
851 continue; |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
852 } |
2049
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
853 } |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
854 |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
855 if (yaxis == null) { |
1699
608859aa5a7e
Bugfix: #383 Add further y-axes before adjusting the ranges for each y-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1698
diff
changeset
|
856 logger.debug("Zoom problem: no Y Axis for index: " + i); |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
857 continue; |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
858 } |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
859 |
1699
608859aa5a7e
Bugfix: #383 Add further y-axes before adjusting the ranges for each y-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1698
diff
changeset
|
860 logger.debug("Prepare zoom settings for y axis at index: " + i); |
608859aa5a7e
Bugfix: #383 Add further y-axes before adjusting the ranges for each y-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1698
diff
changeset
|
861 zoomY(plot, yaxis, yRanges.get(Integer.valueOf(i)), yrange); |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
862 } |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
863 } |
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
|
864 |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
865 |
718
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
866 protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) { |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
867 return zoom(plot, axis, range, x); |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
868 } |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
869 |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
870 |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
871 protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) { |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
872 return zoom(plot, axis, range, x); |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
873 } |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
874 |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
875 |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
876 /** |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
877 * Zooms the x axis to the range specified in the attribute document. |
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
878 * |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
879 * @param plot The XYPlot. |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
880 * @param axis The axis the shoud be modified. |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
881 * @param range The whole range specified by a dataset. |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
882 * @param x A user defined range (null permitted). |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
883 * |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
884 * @return true, if a zoom range was specified, otherwise false. |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
885 */ |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
886 protected boolean zoom(XYPlot plot, ValueAxis axis, Range range, Range x) { |
1736
0155cbaba182
XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1735
diff
changeset
|
887 |
0155cbaba182
XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1735
diff
changeset
|
888 if (range == null) { |
0155cbaba182
XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1735
diff
changeset
|
889 return false; |
0155cbaba182
XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1735
diff
changeset
|
890 } |
0155cbaba182
XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1735
diff
changeset
|
891 |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
892 if (x != null) { |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
893 double min = range.getLowerBound(); |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
894 double max = range.getUpperBound(); |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
895 double diff = max > min ? max - min : min - max; |
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
|
896 |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
897 Range computed = new Range( |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
898 min + x.getLowerBound() * diff, |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
899 min + x.getUpperBound() * diff); |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
900 |
717
be4709640aac
#90 Added a margin between chart data and chart axes to avoid displaying curves on the chart border.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
673
diff
changeset
|
901 axis.setRangeWithMargins(computed); |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
902 |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
903 logger.debug("Zoom axis to: " + computed); |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
904 |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
905 return true; |
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
|
906 } |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
907 |
717
be4709640aac
#90 Added a margin between chart data and chart axes to avoid displaying curves on the chart border.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
673
diff
changeset
|
908 axis.setRangeWithMargins(range); |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
909 return false; |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
910 } |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
911 |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
912 |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
913 /** |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
914 * This method extracts the minimum and maximum values for x and y axes |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
915 * which are stored in <i>xRanges</i> and <i>yRanges</i>. |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
916 * |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1679
diff
changeset
|
917 * @param index The index of the y-Axis. |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
918 * |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
919 * @return a Range[] as follows: [x-Range, y-Range]. |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
920 */ |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1943
diff
changeset
|
921 public Range[] getRangesForAxis(int index) { |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1943
diff
changeset
|
922 logger.debug("getRangesForAxis " + index); |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
923 |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
924 Range rx = xRanges.get(Integer.valueOf(0)); |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
925 Range ry = yRanges.get(Integer.valueOf(index)); |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
926 |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
927 if (rx == null) { |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
928 logger.warn("Range for x axis not set." + |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
929 " Using default values: 0 - 1."); |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
930 rx = new Range(0, 1); |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
931 } |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
932 if (ry == null) { |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
933 logger.warn("Range for y" + index + |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
934 " axis not set. Using default values: 0 - 1."); |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
935 ry = new Range(0, 1); |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
936 } |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
937 return new Range[] {rx, ry}; |
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
|
938 } |
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
|
939 |
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
|
940 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
941 /** |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
942 * This method searches for a specific axis in the <i>settings</i> if |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
943 * <i>settings</i> is set. If the axis was found, this method returns the |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
944 * specified axis range if the axis range is fixed. Otherwise, this method |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
945 * returns null. |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
946 * |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
947 * @param axisId The identifier of an axis. |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
948 * |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
949 * @return the specified axis range from <i>settings</i> if the axis is |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
950 * fixed, otherwise null. |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
951 */ |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
952 public Range getRangeForAxisFromSettings(String axisId) { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
953 ChartSettings chartSettings = getChartSettings(); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
954 if (chartSettings == null) { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
955 return null; |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
956 } |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
957 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
958 AxisSection as = chartSettings.getAxisSection(axisId); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
959 Boolean fixed = as.isFixed(); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
960 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
961 if (fixed != null && fixed) { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
962 Double upper = as.getUpperRange(); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
963 Double lower = as.getLowerRange(); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
964 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
965 if (upper != null && lower != null) { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
966 return lower < upper |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
967 ? new Range(lower, upper) |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
968 : new Range(upper, lower); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
969 } |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
970 } |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
971 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
972 return null; |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
973 } |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
974 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
975 public LegendItem createLegendItem(Document theme, String name) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
976 // OPTIMIZE Pass font, parsed Theme items. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
977 ThemeAccess themeAccess = new ThemeAccess(theme); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
978 Color color = themeAccess.parseLineColorField(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
979 LegendItem li = new LegendItem(name, color); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
980 li.setLabelFont(createLegendLabelFont()); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
981 return li; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
982 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
983 |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
984 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
985 /** |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
986 * Get "lowest" X Value for first axis. This value is exactly at the |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
987 * border of the plot. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
988 * @return lowest value on first 'x'-axis. |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
989 */ |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
990 protected double getLowestXValue(XYPlot plot) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
991 ValueAxis axis = plot.getDomainAxis(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
992 if (axis == null) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
993 logger.warn("No X-Axis to find lowest value for."); |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
994 } |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
995 return axis.getRange().getLowerBound(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
996 } |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
997 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
998 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
999 /** |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1000 * Get "lowest" X Value for first axis. This value is exactly at the |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1001 * border of the plot. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1002 * @return highest value on first 'x'-axis. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1003 */ |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1004 protected double getUppestXValue(XYPlot plot) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1005 ValueAxis axis = plot.getDomainAxis(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1006 if (axis == null) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1007 logger.warn("No first Y-Axis to find uppest value for."); |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1008 } |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1009 return axis.getRange().getUpperBound(); |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1010 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1011 |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1012 |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1013 /** |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1014 * Get "lowest" Y Value for first axis. This value is exactly at the |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1015 * border of the plot. |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1016 * @return lowest value on first 'y'-axis. |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1017 */ |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1018 protected double getLowestYValue(XYPlot plot) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1019 ValueAxis yaxis = plot.getRangeAxis(0); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1020 if (yaxis == null) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1021 logger.warn("No first Y-Axis to find lowest value for."); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1022 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1023 return yaxis.getRange().getLowerBound(); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1024 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1025 |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1026 |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1027 /** |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1028 * Get "lowest" Y Value for first axis. This value is exactly at the |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1029 * border of the plot. |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1030 * @return highest value on first 'y'-axis. |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1031 */ |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1032 protected double getUppestYValue(XYPlot plot) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1033 ValueAxis yaxis = plot.getRangeAxis(0); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1034 if (yaxis == null) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1035 logger.warn("No first Y-Axis to find uppest value for."); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1036 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1037 return yaxis.getRange().getUpperBound(); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1038 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1039 |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1040 |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1041 /** Get color for hyk zones by their type (which is the name). */ |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1042 public Paint colorForHYKZone(String zoneName) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1043 if (zoneName.startsWith("R")) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1044 // Brownish. |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1045 return new Color(153, 60, 0); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1046 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1047 else if (zoneName.startsWith("V")) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1048 // Greenish. |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1049 return new Color(0, 255, 0); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1050 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1051 else if (zoneName.startsWith("B")) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1052 // Grayish. |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1053 return new Color(128, 128, 128); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1054 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1055 else if (zoneName.startsWith("H")) { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1056 // Blueish. |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1057 return new Color(0, 0, 255); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1058 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1059 else { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1060 // Default. |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1061 logger.debug("Unknown zone type found."); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1062 return new Color(255, 0, 0); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1063 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1064 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1065 |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1066 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1067 /** |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1068 * Add a text and a line annotation. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1069 */ |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1070 public void addStickyAnnotation( |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1071 StickyAxisAnnotation annotation, |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1072 XYPlot plot, |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1073 Area area, |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1074 ThemeAccess.LineStyle lineStyle, |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1075 ThemeAccess.TextStyle textStyle |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1076 ) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1077 // OPTIMIZE pre-calculate area-related values |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1078 final float TEXT_OFF = 0.03f; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1079 final float LINE_OFF = 0.02f; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1080 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1081 XYLineAnnotation lineAnnotation = null; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1082 XYTextAnnotation textAnnotation = null; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1083 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1084 if (annotation.atX()) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1085 textAnnotation = new CollisionFreeXYTextAnnotation( |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1086 annotation.getText(), annotation.getPos(), area.ofGround(TEXT_OFF)); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1087 // OPTIMIZE externalize the calculation involving PI. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1088 textAnnotation.setRotationAngle(270f*Math.PI/180f); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1089 // Style the line. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1090 if (lineStyle != null) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1091 lineAnnotation = new XYLineAnnotation(annotation.getPos(), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1092 area.atGround(), annotation.getPos(), area.ofGround(LINE_OFF), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1093 new BasicStroke(lineStyle.getWidth()),lineStyle.getColor()); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1094 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1095 else { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1096 lineAnnotation = new XYLineAnnotation(annotation.getPos(), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1097 area.atGround(), annotation.getPos(), area.ofGround(LINE_OFF)); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1098 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1099 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1100 else { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1101 textAnnotation = new CollisionFreeXYTextAnnotation( |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1102 annotation.getText(), area.ofLeft(TEXT_OFF), annotation.getPos()); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1103 // Style the line. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1104 if (lineStyle != null) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1105 lineAnnotation = new XYLineAnnotation(area.atLeft(), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1106 annotation.getPos(), area.ofLeft(LINE_OFF), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1107 annotation.getPos(), new BasicStroke(lineStyle.getWidth()), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1108 lineStyle.getColor()); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1109 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1110 else { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1111 lineAnnotation = new XYLineAnnotation(area.atLeft(), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1112 annotation.getPos(), area.ofLeft(LINE_OFF), annotation.getPos()); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1113 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1114 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1115 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1116 // Style the text. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1117 if (textStyle != null) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1118 textStyle.apply(textAnnotation); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1119 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1120 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1121 // Add the Annotations to renderer. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1122 textAnnotation.setRotationAnchor(TextAnchor.CENTER_LEFT); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1123 textAnnotation.setTextAnchor(TextAnchor.CENTER_LEFT); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1124 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1125 plot.getRenderer().addAnnotation(textAnnotation, |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1126 org.jfree.ui.Layer.BACKGROUND); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1127 plot.getRenderer().addAnnotation(lineAnnotation, |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1128 org.jfree.ui.Layer.BACKGROUND); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1129 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1130 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1131 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1132 /** Add annotations (Sticky, Text and hyk zones). */ |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1133 public void addAnnotationsToRenderer(XYPlot plot) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1134 logger.debug("XYChartGenerator.addAnnotationsToRenderer"); |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1135 |
2143
c5d24e0587ce
Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
1136 if (annotations == null) { |
c5d24e0587ce
Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
1137 logger.debug("XYChartGenerator.addBoxAnnotations: no annotations."); |
c5d24e0587ce
Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
1138 return; |
c5d24e0587ce
Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
1139 } |
c5d24e0587ce
Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
1140 |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1141 // Paints for the boxes/lines. |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1142 Stroke basicStroke = new BasicStroke(1.0f); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1143 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1144 Paint linePaint = new Color(255, 0,0,60); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1145 Paint fillPaint = new Color(0, 255,0,60); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1146 Paint tranPaint = new Color(0, 0,0, 0); |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1147 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1148 // OPTMIMIZE: Pre-calculate positions |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1149 Area area = new Area( |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1150 plot.getDomainAxis(0).getRange(), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1151 plot.getRangeAxis().getRange()); |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1152 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1153 // Walk over all Annotation sets. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1154 for (FLYSAnnotation fa: annotations) { |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1155 |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1156 // Access text styling, if any. |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1157 Document theme = fa.getTheme(); |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1158 ThemeAccess.TextStyle textStyle = null; |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1159 ThemeAccess.LineStyle lineStyle = null; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1160 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1161 // Get Themeing information and add legend item. |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1162 if (theme != null) { |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1163 ThemeAccess themeAccess = new ThemeAccess(theme); |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1164 textStyle = themeAccess.parseTextStyle(); |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1165 lineStyle = themeAccess.parseLineStyle(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1166 LegendItemCollection lic = new LegendItemCollection(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1167 LegendItemCollection old = plot.getFixedLegendItems(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1168 lic.add(createLegendItem(theme, fa.getLabel())); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1169 // (Re-)Add prior legend entries. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1170 if (old != null) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1171 old.addAll(lic); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1172 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1173 else { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1174 old = lic; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1175 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1176 plot.setFixedLegendItems(old); |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1177 } |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1178 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1179 // The 'Sticky' Annotations (at axis, with line and text). |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1180 for (StickyAxisAnnotation sta: fa.getAxisTextAnnotations()) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1181 addStickyAnnotation(sta, plot, area, lineStyle, textStyle); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1182 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1183 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1184 // The not yet implemented other Text Annotations. |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1185 for (XYTextAnnotation ta: fa.getTextAnnotations()) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1186 // TODO implement, one we have textannotations |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1187 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1188 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1189 // Hyks. |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1190 for (HYKFactory.Zone zone: fa.getBoxes()) { |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1191 // For each zone, create a box to fill with color, a box to draw |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1192 // the lines and a text to display the type. |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1193 fillPaint = colorForHYKZone(zone.getName()); |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1194 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1195 XYBoxAnnotation boxA = new XYBoxAnnotation(zone.getFrom(), area.atGround(), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1196 zone.getTo(), area.ofGround(0.03f), basicStroke, tranPaint, fillPaint); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1197 XYBoxAnnotation boxB = new XYBoxAnnotation(zone.getFrom(), area.atGround(), |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1198 zone.getTo(), area.atTop(), basicStroke, fillPaint, tranPaint); |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1199 |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1200 XYTextAnnotation tex = new XYTextAnnotation(zone.getName(), |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1201 zone.getFrom() + (zone.getTo() - zone.getFrom()) / 2.0d, |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1202 area.ofGround(0.015f)); |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1203 if (textStyle != null) { |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1204 textStyle.apply(tex); |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1205 } |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1206 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1207 plot.getRenderer().addAnnotation(boxA, org.jfree.ui.Layer.BACKGROUND); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1208 plot.getRenderer().addAnnotation(boxB, org.jfree.ui.Layer.BACKGROUND); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1209 plot.getRenderer().addAnnotation(tex, org.jfree.ui.Layer.BACKGROUND); |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1210 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1211 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
1212 } |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1213 |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2143
diff
changeset
|
1214 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1215 /** |
2054
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1216 * Adjusts the axes of a plot. This method sets the <i>labelFont</i> of the |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1217 * X axis. |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1218 * |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1219 * @param plot The XYPlot of the chart. |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1220 */ |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1221 protected void adjustAxes(XYPlot plot) { |
2054
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1222 ValueAxis xaxis = plot.getDomainAxis(); |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1223 |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1224 ChartSettings chartSettings = getChartSettings(); |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1225 if (chartSettings == null) { |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1226 return; |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
1227 } |
2054
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1228 |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1229 Font labelFont = new Font( |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1230 DEFAULT_FONT_NAME, |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1231 Font.BOLD, |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1232 getXAxisLabelFontSize()); |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1233 |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
1234 xaxis.setLabelFont(labelFont); |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1235 } |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
1236 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
1237 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
1238 /** |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
1239 * Set some Stroke/Grid defaults. |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
1240 */ |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1241 protected void adjustPlot(XYPlot plot) { |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1242 Stroke gridStroke = new BasicStroke( |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1243 DEFAULT_GRID_LINE_WIDTH, |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1244 BasicStroke.CAP_BUTT, |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1245 BasicStroke.JOIN_MITER, |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1246 3.0f, |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1247 new float[] { 3.0f }, |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1248 0.0f); |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1249 |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1250 ChartSettings cs = getChartSettings(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1251 boolean isGridVisible = cs != null ? isGridVisible(cs) : true; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1252 |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1253 plot.setDomainGridlineStroke(gridStroke); |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1254 plot.setDomainGridlinePaint(DEFAULT_GRID_COLOR); |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1255 plot.setDomainGridlinesVisible(isGridVisible); |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1256 |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1257 plot.setRangeGridlineStroke(gridStroke); |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1258 plot.setRangeGridlinePaint(DEFAULT_GRID_COLOR); |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1259 plot.setRangeGridlinesVisible(isGridVisible); |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
1260 |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
1261 plot.setAxisOffset(new RectangleInsets(0d, 0d, 0d, 0d)); |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1262 } |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1263 |
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
1264 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1265 /** Override to handle subtitle adding. */ |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
1266 protected void addSubtitles(JFreeChart chart) { |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
1267 // override this method in subclasses that need subtitles |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
1268 } |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1269 |
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1270 |
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:
1623
diff
changeset
|
1271 /** |
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:
1623
diff
changeset
|
1272 * This method walks over all axes (domain and range) of <i>plot</i> and |
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:
1623
diff
changeset
|
1273 * calls localizeDomainAxis() for domain axes or localizeRangeAxis() for |
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:
1623
diff
changeset
|
1274 * range axes. |
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:
1623
diff
changeset
|
1275 * |
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:
1623
diff
changeset
|
1276 * @param plot The XYPlot. |
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:
1623
diff
changeset
|
1277 */ |
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:
1623
diff
changeset
|
1278 private void localizeAxes(XYPlot plot) { |
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:
1623
diff
changeset
|
1279 for (int i = 0, num = plot.getDomainAxisCount(); i < num; 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:
1623
diff
changeset
|
1280 ValueAxis axis = plot.getDomainAxis(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:
1623
diff
changeset
|
1281 |
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:
1623
diff
changeset
|
1282 if (axis != null) { |
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:
1623
diff
changeset
|
1283 localizeDomainAxis(axis); |
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:
1623
diff
changeset
|
1284 } |
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:
1623
diff
changeset
|
1285 else { |
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:
1623
diff
changeset
|
1286 logger.warn("Domain axis at " + i + " is null."); |
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:
1623
diff
changeset
|
1287 } |
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:
1623
diff
changeset
|
1288 } |
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:
1623
diff
changeset
|
1289 |
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:
1623
diff
changeset
|
1290 for (int i = 0, num = plot.getRangeAxisCount(); i < num; 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:
1623
diff
changeset
|
1291 ValueAxis axis = plot.getRangeAxis(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:
1623
diff
changeset
|
1292 |
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:
1623
diff
changeset
|
1293 if (axis != null) { |
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:
1623
diff
changeset
|
1294 localizeRangeAxis(axis); |
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:
1623
diff
changeset
|
1295 } |
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:
1623
diff
changeset
|
1296 else { |
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:
1623
diff
changeset
|
1297 logger.warn("Range axis at " + i + " is null."); |
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:
1623
diff
changeset
|
1298 } |
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:
1623
diff
changeset
|
1299 } |
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:
1623
diff
changeset
|
1300 } |
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:
1623
diff
changeset
|
1301 |
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:
1623
diff
changeset
|
1302 |
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:
1623
diff
changeset
|
1303 /** |
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:
1623
diff
changeset
|
1304 * Overrides the NumberFormat with the NumberFormat for the current locale |
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:
1623
diff
changeset
|
1305 * that is provided by 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:
1623
diff
changeset
|
1306 * |
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:
1623
diff
changeset
|
1307 * @param domainAxis The domain axis that needs localization. |
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:
1623
diff
changeset
|
1308 */ |
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:
1623
diff
changeset
|
1309 protected void localizeDomainAxis(ValueAxis domainAxis) { |
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:
1623
diff
changeset
|
1310 NumberFormat nf = NumberFormat.getInstance(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:
1623
diff
changeset
|
1311 ((NumberAxis) domainAxis).setNumberFormatOverride(nf); |
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:
1623
diff
changeset
|
1312 } |
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:
1623
diff
changeset
|
1313 |
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:
1623
diff
changeset
|
1314 |
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:
1623
diff
changeset
|
1315 /** |
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:
1623
diff
changeset
|
1316 * Overrides the NumberFormat with the NumberFormat for the current locale |
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:
1623
diff
changeset
|
1317 * that is provided by 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:
1623
diff
changeset
|
1318 * |
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:
1623
diff
changeset
|
1319 * @param domainAxis The domain axis that needs localization. |
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:
1623
diff
changeset
|
1320 */ |
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:
1623
diff
changeset
|
1321 protected void localizeRangeAxis(ValueAxis rangeAxis) { |
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:
1623
diff
changeset
|
1322 NumberFormat nf = NumberFormat.getInstance(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:
1623
diff
changeset
|
1323 ((NumberAxis) rangeAxis).setNumberFormatOverride(nf); |
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:
1623
diff
changeset
|
1324 } |
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:
1623
diff
changeset
|
1325 |
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:
1623
diff
changeset
|
1326 |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1327 /** |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1328 * @param idx "index" of dataset/series (first dataset to be drawn has |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1329 * index 0), correlates with renderer index. |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1330 * @param isArea true if the series describes an area and shall be rendered |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1331 * as such. |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1332 * @return idx increased by number of items addded. |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1333 */ |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1334 protected int applyThemes( |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1335 XYPlot plot, |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1336 XYSeriesCollection series, |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1337 int idx, |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1338 boolean isArea |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1339 ) { |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1340 LegendItemCollection lic = new LegendItemCollection(); |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1341 LegendItemCollection anno = plot.getFixedLegendItems(); |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1342 |
2055
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
1343 Font legendFont = createLegendLabelFont(); |
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
1344 |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1345 int retidx = idx; |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1346 |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1347 if (isArea) { |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1348 logger.debug("Registering an 'area'renderer at idx: " + idx); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1349 StyledAreaSeriesCollection area = (StyledAreaSeriesCollection) series; |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1350 |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1351 StableXYDifferenceRenderer dRenderer = new StableXYDifferenceRenderer(); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1352 if (area.getMode() == StyledAreaSeriesCollection.FILL_MODE.UNDER) { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1353 dRenderer.setPositivePaint(createTransparentPaint()); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1354 } |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1355 plot.setRenderer(idx, dRenderer); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1356 |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1357 area.applyTheme(dRenderer); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1358 |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1359 LegendItem legendItem = dRenderer.getLegendItem(idx, 0); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1360 if (legendItem != null) { |
2083
b52012d538af
Fixed issue432 (legenditem-size ignored for area legend items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2077
diff
changeset
|
1361 legendItem.setLabelFont(legendFont); |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1362 lic.add(legendItem); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1363 } |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1364 else { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1365 logger.warn("Could not get LegentItem for renderer: " |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1366 + idx + ", series-idx " + 0); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1367 } |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1368 if (anno != null) { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1369 lic.addAll(anno); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1370 } |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1371 plot.setFixedLegendItems(lic); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1372 return retidx + 1; |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1373 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
1374 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1375 XYLineAndShapeRenderer renderer = getRenderer(plot, idx); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1376 |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1377 for (int s = 0, num = series.getSeriesCount(); s < num; s++) { |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1378 XYSeries serie = series.getSeries(s); |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1379 |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1380 if (serie instanceof StyledXYSeries) { |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1381 ((StyledXYSeries) serie).applyTheme(renderer, s); |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1382 } |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1383 |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
1384 // special case: if there is just one single item, we need to enable |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
1385 // points for this series, otherwise we would not see anything in |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
1386 // the chart area. |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1387 if (serie.getItemCount() == 1) { |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1388 renderer.setSeriesShapesVisible(s, true); |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
1389 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
1390 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1391 LegendItem legendItem = renderer.getLegendItem(idx, s); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1392 if (legendItem != null) { |
2055
3cec0575d655
Make use of user defined legend font size while chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2054
diff
changeset
|
1393 legendItem.setLabelFont(legendFont); |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1394 lic.add(legendItem); |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1395 } |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1396 else { |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1397 logger.warn("Could not get LegentItem for renderer: " |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1398 + idx + ", series-idx " + s); |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1399 } |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1400 // TODO: why that? isnt renderer set per dataset not per series? |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1401 retidx++; |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1402 } |
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1403 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1404 if (anno != null) { |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1405 lic.addAll(anno); |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1406 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1407 |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1408 plot.setFixedLegendItems(lic); |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
1409 |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1410 plot.setRenderer(idx, renderer); |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1411 |
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1412 return retidx; |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1413 } |
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1414 |
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1415 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1416 /** Returns a transparently textured paint. */ |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1417 // TODO why not use a transparent color? |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1418 protected static Paint createTransparentPaint() { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1419 BufferedImage texture = new BufferedImage( |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1420 1, 1, BufferedImage.TYPE_4BYTE_ABGR); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1421 |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1422 return new TexturePaint( |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1423 texture, new Rectangle2D.Double(0d, 0d, 0d, 0d)); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1424 } |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1425 |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1426 |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1427 /** |
2072
4cdd9c4896f6
#393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2057
diff
changeset
|
1428 * Returns a new instance of EnhancedLineAndShapeRenderer always. |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
1429 */ |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1430 protected XYLineAndShapeRenderer getRenderer(XYPlot plot, int idx) { |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
1431 logger.debug("getRenderer: " + idx); |
2034
7bc9293de4e6
Fix malcondition where first renderer is StableXYDifferenceRenderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2020
diff
changeset
|
1432 |
2077
29459ddb6f30
Repaired broken legend items.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2074
diff
changeset
|
1433 EnhancedLineAndShapeRenderer r = |
29459ddb6f30
Repaired broken legend items.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2074
diff
changeset
|
1434 new EnhancedLineAndShapeRenderer(true, false); |
29459ddb6f30
Repaired broken legend items.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2074
diff
changeset
|
1435 |
29459ddb6f30
Repaired broken legend items.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2074
diff
changeset
|
1436 r.setPlot(plot); |
29459ddb6f30
Repaired broken legend items.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2074
diff
changeset
|
1437 |
29459ddb6f30
Repaired broken legend items.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2074
diff
changeset
|
1438 return r; |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
1439 } |
1849
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1440 |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1441 |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1442 /** |
1861
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1443 * Register annotations like MainValues for later plotting |
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1444 * |
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1445 * @param o list of annotations (data of facet). |
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1446 * @param facet The facet. This facet does NOT support any data objects. Use |
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1447 * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports |
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1448 * data. |
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1449 * @param theme Theme document for given annotations. |
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1450 * @param visible The visibility of the annotations. |
1849
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1451 */ |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1452 protected void doAnnotations( |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1453 FLYSAnnotation annotations, |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1454 Facet facet, |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1455 Document theme, |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1456 boolean visible |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1457 ){ |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1458 logger.debug("doAnnotations"); |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1459 |
1861
11c4b1429117
Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1849
diff
changeset
|
1460 // Add all annotations to our annotation pool. |
1849
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1461 annotations.setTheme(theme); |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1462 annotations.setLabel(facet.getDescription()); |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1463 addAnnotations(annotations, visible); |
5d5dd44d613e
Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
1464 } |
1986
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1465 |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1466 |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1467 /** |
2049
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1468 * Creates a new instance of <i>IdentifiableNumberAxis</i>. |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1469 * |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1470 * @param idx The index of the new axis. |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1471 * @param label The label of the new axis. |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1472 * |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1473 * @return an instance of IdentifiableNumberAxis. |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1474 */ |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1475 protected NumberAxis createNumberAxis(int idx, String label) { |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1476 YAxisWalker walker = getYAxisWalker(); |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1477 |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1478 return new IdentifiableNumberAxis(walker.getId(idx), label); |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1479 } |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1480 |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1481 |
2d5f2bc68cc6
Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2048
diff
changeset
|
1482 /** |
1986
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1483 * Returns an instance of <i>ChartSettings</i> with a chart specific section |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1484 * but with no axes settings. |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1485 * |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1486 * @return an instance of <i>ChartSettings</i>. |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1487 */ |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1488 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:
2034
diff
changeset
|
1489 if (this.settings != null) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1490 return this.settings; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1491 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1492 |
1986
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1493 ChartSettings settings = new ChartSettings(); |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1494 |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1495 ChartSection chartSection = buildChartSection(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1496 LegendSection legendSection = buildLegendSection(); |
2056
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1497 ExportSection exportSection = buildExportSection(); |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1498 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1499 settings.setChartSection(chartSection); |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1500 settings.setLegendSection(legendSection); |
2056
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1501 settings.setExportSection(exportSection); |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1502 |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
1503 List<AxisSection> axisSections = buildAxisSections(); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
1504 for (AxisSection axisSection: axisSections) { |
1991
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1505 settings.addAxisSection(axisSection); |
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1506 } |
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1507 |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1508 return settings; |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1509 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1510 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1511 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1512 /** |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1513 * Creates a new <i>ChartSection</i>. |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1514 * |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1515 * @return a new <i>ChartSection</i>. |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1516 */ |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1517 protected ChartSection buildChartSection() { |
1986
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1518 ChartSection chartSection = new ChartSection(); |
1989
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
1519 chartSection.setTitle(getChartTitle()); |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
1520 chartSection.setSubtitle(getChartSubtitle()); |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1986
diff
changeset
|
1521 chartSection.setDisplayGird(isGridVisible()); |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1522 return chartSection; |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1523 } |
1986
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1524 |
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1525 |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1526 /** |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1527 * Creates a new <i>LegendSection</i>. |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1528 * |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1529 * @return a new <i>LegendSection</i>. |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1530 */ |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2034
diff
changeset
|
1531 protected LegendSection buildLegendSection() { |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1532 LegendSection legendSection = new LegendSection(); |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1533 legendSection.setVisibility(isLegendVisible()); |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1534 legendSection.setFontSize(getLegendFontSize()); |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1989
diff
changeset
|
1535 return legendSection; |
1986
3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1983
diff
changeset
|
1536 } |
1991
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1537 |
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1538 |
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1539 /** |
2056
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1540 * Creates a new <i>ExportSection</i> with default values <b>WIDTH=600</b> |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1541 * and <b>HEIGHT=400</b>. |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1542 * |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1543 * @return a new <i>ExportSection</i>. |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1544 */ |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1545 protected ExportSection buildExportSection() { |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1546 ExportSection exportSection = new ExportSection(); |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1547 exportSection.setWidth(600); |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1548 exportSection.setHeight(400); |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1549 return exportSection; |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1550 } |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1551 |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1552 |
76eeb3b4358e
Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2055
diff
changeset
|
1553 /** |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1554 * Creates a list of Sections that contains all axes of the chart (including |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1555 * X and Y axes). |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1556 * |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1557 * @return a list of Sections for each axis in this chart. |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1558 */ |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
1559 protected List<AxisSection> buildAxisSections() { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
1560 List<AxisSection> axisSections = new ArrayList<AxisSection>(); |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1561 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1562 axisSections.addAll(buildXAxisSections()); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1563 axisSections.addAll(buildYAxisSections()); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1564 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1565 return axisSections; |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1566 } |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1567 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1568 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1569 /** |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1570 * Creates a new Section for chart's X axis. |
1991
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1571 * |
1997
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1572 * @return a List that contains a Section for the X axis. |
1991
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1573 */ |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
1574 protected List<AxisSection> buildXAxisSections() { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
1575 List<AxisSection> axisSections = new ArrayList<AxisSection>(); |
1997
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1576 |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1577 String identifier = "X"; |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1578 |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1579 AxisSection axisSection = new AxisSection(); |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1580 axisSection.setIdentifier(identifier); |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1581 axisSection.setLabel(getXAxisLabel()); |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1582 axisSection.setFontSize(14); |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1583 axisSection.setFixed(false); |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1584 |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1585 // XXX We are able to find better default ranges that [0,0], but the Y |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1586 // axes currently have no better ranges set. |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1587 axisSection.setUpperRange(0d); |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1588 axisSection.setLowerRange(0d); |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1589 |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1590 axisSections.add(axisSection); |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1591 |
210020108ca4
Implemented the buildAxisSections() method in XYChartGenerator to include an AxisSection for the X axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1991
diff
changeset
|
1592 return axisSections; |
1991
0bd7c3cf0af1
Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
1593 } |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1594 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1595 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1596 /** |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1597 * Creates a list of Section for the chart's Y axes. This method makes use |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1598 * of <i>getYAxisWalker</i> to be able to access all Y axes defined in |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1599 * subclasses. |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1600 * |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1601 * @return a list of Y axis sections. |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1602 */ |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
1603 protected List<AxisSection> buildYAxisSections() { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
1604 List<AxisSection> axisSections = new ArrayList<AxisSection>(); |
2000
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1605 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1606 YAxisWalker walker = getYAxisWalker(); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1607 for (int i = 0, n = walker.length(); i < n; i++) { |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1608 AxisSection ySection = new AxisSection(); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1609 ySection.setIdentifier(walker.getId(i)); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1610 ySection.setLabel(getYAxisLabel(i)); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1611 ySection.setFontSize(14); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1612 ySection.setFixed(false); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1613 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1614 // XXX We are able to find better default ranges that [0,0], the |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1615 // only problem is, that we do NOT have a better range than [0,0] |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1616 // for each axis, because the initial chart will not have a dataset |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1617 // for each axis set! |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1618 ySection.setUpperRange(0d); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1619 ySection.setLowerRange(0d); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1620 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1621 axisSections.add(ySection); |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1622 } |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1623 |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1624 return axisSections; |
e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1997
diff
changeset
|
1625 } |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1626 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1627 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1628 /** Two Ranges that span a rectangular area. */ |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1629 public static class Area { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1630 protected Range xRange; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1631 protected Range yRange; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1632 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1633 public Area(Range rangeX, Range rangeY) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1634 this.xRange = rangeX; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1635 this.yRange = rangeY; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1636 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1637 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1638 public double ofLeft(double percent) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1639 return xRange.getLowerBound() |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1640 + xRange.getLength() * percent; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1641 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1642 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1643 public double ofGround(double percent) { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1644 return yRange.getLowerBound() |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1645 + yRange.getLength() * percent; |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1646 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1647 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1648 public double atTop() { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1649 return yRange.getUpperBound(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1650 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1651 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1652 public double atGround() { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1653 return yRange.getLowerBound(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1654 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1655 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1656 public double atLeft() { |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1657 return xRange.getLowerBound(); |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1658 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
1659 } |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1660 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1661 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |