annotate flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 2242:7e8e1d5384c0

Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines. flys-artifacts/trunk@3890 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 03 Feb 2012 09:39:22 +0000
parents 23c7c51df772
children 99ef93ce18bd
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;
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
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
9 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
10
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
11 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
12 import java.util.HashMap;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
13 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
14 import java.util.Map;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
15
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
16 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
17
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 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
19
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 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
21 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
22 import org.jfree.chart.LegendItemCollection;
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
23 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
24 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
25 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
26 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
27 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
28 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
29 import org.jfree.chart.plot.XYPlot;
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
30 import org.jfree.data.Range;
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
31 import org.jfree.data.general.Series;
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
32 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
33 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
34 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
35
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
36 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
37 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
38
1849
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
39 import de.intevation.artifactdatabase.state.Facet;
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
40
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
41 import de.intevation.flys.jfree.FLYSAnnotation;
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1736
diff changeset
42 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
43 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
44 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
45 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
46
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
47 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
48
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
49 import de.intevation.flys.artifacts.model.HYKFactory;
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
50
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
51 import org.json.JSONArray;
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
52 import org.json.JSONException;
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
53
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
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 /**
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 * 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
57 *
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
58 * 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
59 * <ul>
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
60 * <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
61 * 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
62 * <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
63 * 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
64 * 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
65 * <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
66 * </ul>
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
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 * @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
69 */
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 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
71
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
72 // TODO Consider storing the renderer here.
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
73 private class XYAxisDataset implements AxisDataset {
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
74 /** 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
75 protected int axisSymbol;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
76 /** 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
77 protected List<XYDataset> datasets;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
78 /** 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
79 protected Range range;
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
80 /** Index of axis in plot. */
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
81 protected int plotAxisIndex;
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
82
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
83 /** Create AxisDataset. */
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
84 public XYAxisDataset(int symb) {
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
85 this.axisSymbol = symb;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
86 datasets = new ArrayList<XYDataset>();
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
87 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
88
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
89 /** 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
90 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
91 // 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
92 if (subRange == null ||
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
93 Double.isNaN(subRange.getLowerBound()) ||
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
94 Double.isNaN(subRange.getUpperBound())) {
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
95 return;
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
96 }
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
97 if (range == null) {
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
98 range = subRange;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
99 return;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
100 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
101 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
102 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
103
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
104
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
105 @Override
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
106 public void addDataset(XYDataset dataset) {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
107 datasets.add(dataset);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
108 includeYRange(((XYSeriesCollection) dataset).getSeries(0));
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
109 }
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
110
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
111 /** Add a dataset, include its range. */
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
112 public void addDataset(XYSeries series) {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
113 addDataset(new XYSeriesCollection(series));
1940
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
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
116
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
117 @Override
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
118 public void setRange(Range range) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
119 this.range = range;
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
120 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
121
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
122
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
123 @Override
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
124 public Range getRange() {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
125 return range;
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
126 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
127
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
128
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
129 @Override
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
130 public XYDataset[] getDatasets() {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
131 return (XYDataset[])
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
132 datasets.toArray(new XYDataset[datasets.size()]);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
133 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
134
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
135 public void addArea(StyledAreaSeriesCollection series) {
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
136 this.datasets.add(series);
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
137 }
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
138
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
139 /** True if to be renedered as area. */
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
140 @Override
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
141 public boolean isArea(XYDataset series) {
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
142 return (series instanceof StyledAreaSeriesCollection);
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
143 }
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
144
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
145 /** 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
146 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
147 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
148 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
149
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
150 /** True if no datasets given. */
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
151 @Override
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
152 public boolean isEmpty() {
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
153 return this.datasets.isEmpty();
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
154 }
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
155
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
156 /** Set the 'real' axis index that this axis is mapped to. */
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
157 @Override
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
158 public void setPlotAxisIndex(int axisIndex) {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
159 this.plotAxisIndex = axisIndex;
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
160 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
161
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
162 /** Get the 'real' axis index that this axis is mapped to. */
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
163 @Override
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
164 public int getPlotAxisIndex() {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
165 return this.plotAxisIndex;
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
166 }
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
167 } // class AxisDataset
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
168
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
169
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
170 /** 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
171 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
172 return new YAxisWalker() {
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
173 /** 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
174 @Override
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1997
diff changeset
175 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
176 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
177 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1997
diff changeset
178
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
179 /** 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
180 @Override
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1997
diff changeset
181 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
182 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
183 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1997
diff changeset
184 };
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1997
diff changeset
185 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1997
diff changeset
186
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1997
diff changeset
187
1048
fd5c70973e0b Picky white-space cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 924
diff changeset
188 /** 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
189 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
190
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
191 /** 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
192 protected List<FLYSAnnotation> annotations;
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
193
1685
022f62c75878 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
194 /** 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
195 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
196
1685
022f62c75878 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
197 /** 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
198 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
199
419
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
200
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
201 public XYChartGenerator() {
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
202 super();
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
203
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
204 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
205 yRanges = 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
206 }
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
207
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
208
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 /**
1930
de0c2bbb27f9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
210 * Generate the chart anew (including localized axis and all).
de0c2bbb27f9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
211 */
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
212 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
213 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
214
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 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
216 getChartTitle(),
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 getXAxisLabel(),
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
218 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
219 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
220 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
221 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
222 false,
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 false);
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224
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
225 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
226 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
227 plot.setBackgroundPaint(Color.WHITE);
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 375
diff changeset
228 addSubtitles(chart);
419
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
229 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
230
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
231 //debugAxis(plot);
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
232
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
233 addDatasets(plot);
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
234
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
235 //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
236
1935
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
237 recoverEmptyPlot(plot);
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
238 preparePointRanges(plot);
1935
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
239
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
240 //debugAxis(plot);
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
241
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
242 localizeAxes(plot);
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
243 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
244 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
245
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
246 // 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
247 addAnnotationsToRenderer(plot);
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
248
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
249 return chart;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
250 }
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
251
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
252
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
253 @Override
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
254 protected Series getSeriesOf(XYDataset dataset, int idx) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
255 return ((XYSeriesCollection) dataset).getSeries(idx);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
256 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
257
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
258
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
259 @Override
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
260 protected void setXRange(int axis, Range range) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
261 xRanges.put(Integer.valueOf(axis), range);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
262 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
263
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
264
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
265 @Override
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
266 protected void setYRange(int axis, Range range) {
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
267 yRanges.put(Integer.valueOf(axis), range);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
268 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
269
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
270
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
271 @Override
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
272 protected AxisDataset createAxisDataset(int idx) {
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
273 logger.debug("Create new XYAxisDataset for index: " + idx);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
274 return new XYAxisDataset(idx);
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
275 }
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
276
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
277
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
278 /**
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
279 * 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
280 */
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
281 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
282 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
283 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
284 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
285 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
286 continue;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
287 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
288 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
289 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
290 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
291 + " " + 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
292 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
293 + " " + 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
294 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
295 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
296
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
297
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
298 /**
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
299 * 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
300 */
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
301 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
302 logger.debug("...............");
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
303 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
304 if (plot.getRangeAxis(i) == null)
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
305 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
306 else {
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
307 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
308 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
309 " " + 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
310 "]");
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
311 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
312
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
313 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
314 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
315 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
316
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
317
1685
022f62c75878 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
318 /**
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
319 * Registers an area to be drawn.
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
320 * @param area Area to be drawn.
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
321 * @param index 'axis index'
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
322 * @param visible Whether or not to be visible (important for range calculations).
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
323 */
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
324 public void addAreaSeries(StyledAreaSeriesCollection area, int index, boolean visible) {
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
325 if (area == null) {
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
326 logger.warn("Cannot yet render above/under curve.");
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
327 return;
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
328 }
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
329
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
330 XYAxisDataset axisDataset = (XYAxisDataset) getAxisDataset(index);
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
331
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
332 if (visible) {
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
333 axisDataset.addArea(area);
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
334 }
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
335 else {
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
336 // TODO only range merging.
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
337 }
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
338 //TODO range merging.
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
339 }
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
340
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
341
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
342 /**
1935
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
343 * 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
344 * 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
345 * @param series the dataseries to include in plot.
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
346 * @param index ('symbolic') index of the series and of its axis.
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
347 * @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
348 */
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
349 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
350 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
351 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
352 }
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
353
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
354 logger.debug("Y Range of XYSeries: " +
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
355 series.getMinY() + " | " + series.getMaxY());
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
356
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
357 addAxisDataset(new XYSeriesCollection(series), index, visible);
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
358
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
359 XYAxisDataset axisDataset = (XYAxisDataset) getAxisDataset(index);
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
360
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
361 if (!visible) {
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
362 // 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
363 // 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
364 axisDataset.includeYRange(series);
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
365 }
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
366 }
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
367
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
368
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
369 /**
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
370 * 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
371 * @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
372 * @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
373 */
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
374 protected void combineXRanges(Range range, int 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
375
1959
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
376 if (range == null
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
377 || Double.isNaN(range.getLowerBound())
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
378 || Double.isNaN(range.getUpperBound())) {
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
379 return;
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
380 }
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
381
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
382 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
383
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
384 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
385 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
386 }
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
387
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
388 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
389 }
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
390
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
391
1930
de0c2bbb27f9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
392 /**
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1699
diff changeset
393 * 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
394 */
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
395 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
396 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
397 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
398 }
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
399
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
400 if (annotations == null) {
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
401 annotations = new ArrayList<FLYSAnnotation>();
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
402 }
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
403
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
404 annotations.add(annotation);
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
405 }
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
406
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
407
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
408 /**
1935
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
409 * 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
410 */
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
411 private void recoverEmptyPlot(XYPlot plot) {
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
412 if (plot.getRangeAxis() == null) {
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
413 logger.debug("debug: No range axis");
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
414 plot.setRangeAxis(createYAxis(0));
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
415 }
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
416 }
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
417
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
418
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
419 /**
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
420 * 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
421 */
1686
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
422 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
423 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
424 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
425 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
426
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
427 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
428 if (r != null && r.getLowerBound() == r.getUpperBound()) {
2242
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
429 setXRange(key, ChartHelper.expandRange(r, 5));
1686
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
430 }
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
431 }
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
432 }
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
433
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
434
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
435 /**
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
436 * 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
437 * 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
438 * 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
439 * 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
440 * 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
441 *
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 * @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
443 */
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
444 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
445 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
446
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
447 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
448 Range yrange = getValueAxisRange();
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
449
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
450 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
451
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
452 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
453 if (fixedXRange != null) {
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
454 xAxis.setRange(fixedXRange);
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
455 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
456 else {
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
457 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
458 }
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
459
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
460 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
461 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
462
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
463 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
464 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
465
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
466 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
467 if (fixedRange != null) {
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
468 yaxis.setRange(fixedRange);
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
469 continue;
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
470 }
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
471 }
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
472
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
473 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
474 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
475 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
476 }
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
477
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
478 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
479 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
480 }
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
481 }
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
482
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
483
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
484 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
485 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
486 }
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
487
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
488
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
489 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
490 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
491 }
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
492
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
493
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
494 /**
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
495 * 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
496 *
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
497 * @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
498 * @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
499 * @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
500 * @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
501 *
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
502 * @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
503 */
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
504 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
505
0155cbaba182 XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1735
diff changeset
506 if (range == null) {
0155cbaba182 XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1735
diff changeset
507 return false;
0155cbaba182 XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1735
diff changeset
508 }
0155cbaba182 XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1735
diff changeset
509
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
510 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
511 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
512 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
513 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
514
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
515 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
516 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
517 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
518
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
519 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
520
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
521 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
522
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
523 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
524 }
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
525
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
526 axis.setRangeWithMargins(range);
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
527 return false;
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
528 }
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
529
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
530
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
531 /**
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
532 * 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
533 * 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
534 *
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
535 * @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
536 *
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
537 * @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
538 */
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
539 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
540 logger.debug("getRangesForAxis " + index);
2132
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
541
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
542 Range rx = xRanges.get(Integer.valueOf(0));
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
543 Range ry = yRanges.get(Integer.valueOf(index));
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
544
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
545 if (rx == null) {
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
546 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
547 " Using default values: 0 - 1.");
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
548 rx = new Range(0, 1);
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
549 }
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
550 if (ry == null) {
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
551 logger.warn("Range for y" + index +
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
552 " 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
553 ry = new Range(0, 1);
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
554 }
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
555 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
556 }
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
557
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
558
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
559 /** 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
560 public Paint colorForHYKZone(String zoneName) {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
561 if (zoneName.startsWith("R")) {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
562 // Brownish.
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
563 return new Color(153, 60, 0);
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
564 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
565 else if (zoneName.startsWith("V")) {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
566 // Greenish.
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
567 return new Color(0, 255, 0);
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
568 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
569 else if (zoneName.startsWith("B")) {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
570 // Grayish.
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
571 return new Color(128, 128, 128);
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
572 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
573 else if (zoneName.startsWith("H")) {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
574 // Blueish.
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
575 return new Color(0, 0, 255);
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
576 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
577 else {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
578 // Default.
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
579 logger.debug("Unknown zone type found.");
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
580 return new Color(255, 0, 0);
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
581 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
582 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
583
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
584
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
585 /**
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
586 * 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
587 */
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
588 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
589 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
590 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
591 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
592 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
593 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
594 ) {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
595 // 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
596 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
597 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
598
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
599 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
600 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
601
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
602 int rendererIndex = 0;
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
603
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
604 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
605 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
606 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
607 // 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
608 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
609 // 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
610 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
611 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
612 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
613 new BasicStroke(lineStyle.getWidth()),lineStyle.getColor());
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
614 textAnnotation.setRotationAnchor(TextAnchor.CENTER_LEFT);
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
615 textAnnotation.setTextAnchor(TextAnchor.CENTER_LEFT);
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
616 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
617 else {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
618 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
619 area.atGround(), annotation.getPos(), area.ofGround(LINE_OFF));
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
620 textAnnotation.setRotationAnchor(TextAnchor.CENTER_LEFT);
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
621 textAnnotation.setTextAnchor(TextAnchor.CENTER_LEFT);
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
622 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
623 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
624 else {
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
625 // Do the more complicated case where we stick to the Y-Axis.
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
626 // There is one nasty case (duration curves, where annotations
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
627 // might stick to the second y-axis).
2238
23c7c51df772 Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2236
diff changeset
628 XYAxisDataset dataset = (XYAxisDataset) getAxisDataset(
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
629 new Integer(annotation.getAxisSymbol()));
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
630 if (dataset == null) {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
631 logger.warn("Annotation should stick to unfindable y-axis: "
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
632 + annotation.getAxisSymbol());
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
633 rendererIndex = 0;
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
634 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
635 else {
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
636 rendererIndex = dataset.getPlotAxisIndex();
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
637 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
638
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
639 if (rendererIndex != 0) {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
640 // OPTIMIZE: Pass a different area to this function,
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
641 // do the adding to renderer outside (let this
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
642 // function return the annotations).
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
643 // Note that this path is travelled rarely.
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
644 Area area2 = new Area(plot.getDomainAxis(), plot.getRangeAxis(rendererIndex));
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
645 textAnnotation = new CollisionFreeXYTextAnnotation(
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
646 annotation.getText(), area2.ofRight(TEXT_OFF), annotation.getPos());
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
647 textAnnotation.setRotationAnchor(TextAnchor.CENTER_RIGHT);
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
648 textAnnotation.setTextAnchor(TextAnchor.CENTER_RIGHT);
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
649 // Style the line.
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
650 if (lineStyle != null) {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
651 lineAnnotation = new XYLineAnnotation(area2.ofRight(LINE_OFF),
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
652 annotation.getPos(), area2.atRight(),
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
653 annotation.getPos(), new BasicStroke(lineStyle.getWidth()),
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
654 lineStyle.getColor());
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
655 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
656 else {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
657 lineAnnotation = new XYLineAnnotation(area2.atRight(),
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
658 annotation.getPos(), area2.ofRight(LINE_OFF), annotation.getPos());
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
659 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
660 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
661 else {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
662 textAnnotation = new CollisionFreeXYTextAnnotation(
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
663 annotation.getText(), area.ofLeft(TEXT_OFF), annotation.getPos());
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
664 textAnnotation.setRotationAnchor(TextAnchor.CENTER_LEFT);
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
665 textAnnotation.setTextAnchor(TextAnchor.CENTER_LEFT);
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
666 // Style the line.
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
667 if (lineStyle != null) {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
668 lineAnnotation = new XYLineAnnotation(area.atLeft(),
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
669 annotation.getPos(), area.ofLeft(LINE_OFF),
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
670 annotation.getPos(), new BasicStroke(lineStyle.getWidth()),
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
671 lineStyle.getColor());
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
672 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
673 else {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
674 lineAnnotation = new XYLineAnnotation(area.atLeft(),
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
675 annotation.getPos(), area.ofLeft(LINE_OFF), annotation.getPos());
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
676 }
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
677 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
678 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
679
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
680 // 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
681 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
682 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
683 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
684
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
685 // Add the Annotations to renderer.
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
686 plot.getRenderer(rendererIndex).addAnnotation(textAnnotation,
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
687 org.jfree.ui.Layer.BACKGROUND);
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
688 plot.getRenderer(rendererIndex).addAnnotation(lineAnnotation,
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
689 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
690 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
691
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
692
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
693 /** 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
694 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
695 logger.debug("XYChartGenerator.addAnnotationsToRenderer");
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
696
2143
c5d24e0587ce Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
697 if (annotations == null) {
c5d24e0587ce Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
698 logger.debug("XYChartGenerator.addBoxAnnotations: no annotations.");
c5d24e0587ce Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
699 return;
c5d24e0587ce Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
700 }
c5d24e0587ce Minor hyk-handling improvements.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
701
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
702 // Paints for the boxes/lines.
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
703 Stroke basicStroke = new BasicStroke(1.0f);
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
704
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
705 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
706 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
707 Paint tranPaint = new Color(0, 0,0, 0);
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
708
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
709 // 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
710 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
711 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
712 plot.getRangeAxis().getRange());
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
713
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
714 // 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
715 for (FLYSAnnotation fa: annotations) {
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
716
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
717 // Access text styling, if any.
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
718 Document theme = fa.getTheme();
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
719 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
720 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
721
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
722 // 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
723 if (theme != null) {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
724 ThemeAccess themeAccess = new ThemeAccess(theme);
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
725 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
726 lineStyle = themeAccess.parseLineStyle();
2184
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
727 if (fa.getLabel() != null) {
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
728 LegendItemCollection lic = new LegendItemCollection();
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
729 LegendItemCollection old = plot.getFixedLegendItems();
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
730 lic.add(createLegendItem(theme, fa.getLabel()));
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
731 // (Re-)Add prior legend entries.
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
732 if (old != null) {
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
733 old.addAll(lic);
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
734 }
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
735 else {
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
736 old = lic;
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
737 }
fc86fcfe503e Only add one legend item for manual point themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
738 plot.setFixedLegendItems(old);
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
739 }
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
740 }
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
741
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
742 // 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
743 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
744 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
745 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
746
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
747 // Other Text Annotations.
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
748 for (XYTextAnnotation ta: fa.getTextAnnotations()) {
2193
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
749 // Style the text.
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
750 if (textStyle != null) {
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
751 textStyle.apply(ta);
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
752 }
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
753 ta.setY(area.above(0.05d, ta.getY()));
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
754 plot.getRenderer().addAnnotation(ta, org.jfree.ui.Layer.FOREGROUND);
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
755 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
756
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
757 // Hyks.
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
758 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
759 // 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
760 // 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
761 fillPaint = colorForHYKZone(zone.getName());
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
762
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
763 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
764 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
765 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
766 zone.getTo(), area.atTop(), basicStroke, fillPaint, tranPaint);
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
767
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
768 XYTextAnnotation tex = new XYTextAnnotation(zone.getName(),
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
769 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
770 area.ofGround(0.015f));
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
771 if (textStyle != null) {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
772 textStyle.apply(tex);
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
773 }
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
774
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
775 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
776 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
777 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
778 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
779 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
780 }
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
781
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
782
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
783 /**
2054
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
784 * 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
785 * X axis.
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
786 *
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
787 * @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
788 */
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
789 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
790 ValueAxis xaxis = plot.getDomainAxis();
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
791
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
792 ChartSettings chartSettings = getChartSettings();
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
793 if (chartSettings == null) {
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
794 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
795 }
2054
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
796
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
797 Font labelFont = new Font(
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
798 DEFAULT_FONT_NAME,
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
799 Font.BOLD,
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
800 getXAxisLabelFontSize());
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
801
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
802 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
803 }
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 375
diff changeset
804
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 375
diff changeset
805
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
806 /**
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
807 * 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
808 */
419
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
809 protected void adjustPlot(XYPlot plot) {
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
810 Stroke gridStroke = new BasicStroke(
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
811 DEFAULT_GRID_LINE_WIDTH,
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
812 BasicStroke.CAP_BUTT,
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
813 BasicStroke.JOIN_MITER,
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
814 3.0f,
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
815 new float[] { 3.0f },
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
816 0.0f);
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
817
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
818 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
819 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
820
419
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
821 plot.setDomainGridlineStroke(gridStroke);
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
822 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
823 plot.setDomainGridlinesVisible(isGridVisible);
419
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
824
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
825 plot.setRangeGridlineStroke(gridStroke);
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
826 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
827 plot.setRangeGridlinesVisible(isGridVisible);
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
828
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
829 plot.setAxisOffset(new RectangleInsets(0d, 0d, 0d, 0d));
419
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
830 }
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
831
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
832
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
833 /**
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
834 * 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
835 * 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
836 * 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
837 *
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
838 * @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
839 */
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
840 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
841 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
842 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
843
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
844 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
845 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
846 }
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
847 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
848 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
849 }
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
850 }
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
851
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
852 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
853 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
854
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
855 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
856 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
857 }
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
858 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
859 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
860 }
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
861 }
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
862 }
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
863
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
864
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
865 /**
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
866 * 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
867 * 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
868 *
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
869 * @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
870 */
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
871 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
872 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
873 ((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
874 }
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
875
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
876
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
877 /**
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
878 * 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
879 * 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
880 *
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
881 * @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
882 */
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
883 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
884 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
885 ((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
886 }
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
887
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
888
1932
17e18948fe5e Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
889 /**
1861
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1849
diff changeset
890 * Register annotations like MainValues for later plotting
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1849
diff changeset
891 *
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1849
diff changeset
892 * @param o list of annotations (data of facet).
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1849
diff changeset
893 * @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
894 * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1849
diff changeset
895 * data.
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1849
diff changeset
896 * @param theme Theme document for given annotations.
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1849
diff changeset
897 * @param visible The visibility of the annotations.
1849
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
898 */
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
899 protected void doAnnotations(
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
900 FLYSAnnotation annotations,
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
901 Facet facet,
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
902 Document theme,
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
903 boolean visible
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
904 ){
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
905 logger.debug("doAnnotations");
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
906
1861
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1849
diff changeset
907 // Add all annotations to our annotation pool.
1849
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
908 annotations.setTheme(theme);
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
909 if (facet != null)
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
910 annotations.setLabel(facet.getDescription());
1849
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
911 addAnnotations(annotations, visible);
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
912 }
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
913
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
914
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
915 /**
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
916 * Do Points out.
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
917 */
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
918 protected void doPoints(
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
919 Object o,
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
920 String seriesName,
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
921 Document theme,
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
922 boolean visible,
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
923 int axisIndex
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
924 ) {
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
925 XYSeries series = new StyledXYSeries(seriesName, theme);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
926
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
927 // Add text annotations for single points.
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
928 List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
929
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
930 try {
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
931 JSONArray points = new JSONArray((String) o);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
932 for (int i = 0; i < points.length(); i++) {
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
933 JSONArray array = points.getJSONArray(i);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
934 double x = array.getDouble(0);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
935 double y = array.getDouble(1);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
936 String name = array.getString(2);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
937 boolean act = array.getBoolean(3);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
938 if (!act) {
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
939 continue;
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
940 }
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
941 //logger.debug(" x " + x + " y " + y );
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
942 series.add(x, y, false);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
943 xy.add(new CollisionFreeXYTextAnnotation(name, x, y));
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
944 }
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
945 }
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
946 catch(JSONException e){
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
947 logger.error("Could not decode json.");
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
948 }
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
949
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
950 FLYSAnnotation annotations = new FLYSAnnotation(null, null, null, theme);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
951 annotations.setTextAnnotations(xy);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
952
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
953 doAnnotations(annotations, null, theme, visible);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
954 addAxisSeries(series, axisIndex, visible);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
955 }
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
956
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
957
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
958 /** 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
959 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
960 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
961 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
962
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
963 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
964 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
965 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
966 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
967
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
968 public Area(ValueAxis axisX, ValueAxis axisY) {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
969 this.xRange = axisX.getRange();
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
970 this.yRange = axisY.getRange();
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
971 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
972
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
973 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
974 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
975 + 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
976 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
977
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
978 public double ofRight(double percent) {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
979 return xRange.getUpperBound()
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
980 - xRange.getLength() * percent;
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
981 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
982
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
983 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
984 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
985 + 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
986 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
987
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
988 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
989 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
990 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
991
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
992 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
993 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
994 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
995
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
996 public double atRight() {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
997 return xRange.getUpperBound();
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
998 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
999
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
1000 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
1001 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
1002 }
2193
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
1003
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
1004 public double above(double percent, double base) {
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
1005 return base + yRange.getLength() * percent;
73490b828a90 Manual Point Theming improved.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2184
diff changeset
1006 }
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
1007 }
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1008 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1009 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org