annotate flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 3976:b7b8e625ec82

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:50 +0200
parents 2f6d4f92d628 1558ef7b0e7b
children 3aec5a42696a
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
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 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
4 import java.awt.Font;
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
5 import java.text.NumberFormat;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
6 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
7 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
8 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
9 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
10
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
11 import javax.swing.ImageIcon;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
12
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 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
14 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
15 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
16 import org.jfree.chart.LegendItem;
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
17 import org.jfree.chart.annotations.XYAnnotation;
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
18 import org.jfree.chart.annotations.XYImageAnnotation;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
19 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
20 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
21 import org.jfree.chart.axis.ValueAxis;
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
22 import org.jfree.chart.plot.Marker;
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 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
24 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
25 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
26 import org.jfree.data.general.Series;
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
27 import org.jfree.data.xy.XYDataset;
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
28 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
29 import org.jfree.data.xy.XYSeriesCollection;
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
30 import org.json.JSONArray;
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
31 import org.json.JSONException;
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
32 import org.w3c.dom.Document;
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
2325
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2300
diff changeset
34 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
2330
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
35 import de.intevation.flys.jfree.Bounds;
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3249
diff changeset
36 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3249
diff changeset
37 import de.intevation.flys.jfree.DoubleBounds;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
38 import de.intevation.flys.jfree.FLYSAnnotation;
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
39 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
40 import de.intevation.flys.jfree.StyledXYSeries;
1849
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
41
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 /**
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 * 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
45 *
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
46 * 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
47 * <ul>
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
48 * <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
49 * 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
50 * <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
51 * 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
52 * 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
53 * <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
54 * </ul>
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
55 *
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 * @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
57 */
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 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
59
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 3227
diff changeset
60 public 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
61 /** 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
62 protected int axisSymbol;
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
63
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
64 /** 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
65 protected List<XYDataset> datasets;
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
66
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
67 /** 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
68 protected Range range;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
69
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
70 /** 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
71 protected int plotAxisIndex;
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
72
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
73 /** 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
74 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
75 this.axisSymbol = symb;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
76 datasets = new ArrayList<XYDataset>();
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
77 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
78
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
79 /** 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
80 private void mergeRanges(Range subRange) {
3811
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
81 // Avoid merging NaNs, as they take min/max place forever.
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
82 if (subRange == null ||
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
83 Double.isNaN(subRange.getLowerBound()) ||
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
84 Double.isNaN(subRange.getUpperBound())) {
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
85 return;
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
86 }
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
87 if (range == null) {
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
88 range = subRange;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
89 return;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
90 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
91 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
92 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
93
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
94
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
95 /** Add a dataset to internal list for this 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
96 @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
97 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
98 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
99 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
100 }
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
101
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
102 /** 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
103 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
104 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
105 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
106
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
107
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
108 /** Set Range for this axis. */
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
109 @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
110 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
111 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
112 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
113
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
114
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
115 /** Get Range for this axis. */
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 @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
117 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
118 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
119 }
7e8e1d5384c0 Further refactoring of 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
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
122 /** Get Array of Datasets. */
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
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 XYDataset[] getDatasets() {
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
125 return datasets.toArray(new XYDataset[datasets.size()]);
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
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
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
128
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
129 /** Add a Dataset that describes an area. */
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
130 public void addArea(StyledAreaSeriesCollection series) {
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
131 this.datasets.add(series);
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
132 List<?> allSeries = series.getSeries();
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
133 for (int n = 0; n < allSeries.size(); n++) {
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
134 includeYRange((XYSeries)allSeries.get(n));
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
135 }
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
136 }
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
137
2574
3598690dc9e2 Fix flys/issue501 (manual points have two legend entries).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2422
diff changeset
138 /** True if to be rendered 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
139 @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
140 public boolean isArea(XYDataset series) {
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
141 return (series instanceof StyledAreaSeriesCollection);
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
142 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
143
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
144 /** Adjust range to include given dataset. */
3811
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
145 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
146 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
147 }
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 /** 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
150 @Override
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
151 public boolean isEmpty() {
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
152 return this.datasets.isEmpty();
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
153 }
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 /** 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
156 @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
157 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
158 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
159 }
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
160
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
161 /** 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
162 @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
163 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
164 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
165 }
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
166 } // class AxisDataset
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
167
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
168 /** Enumerator over existing axes. */
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
169 @Override
2246
99ef93ce18bd Doc added and fix getAxisWalker-issue.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2242
diff changeset
170 protected abstract YAxisWalker getYAxisWalker();
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
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
172 public static final int AXIS_SPACE = 5;
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
173
1048
fd5c70973e0b Picky white-space cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 924
diff changeset
174 /** 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
175 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
176
3064
478e8d9d88ba Add missing imports.
Christian Lins <christian.lins@intevation.de>
parents: 3063
diff changeset
177 protected List<Marker> domainMarkers = new ArrayList<Marker>();
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
178
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
179 protected List<Marker> valueMarkers = new ArrayList<Marker>();
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
180
1685
022f62c75878 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
181 /** The max X range to include all X values of all series for each axis. */
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
182 protected Map<Integer, Bounds> xBounds;
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1679
diff changeset
183
1685
022f62c75878 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
184 /** The max Y range to include all Y values of all series for each axis. */
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
185 protected Map<Integer, Bounds> yBounds;
419
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
186
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
187 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
188 super();
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
190 xBounds = new HashMap<Integer, Bounds>();
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
191 yBounds = new HashMap<Integer, Bounds>();
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
192 }
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
193
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
194
1930
de0c2bbb27f9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
195 /**
de0c2bbb27f9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
196 * Generate the chart anew (including localized axis and all).
de0c2bbb27f9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
197 */
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
198 @Override
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
199 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
200 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
201
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 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
203 getChartTitle(),
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 getXAxisLabel(),
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
205 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
206 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
207 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
208 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
209 false,
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 false);
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211
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
212 XYPlot plot = (XYPlot) chart.getPlot();
3079
8ad8a227d983 Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
213 plot.setDomainAxis(createXAxis(getXAxisLabel()));
8ad8a227d983 Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
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 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
216 plot.setBackgroundPaint(Color.WHITE);
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 375
diff changeset
217 addSubtitles(chart);
419
4de7d9eac10f Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
218 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
219
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
220 //debugAxis(plot);
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
221
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
222 addDatasets(plot);
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
223
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
224 //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
225
3063
33c167d6fff6 Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 2998
diff changeset
226 addMarkers(plot);
33c167d6fff6 Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 2998
diff changeset
227
1935
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
228 recoverEmptyPlot(plot);
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
229 preparePointRanges(plot);
1935
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
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 localizeAxes(plot);
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
234 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
235 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
236
3249
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
237 //debugAxis(plot);
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
238
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
239 // 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
240 addAnnotationsToRenderer(plot);
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
241
3616
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
242 // Add a logo (maybe).
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
243 addLogo(plot);
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
244
3154
a08538e21b55 Re-enable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3114
diff changeset
245 aggregateLegendEntries(plot);
2584
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
246
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
247 return chart;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
248 }
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
249
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
250
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
251 /**
3621
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
252 * Return left most data points x value (on first axis).
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
253 * Shortcut, especially to be overridden in (LS) charts where
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
254 * axis could be inverted.
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
255 */
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
256 protected double getLeftX() {
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
257 return (Double)getXBounds(0).getLower();
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
258 }
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
259
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
260
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
261 /**
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
262 * Return right most data points x value (on first axis).
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
263 * Shortcut, especially to be overridden in (LS) charts where
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
264 * axis could be inverted.
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
265 */
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
266 protected double getRightX() {
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
267 return (Double)getXBounds(0).getUpper();
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
268 }
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
269
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
270
3616
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
271 /** Add a logo as background annotation to plot. */
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
272 protected void addLogo(XYPlot plot) {
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
273 String logo = showLogo();
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
274 if (logo == null) {
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
275 logger.debug("No logo to show chosen");
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
276 return;
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
277 }
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
278
3633
ebfce31c7eec Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3623
diff changeset
279 ImageIcon imageIcon = null;
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
280 if (logo.equals("none")) {
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
281 return;
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
282 }
3623
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
283 /*
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
284 If you want to add images, remember to change code in these places:
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
285 flys-artifacts:
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
286 XYChartGenerator.java
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
287 Timeseries*Generator.java and
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
288 in the flys-client projects Chart*Propert*Editor.java.
3638
6bfcbe391393 Better comment for logo-adders.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3633
diff changeset
289 Also, these images have to be put in
6bfcbe391393 Better comment for logo-adders.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3633
diff changeset
290 flys-artifacts/src/main/resources/images/
6bfcbe391393 Better comment for logo-adders.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3633
diff changeset
291 flys-client/src/main/webapp/images/
3623
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
292 */
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
293 java.net.URL imageURL;
3616
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
294 if (logo.equals("Intevation")) {
3623
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
295 imageURL = XYChartGenerator.class.getResource("/images/intevation.png");
3616
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
296 }
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
297 else { // TODO else if ...
3623
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
298 imageURL = XYChartGenerator.class.getResource("/images/bfg_logo.gif");
3616
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
299 }
3623
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
300 imageIcon = new ImageIcon(imageURL);
119b8ba2b77f Include logos in resources.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3621
diff changeset
301
3616
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
302
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
303 double xPos = 0d, yPos = 0d;
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
304
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
305 String placeh = logoHPlace();
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
306 String placev = logoVPlace();
3620
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
307
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
308 if (placev == null || placev.equals("none")) {
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
309 placev = "top";
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
310 }
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
311 if (placev.equals("top")) {
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
312 yPos = (Double)getYBounds(0).getUpper();
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
313 }
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
314 else if (placev.equals("bottom")) {
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
315 yPos = (Double)getYBounds(0).getLower();
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
316 }
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
317 else if (placev.equals("center")) {
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
318 yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d;
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
319 }
3620
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
320 else {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
321 logger.debug("Unknown place-v value: " + placev);
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
322 }
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
323
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
324 if (placeh == null || placeh.equals("none")) {
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
325 placeh = "center";
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
326 }
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
327 if (placeh.equals("left")) {
3621
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
328 xPos = getLeftX();
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
329 }
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
330 else if (placeh.equals("right")) {
3621
6772e9f9b65f Deal with inverted axes in longitudinal charts and logos.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3620
diff changeset
331 xPos = getRightX();
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
332 }
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
333 else if (placeh.equals("center")) {
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
334 xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d;
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
335 }
3620
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
336 else {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
337 logger.debug("Unknown place-h value: " + placeh);
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
338 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
339
3617
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
340 logger.debug("logo position: " + xPos + "/" + yPos);
05deafdcbf39 sloppy logo placement property implementation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3616
diff changeset
341
3620
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
342 org.jfree.ui.RectangleAnchor anchor
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
343 = org.jfree.ui.RectangleAnchor.TOP;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
344 if (placev.equals("top")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
345 if (placeh.equals("left")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
346 anchor = org.jfree.ui.RectangleAnchor.TOP_LEFT;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
347 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
348 else if (placeh.equals("right")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
349 anchor = org.jfree.ui.RectangleAnchor.TOP_RIGHT;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
350 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
351 else if (placeh.equals("center")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
352 anchor = org.jfree.ui.RectangleAnchor.TOP;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
353 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
354 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
355 else if (placev.equals("bottom")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
356 if (placeh.equals("left")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
357 anchor = org.jfree.ui.RectangleAnchor.BOTTOM_LEFT;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
358 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
359 else if (placeh.equals("right")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
360 anchor = org.jfree.ui.RectangleAnchor.BOTTOM_RIGHT;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
361 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
362 else if (placeh.equals("center")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
363 anchor = org.jfree.ui.RectangleAnchor.BOTTOM;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
364 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
365 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
366 else if (placev.equals("center")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
367 if (placeh.equals("left")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
368 anchor = org.jfree.ui.RectangleAnchor.LEFT;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
369 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
370 else if (placeh.equals("right")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
371 anchor = org.jfree.ui.RectangleAnchor.RIGHT;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
372 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
373 else if (placeh.equals("center")) {
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
374 anchor = org.jfree.ui.RectangleAnchor.CENTER;
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
375 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
376 }
1cd6114603d9 Improved logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3618
diff changeset
377
3616
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
378 XYAnnotation xyannotation =
3633
ebfce31c7eec Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3623
diff changeset
379 new XYImageAnnotation(xPos, yPos, imageIcon.getImage(), anchor);
ebfce31c7eec Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3623
diff changeset
380 plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND);
3616
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
381 }
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
382
d4751be54745 Add rather faked image annotations to chart, if property is set accordingly.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3296
diff changeset
383
3079
8ad8a227d983 Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
384 protected NumberAxis createXAxis(String label) {
8ad8a227d983 Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
385 return new NumberAxis(label);
8ad8a227d983 Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
386 }
8ad8a227d983 Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
387
8ad8a227d983 Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
388
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
389 @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
390 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
391 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
392 }
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
393
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
394
7e8e1d5384c0 Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2238
diff changeset
395 @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
396 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
397 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
398 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
399 }
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
400
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
401
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
402 /**
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
403 * 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
404 */
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
405 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
406 logger.debug("Number of datasets: " + plot.getDatasetCount());
3087
4a76da133144 Removed repeated x.size() calls from for loops.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3079
diff changeset
407 for (int i = 0, P = plot.getDatasetCount(); i < P; i++) {
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
408 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
409 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
410 continue;
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
411 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
412 logger.debug("Dataset #" + i + ":" + plot.getDataset(i));
3811
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
413 XYSeriesCollection series = (XYSeriesCollection) plot.getDataset(i);
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
414 logger.debug("X-Extend of Dataset: " + series.getSeries(0).getMinX()
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
415 + " " + series.getSeries(0).getMaxX());
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
416 logger.debug("Y-Extend of Dataset: " + series.getSeries(0).getMinY()
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
417 + " " + 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
418 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
419 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
420
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
421
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
422 /**
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
423 * 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
424 */
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
425 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
426 logger.debug("...............");
3087
4a76da133144 Removed repeated x.size() calls from for loops.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3079
diff changeset
427 for (int i = 0, P = plot.getRangeAxisCount(); i < P; i++) {
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
428 if (plot.getRangeAxis(i) == null)
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
429 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
430 else {
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
431 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
432 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
433 " " + 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
434 "]");
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
435 }
3249
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
436 }
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
437 for (int i = 0, P = plot.getDomainAxisCount(); i < P; i++) {
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
438 if (plot.getDomainAxis(i) == null)
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
439 logger.debug("Domain-Axis #" + i + " == null");
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
440 else {
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
441 logger.debug("Domain-Axis " + i + " != null [" +
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
442 plot.getDomainAxis(i).getRange().getLowerBound() +
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
443 " " + plot.getDomainAxis(i).getRange().getUpperBound() +
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
444 "]");
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
445 }
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
446 }
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
447 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
448 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
449
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
450
1685
022f62c75878 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
451 /**
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
452 * 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
453 * @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
454 * @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
455 * @param visible Whether or not to be visible (important for range calculations).
1685
022f62c75878 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
456 */
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
457 public void addAreaSeries(StyledAreaSeriesCollection area, int index, boolean visible) {
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
458 if (area == null) {
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
459 logger.warn("Cannot yet render above/under curve.");
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
460 return;
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
461 }
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
462
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
463 XYAxisDataset axisDataset = (XYAxisDataset) getAxisDataset(index);
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
464
2020
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
465 if (visible) {
4f7f781e4481 Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2005
diff changeset
466 axisDataset.addArea(area);
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
467 }
2005
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
468 else {
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
469 // TODO only range merging.
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
470 }
79b15491177a Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2000
diff changeset
471 //TODO range merging.
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
472 }
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
473
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
474
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
475 /**
1935
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
476 * 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
477 * all points in data would be plotted once visible).
3906
fc6c6f6039df Fix for area clipping problem in longitudinal section char
Christian Lins <christian.lins@intevation.de>
parents: 3650
diff changeset
478 * @param series the data series 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
479 * @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
480 * @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
481 */
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
482 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
483 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
484 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
485 }
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
486
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
487 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
488 series.getMinY() + " | " + series.getMaxY());
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
489
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
490 addAxisDataset(new XYSeriesCollection(series), index, visible);
3811
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
491
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
492 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
493
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
494 if (!visible) {
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
495 // 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
496 // that every data-point could be seen (except for annotations).
3811
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
497 axisDataset.includeYRange(series);
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
498 }
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1930
diff changeset
499 }
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
500
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
501
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
502 /**
3063
33c167d6fff6 Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 2998
diff changeset
503 * Add the given vertical marker to the chart.
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
504 */
3063
33c167d6fff6 Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 2998
diff changeset
505 public void addDomainMarker(Marker marker) {
33c167d6fff6 Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 2998
diff changeset
506 if (marker == null) {
1959
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
507 return;
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
508 }
eace020067da Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1958
diff changeset
509
3064
478e8d9d88ba Add missing imports.
Christian Lins <christian.lins@intevation.de>
parents: 3063
diff changeset
510 domainMarkers.add(marker);
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
511 }
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
512
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
513
1930
de0c2bbb27f9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
514 /**
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
515 * Add the given vertical marker to the chart.
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1699
diff changeset
516 */
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
517 public void addValueMarker(Marker marker) {
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
518 if (marker == 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
519 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
520 }
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
521
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
522 valueMarkers.add(marker);
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
523 }
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
524
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
525
3063
33c167d6fff6 Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 2998
diff changeset
526 protected void addMarkers(XYPlot plot) {
33c167d6fff6 Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 2998
diff changeset
527 for(Marker marker : domainMarkers) {
3064
478e8d9d88ba Add missing imports.
Christian Lins <christian.lins@intevation.de>
parents: 3063
diff changeset
528 plot.addDomainMarker(marker);
3063
33c167d6fff6 Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents: 2998
diff changeset
529 }
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
530 for(Marker marker : valueMarkers) {
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
531 plot.addRangeMarker(marker);
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3160
diff changeset
532 }
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
533 }
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
534
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
535
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
536 /**
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
537 * Effect: extend range of x axis to include given limits.
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
538 *
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3257
diff changeset
539 * @param bounds the given ("minimal") bounds.
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
540 * @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
541 */
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
542 @Override
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
543 protected void combineXBounds(Bounds bounds, int index) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
544 if (!(bounds instanceof DoubleBounds)) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
545 logger.warn("Unsupported Bounds type: " + bounds.getClass());
3811
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
546 return;
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
547 }
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
548
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
549 DoubleBounds dBounds = (DoubleBounds) bounds;
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
550
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
551 if (dBounds == null
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
552 || Double.isNaN((Double) dBounds.getLower())
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
553 || Double.isNaN((Double) dBounds.getUpper())) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
554 return;
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
555 }
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
556
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
557 Bounds old = getXBounds(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
558
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
559 if (old != null) {
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
560 dBounds = (DoubleBounds) dBounds.combine(old);
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
561 }
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
562
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
563 setXBounds(index, dBounds);
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
564 }
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
565
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
566
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
567 @Override
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
568 protected void combineYBounds(Bounds bounds, int index) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
569 if (!(bounds instanceof DoubleBounds)) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
570 logger.warn("Unsupported Bounds type: " + bounds.getClass());
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
571 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
572 }
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
573
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
574 DoubleBounds dBounds = (DoubleBounds) bounds;
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
575
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
576 if (dBounds == null
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
577 || Double.isNaN((Double) dBounds.getLower())
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
578 || Double.isNaN((Double) dBounds.getUpper())) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
579 return;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
580 }
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
581
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
582 Bounds old = getYBounds(index);
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
583
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
584 if (old != null) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
585 dBounds = (DoubleBounds) dBounds.combine(old);
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
586 }
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
588 setYBounds(index, dBounds);
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
589 }
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
590
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
591
1935
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
592 /**
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
593 * 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
594 */
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
595 private void recoverEmptyPlot(XYPlot plot) {
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
596 if (plot.getRangeAxis() == null) {
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
597 logger.debug("debug: No range axis");
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
598 plot.setRangeAxis(createYAxis(0));
5b51f5232661 Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1934
diff changeset
599 }
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
600 }
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
601
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
602
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
603 /**
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
604 * 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
605 */
1686
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
606 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
607 for (int i = 0, num = plot.getDomainAxisCount(); i < num; i++) {
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
608
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
609 Integer key = Integer.valueOf(i);
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
610 Bounds b = getXBounds(key);
1686
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
611
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
612
3249
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
613 if (b != null && b.getLower().equals(b.getUpper())) {
3296
45af081061e7 Added overview output for sq relation. Currently the overview generator is
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3270
diff changeset
614 logger.debug("Check whether to expand a x axis.i ("+b.getLower() + "-" + b.getUpper()+")");
3249
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
615 setXBounds(key, ChartHelper.expandBounds(b, 5));
1686
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
616 }
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
617 }
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
618 }
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
619
e8d1e531687a Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1685
diff changeset
620
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
621 /**
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
622 * 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
623 * 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
624 * 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
625 * 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
626 * 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
627 *
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
628 * @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
629 */
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
630 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
631 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
632
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
633 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
634 Range yrange = getValueAxisRange();
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
635
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
636 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
637
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
638 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
639 if (fixedXRange != null) {
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
640 xAxis.setRange(fixedXRange);
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
641 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
642 else {
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
643 zoomX(plot, xAxis, getXBounds(0), xrange);
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
644 }
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 718
diff changeset
645
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
646 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
647 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
648
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
649 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
650 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
651
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
652 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
653 if (fixedRange != null) {
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
654 yaxis.setRange(fixedRange);
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
655 continue;
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
656 }
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
657 }
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
658
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
659 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
660 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
661 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
662 }
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
663
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
664 logger.debug("Prepare zoom settings for y axis at index: " + i);
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
665 zoomY(plot, yaxis, getYBounds(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
666 }
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
667 }
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
668
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
669
2330
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
670 protected Range getDomainAxisRange() {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
671 String[] ranges = getDomainAxisRangeFromRequest();
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
672
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
673 if (ranges == null || ranges.length < 2) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
674 logger.debug("No zoom range for domain axis specified.");
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
675 return null;
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
676 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
677
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
678 if (ranges[0].length() > 0 && ranges[1].length() > 0) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
679 try {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
680 double from = Double.parseDouble(ranges[0]);
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
681 double to = Double.parseDouble(ranges[1]);
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
682
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
683 if (from == 0 && to == 0) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
684 logger.debug("No range specified. Lower and upper X == 0");
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
685 return null;
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
686 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
687
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
688 if (from > to) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
689 double tmp = to;
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
690 to = from;
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
691 from = tmp;
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
692 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
693
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
694 return new Range(from, to);
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
695 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
696 catch (NumberFormatException nfe) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
697 logger.warn("Wrong values for domain axis range.");
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
698 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
699 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
700
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
701 return null;
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
702 }
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
703
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
704
2330
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
705 protected Range getValueAxisRange() {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
706 String[] ranges = getValueAxisRangeFromRequest();
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
707
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
708 if (ranges == null || ranges.length < 2) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
709 logger.debug("No range specified. Lower and upper Y == 0");
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
710 return null;
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
711 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
712
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
713 if (ranges[0].length() > 0 && ranges[1].length() > 0) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
714 try {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
715 double from = Double.parseDouble(ranges[0]);
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
716 double to = Double.parseDouble(ranges[1]);
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
717
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
718 if (from == 0 && to == 0) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
719 logger.debug("No range specified. Lower and upper Y == 0");
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
720 return null;
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
721 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
722
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
723 return from > to
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
724 ? new Range(to, from)
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
725 : new Range(from, to);
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
726 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
727 catch (NumberFormatException nfe) {
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
728 logger.warn("Wrong values for value axis range.");
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
729 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
730 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
731
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
732 return null;
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
733 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
734
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
735
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
736 protected boolean zoomX(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
737 return zoom(plot, axis, bounds, x);
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
738 }
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
739
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
740
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
741 protected boolean zoomY(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
742 return zoom(plot, axis, bounds, x);
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
743 }
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
744
f3fd8c9b7f51 #157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 717
diff changeset
745
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
746 /**
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
747 * 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
748 *
3811
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
749 * @param plot The XYPlot.
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
750 * @param axis The axis the shoud be modified.
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3257
diff changeset
751 * @param bounds The whole range specified by a dataset.
3811
1558ef7b0e7b Picked rev3357, rev3359 and rev3360 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
752 * @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
753 *
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
754 * @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
755 */
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
756 protected boolean zoom(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) {
1736
0155cbaba182 XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1735
diff changeset
757
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
758 if (bounds == null) {
1736
0155cbaba182 XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1735
diff changeset
759 return false;
0155cbaba182 XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1735
diff changeset
760 }
0155cbaba182 XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1735
diff changeset
761
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
762 if (x != null) {
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
763 double min = bounds.getLower().doubleValue();
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
764 double max = bounds.getUpper().doubleValue();
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
765
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
766 if (logger.isDebugEnabled()) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
767 logger.debug("Minimum is: " + min);
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
768 logger.debug("Maximum is: " + max);
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
769 logger.debug("Lower zoom is: " + x.getLowerBound());
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
770 logger.debug("Upper zoom is: " + x.getUpperBound());
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
771 }
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
772
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
773 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
774
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
775 DoubleBounds computed = new DoubleBounds(
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
776 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
777 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
778
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
779 computed.applyBounds(axis, AXIS_SPACE);
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
780
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
781 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
782
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
783 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
784 }
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
785
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
786 bounds.applyBounds(axis, AXIS_SPACE);
654
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
787 return false;
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
788 }
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
789
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
790
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
791 /**
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
792 * Extract the minimum and maximum values for x and y axes
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
793 * 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
794 *
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
795 * @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
796 *
bbc966c81809 #90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 653
diff changeset
797 * @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
798 */
2261
6aeb71517136 Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2246
diff changeset
799 @Override
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
800 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
801 logger.debug("getRangesForAxis " + index);
2132
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
802
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
803 Bounds rx = getXBounds(Integer.valueOf(0));
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
804 Bounds ry = getYBounds(Integer.valueOf(index));
2132
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
805
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
806 if (rx == null) {
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
807 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
808 " Using default values: 0 - 1.");
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
809 rx = new DoubleBounds(0, 1);
2132
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
810 }
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
811 if (ry == null) {
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
812 logger.warn("Range for y" + index +
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
813 " axis not set. Using default values: 0 - 1.");
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
814 ry = new DoubleBounds(0, 1);
2132
e8fc770d2f8c 'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2110
diff changeset
815 }
2330
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
816
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
817 return new Range[] {
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
818 new Range(rx.getLower().doubleValue(), rx.getUpper().doubleValue()),
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
819 new Range(ry.getLower().doubleValue(), ry.getUpper().doubleValue())
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
820 };
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
821 }
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
822
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
823
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
824 /** Get X (usually horizontal) extent for given axis. */
2330
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
825 @Override
2398
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
826 public Bounds getXBounds(int axis) {
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
827 return xBounds.get(axis);
2330
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
828 }
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
829
594885703687 Picked changes r4015:4026 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
830
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
831 /** Set X (usually horizontal) extent for given axis. */
2398
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
832 @Override
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
833 protected void setXBounds(int axis, Bounds bounds) {
3249
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
834 if (bounds.getLower() == bounds.getUpper()) {
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
835 xBounds.put(axis, ChartHelper.expandBounds(bounds, 5d));
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
836 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
837 else {
3249
f76cef888ee1 Fix issue710 - crashing one-point-diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3242
diff changeset
838 xBounds.put(axis, bounds);
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
839 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
840 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
841
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
842
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
843 /** Get Y (usually vertical) extent for given axis. */
2398
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
844 @Override
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
845 public Bounds getYBounds(int axis) {
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
846 return yBounds.get(axis);
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
847 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
848
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
849
2710
013882485011 Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2706
diff changeset
850 /** Set Y (usually vertical) extent for given axis. */
2398
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
851 @Override
5d8d24984819 New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2395
diff changeset
852 protected void setYBounds(int axis, Bounds bounds) {
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2584
diff changeset
853 yBounds.put(axis, bounds);
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2132
diff changeset
854 }
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
855
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2143
diff changeset
856
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
857 /**
2054
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
858 * 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
859 * X axis.
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
860 *
3650
cbe2febe30cc Merged revisions 5391-5392 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3638
diff changeset
861 * (Duplicate in TimeseriesChartGenerator)
cbe2febe30cc Merged revisions 5391-5392 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3638
diff changeset
862 *
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
863 * @param plot The XYPlot of the chart.
1940
0d12e70766c8 Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1935
diff changeset
864 */
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
865 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
866 ValueAxis xaxis = plot.getDomainAxis();
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
867
2054
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
868 ChartSettings chartSettings = getChartSettings();
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
869 if (chartSettings == null) {
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
870 return;
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
871 }
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
872
2054
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
873 Font labelFont = new Font(
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
874 DEFAULT_FONT_NAME,
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
875 Font.BOLD,
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
876 getXAxisLabelFontSize());
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
877
2054
a653295c9ac0 Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
878 xaxis.setLabelFont(labelFont);
2590
d75b427da50a #522 Modified axes creation: label and tick label fonts will now always be the same.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
879 xaxis.setTickLabelFont(labelFont);
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 375
diff changeset
880 }
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
881
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
882
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
883 /**
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 * 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
885 * 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
886 * 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
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 * @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
889 */
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
890 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
891 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
892 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
893
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
894 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
895 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
896 }
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
897 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
898 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
899 }
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
900 }
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
901
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
902 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
903 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
904
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
905 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
906 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
907 }
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
908 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
909 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
910 }
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
911 }
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
912 }
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
913
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
914
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
915 /**
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
916 * 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
917 * 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
918 *
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
919 * @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
920 */
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
921 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
922 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
923 ((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
924 }
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
925
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
926
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
927 /**
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
928 * 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
929 * 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
930 *
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3257
diff changeset
931 * @param rangeAxis The domain axis that needs localization.
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
932 */
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
933 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
934 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
935 ((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
936 }
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
937
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
938
1932
17e18948fe5e Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
939 /**
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
940 * Do Points out.
1932
17e18948fe5e Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
941 */
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
942 protected void doPoints(
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
943 Object o,
2325
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2300
diff changeset
944 ArtifactAndFacet aandf,
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
945 Document theme,
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
946 boolean visible,
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
947 int axisIndex
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
948 ) {
2325
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2300
diff changeset
949 String seriesName = aandf.getFacetDescription();
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
950 XYSeries series = new StyledXYSeries(seriesName, theme);
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
951
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
952 // 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
953 List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
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
954
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
955 try {
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
956 JSONArray points = new JSONArray((String) o);
3087
4a76da133144 Removed repeated x.size() calls from for loops.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3079
diff changeset
957 for (int i = 0, P = points.length(); i < P; i++) {
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
958 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
959 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
960 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
961 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
962 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
963 if (!act) {
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
964 continue;
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
965 }
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
966 //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
967 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
968 xy.add(new CollisionFreeXYTextAnnotation(name, x, y));
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
969 }
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
970 }
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
971 catch(JSONException e){
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
972 logger.error("Could not decode json.");
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
973 }
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
974
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
975 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
976 annotations.setTextAnnotations(xy);
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1645
diff changeset
977
2574
3598690dc9e2 Fix flys/issue501 (manual points have two legend entries).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2422
diff changeset
978 // Do not generate second legend entry. (null was passed for the aand before).
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2193
diff changeset
979 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
980 addAxisSeries(series, axisIndex, visible);
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
981 }
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
982
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
983
1932
17e18948fe5e Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
984 /**
2584
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
985 * Create a hash from a legenditem.
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
986 * This hash can then be used to merge legend items labels.
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
987 * @return hash for given legenditem to identify mergeables.
1932
17e18948fe5e Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
988 */
2584
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
989 public static String legendItemHash(LegendItem li) {
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
990 // TODO Do proper implementation. Ensure that only mergable sets are created.
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
991 // getFillPaint()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
992 // getFillPaintTransformer()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
993 // getLabel()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
994 // getLine()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
995 // getLinePaint()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
996 // getLineStroke()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
997 // getOutlinePaint()
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3064
diff changeset
998 // getOutlineStroke()
2584
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
999 // Shape getShape()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
1000 // String getToolTipText()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
1001 // String getURLText()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
1002 // boolean isLineVisible()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
1003 // boolean isShapeFilled()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
1004 // boolean isShapeOutlineVisible()
5d5457a1bd5f Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2574
diff changeset
1005 // boolean isShapeVisible()
2711
fa8ae7dbcb72 More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2710
diff changeset
1006 String hash = li.getLinePaint().toString();
fa8ae7dbcb72 More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2710
diff changeset
1007 String label = li.getLabel();
fa8ae7dbcb72 More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2710
diff changeset
1008 if (label.startsWith("W (") || label.startsWith("W(")) {
fa8ae7dbcb72 More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2710
diff changeset
1009 hash += "-W-";
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
1010 }
2711
fa8ae7dbcb72 More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2710
diff changeset
1011 else if (label.startsWith("Q(") || label.startsWith("Q (")) {
fa8ae7dbcb72 More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2710
diff changeset
1012 hash += "-Q-";
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
1013 }
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
1014
2711
fa8ae7dbcb72 More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2710
diff changeset
1015 // WQ.java holds example of using regex Matcher/Pattern.
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
1016
2711
fa8ae7dbcb72 More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2710
diff changeset
1017 return hash;
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
1018 }
1849
5d5dd44d613e Refactored, move doMainValueAnnotations to XYChartGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
1019
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1020 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1021 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org