Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 3242:1dca41dba135
Move annotation code to base class ChartGenerator
flys-artifacts/trunk@4874 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 04 Jul 2012 22:28:44 +0000 |
parents | ed07dd55f487 |
children | f76cef888ee1 |
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 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 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
|
12 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
|
13 import org.jfree.chart.JFreeChart; |
2584
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
14 import org.jfree.chart.LegendItem; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
15 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
|
16 import org.jfree.chart.axis.NumberAxis; |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
17 import org.jfree.chart.axis.ValueAxis; |
3064
478e8d9d88ba
Add missing imports.
Christian Lins <christian.lins@intevation.de>
parents:
3063
diff
changeset
|
18 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
|
19 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
|
20 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
|
21 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
|
22 import org.jfree.data.general.Series; |
3242
1dca41dba135
Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
3227
diff
changeset
|
23 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
|
24 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
|
25 import org.jfree.data.xy.XYSeriesCollection; |
3242
1dca41dba135
Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
3227
diff
changeset
|
26 import org.json.JSONArray; |
1dca41dba135
Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
3227
diff
changeset
|
27 import org.json.JSONException; |
1dca41dba135
Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
3227
diff
changeset
|
28 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
|
29 |
2325
1fcaeced48f2
#485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2300
diff
changeset
|
30 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
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
|
31 import de.intevation.flys.jfree.Bounds; |
3242
1dca41dba135
Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
3227
diff
changeset
|
32 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; |
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
|
33 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
|
34 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
|
35 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
|
36 import de.intevation.flys.jfree.StyledXYSeries; |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
38 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 /** |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 * 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
|
41 * |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
42 * 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
|
43 * <ul> |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
44 * <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
|
45 * 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
|
46 * <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
|
47 * 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
|
48 * 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
|
49 * <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
|
50 * </ul> |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
51 * |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 * @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
|
53 */ |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 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
|
55 |
3242
1dca41dba135
Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
3227
diff
changeset
|
56 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
|
57 /** 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
|
58 protected int axisSymbol; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
59 /** 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
|
60 protected List<XYDataset> datasets; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
61 /** 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
|
62 protected Range range; |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
63 /** 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
|
64 protected int plotAxisIndex; |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
65 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
66 /** 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
|
67 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
|
68 this.axisSymbol = symb; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
69 datasets = new ArrayList<XYDataset>(); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
70 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
71 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
72 /** 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
|
73 private void mergeRanges(Range subRange) { |
1959
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
74 // Avoid merging NaNs, as they take min/max place forever. |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
75 if (subRange == null || |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
76 Double.isNaN(subRange.getLowerBound()) || |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
77 Double.isNaN(subRange.getUpperBound())) { |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
78 return; |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
79 } |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
80 if (range == null) { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
81 range = subRange; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
82 return; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
83 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
84 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
|
85 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
86 |
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
|
87 |
2710
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
88 /** 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
|
89 @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
|
90 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
|
91 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
|
92 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
|
93 } |
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 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
95 /** 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
|
96 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
|
97 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
|
98 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
99 |
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
|
100 |
2710
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
101 /** 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
|
102 @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
|
103 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
|
104 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
|
105 } |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
106 |
7e8e1d5384c0
Further refactoring of 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 /** 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
|
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 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
|
111 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
|
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 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
|
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 XYDataset[] getDatasets() { |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
118 return (XYDataset[]) |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
119 datasets.toArray(new XYDataset[datasets.size()]); |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
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 |
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
123 /** Add a Dataset that describes an area. */ |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
124 public void addArea(StyledAreaSeriesCollection series) { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
125 this.datasets.add(series); |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
126 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
127 |
2574
3598690dc9e2
Fix flys/issue501 (manual points have two legend entries).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2553
diff
changeset
|
128 // TODO obsolete? |
3598690dc9e2
Fix flys/issue501 (manual points have two legend entries).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2553
diff
changeset
|
129 /** 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
|
130 @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
|
131 public boolean isArea(XYDataset series) { |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
132 return (series instanceof StyledAreaSeriesCollection); |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
133 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
134 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
135 /** Adjust range to include given dataset. */ |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
136 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
|
137 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
|
138 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
139 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
140 /** 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
|
141 @Override |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
142 public boolean isEmpty() { |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
143 return this.datasets.isEmpty(); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
144 } |
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
|
145 |
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
|
146 /** 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
|
147 @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
|
148 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
|
149 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
|
150 } |
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
|
151 |
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
|
152 /** 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
|
153 @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
|
154 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
|
155 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
|
156 } |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
157 } // class AxisDataset |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
158 |
2710
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
159 /** Enumerator over existing axes. */ |
2246
99ef93ce18bd
Doc added and fix getAxisWalker-issue.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2242
diff
changeset
|
160 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
|
161 |
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
|
162 public static final int AXIS_SPACE = 5; |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
163 |
1048
fd5c70973e0b
Picky white-space cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
924
diff
changeset
|
164 /** 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
|
165 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
|
166 |
3064
478e8d9d88ba
Add missing imports.
Christian Lins <christian.lins@intevation.de>
parents:
3063
diff
changeset
|
167 protected List<Marker> domainMarkers = new ArrayList<Marker>(); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3064
diff
changeset
|
168 |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
169 protected List<Marker> valueMarkers = new ArrayList<Marker>(); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
170 |
1685
022f62c75878
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
171 /** 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
|
172 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
|
173 |
1685
022f62c75878
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
174 /** 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
|
175 protected Map<Integer, Bounds> yBounds; |
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
|
176 |
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
|
177 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
|
178 super(); |
23c7c51df772
Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2236
diff
changeset
|
179 |
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
|
180 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
|
181 yBounds = new HashMap<Integer, 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
|
182 } |
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
|
183 |
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
|
184 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 /** |
1930
de0c2bbb27f9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1861
diff
changeset
|
186 * Generate the chart anew (including localized axis and all). |
de0c2bbb27f9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1861
diff
changeset
|
187 */ |
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
|
188 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
|
189 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
|
190 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 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
|
192 getChartTitle(), |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 getXAxisLabel(), |
2051
4ba5036109d2
Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2050
diff
changeset
|
194 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
|
195 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
|
196 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
|
197 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
|
198 false, |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 false); |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
201 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
|
202 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
|
203 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 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
|
205 plot.setBackgroundPaint(Color.WHITE); |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
206 addSubtitles(chart); |
419
4de7d9eac10f
Display gridlines in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
207 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
|
208 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
209 //debugAxis(plot); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
210 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
211 addDatasets(plot); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
212 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
213 //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
|
214 |
3063
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
215 addMarkers(plot); |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
216 |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
217 recoverEmptyPlot(plot); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
218 preparePointRanges(plot); |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
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 localizeAxes(plot); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
223 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
|
224 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
|
225 |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
226 // 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
|
227 addAnnotationsToRenderer(plot); |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2132
diff
changeset
|
228 |
3154
a08538e21b55
Re-enable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3114
diff
changeset
|
229 aggregateLegendEntries(plot); |
2584
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
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 return chart; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
232 } |
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
|
233 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
234 |
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
|
235 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
|
236 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
|
237 } |
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
|
238 |
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
|
239 |
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
|
240 @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
|
241 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
|
242 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
|
243 } |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
244 |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
245 |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
246 @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
|
247 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
|
248 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
|
249 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
|
250 } |
23c7c51df772
Some more refactoring in XYChartGenerator and ChartGenerator; implemented necessary stuff in TimeseriesChartGenerator and return new empty instances of timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2236
diff
changeset
|
251 |
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
|
252 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
253 /** |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
254 * 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
|
255 */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
256 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
|
257 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
|
258 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
|
259 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
|
260 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
|
261 continue; |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
262 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
263 logger.debug("Dataset #" + i + ":" + plot.getDataset(i)); |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
264 XYSeriesCollection series = (XYSeriesCollection) plot.getDataset(i); |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
265 logger.debug("X-Extend of Dataset: " + series.getSeries(0).getMinX() |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
266 + " " + series.getSeries(0).getMaxX()); |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
267 logger.debug("Y-Extend of Dataset: " + series.getSeries(0).getMinY() |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
268 + " " + 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
|
269 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
270 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
271 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
272 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
273 /** |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
274 * 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
|
275 */ |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
276 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
|
277 logger.debug("..............."); |
3087
4a76da133144
Removed repeated x.size() calls from for loops.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3079
diff
changeset
|
278 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
|
279 if (plot.getRangeAxis(i) == null) |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
280 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
|
281 else { |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
282 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
|
283 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
|
284 " " + 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
|
285 "]"); |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
286 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
287 |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
288 } |
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
289 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
|
290 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 |
1685
022f62c75878
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
293 /** |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
294 * 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
|
295 * @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
|
296 * @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
|
297 * @param visible Whether or not to be visible (important for range calculations). |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
298 */ |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
299 public void addAreaSeries(StyledAreaSeriesCollection area, int index, boolean visible) { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
300 if (area == null) { |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
301 logger.warn("Cannot yet render above/under curve."); |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
302 return; |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
303 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
304 |
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
|
305 XYAxisDataset axisDataset = (XYAxisDataset) getAxisDataset(index); |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
306 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
307 if (visible) { |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
308 axisDataset.addArea(area); |
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
309 } |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
310 else { |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
311 // TODO only range merging. |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
312 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
313 //TODO range merging. |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
314 } |
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
315 |
2020
4f7f781e4481
Improved area rendering workflow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2005
diff
changeset
|
316 |
2005
79b15491177a
Added simple area registering functions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2000
diff
changeset
|
317 /** |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
318 * 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
|
319 * all points in data would be plotted once visible). |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
320 * @param series the dataseries to include in plot. |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
321 * @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
|
322 * @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
|
323 */ |
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
|
324 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
|
325 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
|
326 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
|
327 } |
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
|
328 |
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
|
329 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
|
330 series.getMinY() + " | " + series.getMaxY()); |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
331 |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
332 addAxisDataset(new XYSeriesCollection(series), index, visible); |
7e8e1d5384c0
Further refactoring of XYChartGenerator / ChartGenerator with the result, that timerange charts are now able to display lines.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2238
diff
changeset
|
333 |
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
|
334 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
|
335 |
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
|
336 if (!visible) { |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
337 // 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
|
338 // that every data-point could be seen (except for annotations). |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
339 axisDataset.includeYRange(series); |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
340 } |
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
|
341 } |
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
|
342 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3064
diff
changeset
|
343 |
3063
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
344 /** |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
345 * Add the given vertical marker to the chart. |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
346 */ |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
347 public void addDomainMarker(Marker marker) { |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
348 if (marker == null) { |
3064
478e8d9d88ba
Add missing imports.
Christian Lins <christian.lins@intevation.de>
parents:
3063
diff
changeset
|
349 return; |
3063
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
350 } |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
351 |
3064
478e8d9d88ba
Add missing imports.
Christian Lins <christian.lins@intevation.de>
parents:
3063
diff
changeset
|
352 domainMarkers.add(marker); |
3063
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
353 } |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
354 |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
355 |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
356 /** |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
357 * Add the given vertical marker to the chart. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
358 */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
359 public void addValueMarker(Marker marker) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
360 if (marker == null) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
361 return; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
362 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
363 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
364 valueMarkers.add(marker); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
365 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
366 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
367 |
3063
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
368 protected void addMarkers(XYPlot plot) { |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
369 for(Marker marker : domainMarkers) { |
3064
478e8d9d88ba
Add missing imports.
Christian Lins <christian.lins@intevation.de>
parents:
3063
diff
changeset
|
370 plot.addDomainMarker(marker); |
3063
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
371 } |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
372 for(Marker marker : valueMarkers) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
373 plot.addRangeMarker(marker); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3160
diff
changeset
|
374 } |
3063
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
375 } |
33c167d6fff6
Move marker generation to XYChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2998
diff
changeset
|
376 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
377 |
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
|
378 /** |
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
|
379 * 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
|
380 * |
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
|
381 * @param range the given ("minimal") range. |
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
382 * @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
|
383 */ |
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
|
384 @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
|
385 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
|
386 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
|
387 logger.warn("Unsupported Bounds type: " + bounds.getClass()); |
1959
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
388 return; |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
389 } |
eace020067da
Further flys/issue420 fix, NaN-guard X axis extent.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1958
diff
changeset
|
390 |
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
|
391 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
|
392 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
393 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
|
394 || 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
|
395 || 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
|
396 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
|
397 } |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
398 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
399 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
|
400 |
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
|
401 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
|
402 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
|
403 } |
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
|
404 |
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
|
405 setXBounds(index, dBounds); |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
406 } |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
407 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
408 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
409 @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
|
410 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
|
411 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
|
412 logger.warn("Unsupported Bounds type: " + bounds.getClass()); |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
413 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
|
414 } |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
415 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
416 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
|
417 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
418 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
|
419 || 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
|
420 || 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
|
421 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
|
422 } |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
423 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
424 Bounds old = getYBounds(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
|
425 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
426 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
|
427 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
|
428 } |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
429 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
430 setYBounds(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
|
431 } |
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
|
432 |
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
|
433 |
1930
de0c2bbb27f9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1861
diff
changeset
|
434 /** |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
435 * 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
|
436 */ |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
437 private void recoverEmptyPlot(XYPlot plot) { |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
438 if (plot.getRangeAxis() == null) { |
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
439 logger.debug("debug: No range axis"); |
2414
b5f5af53a526
Make it compileable again
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2411
diff
changeset
|
440 plot.setRangeAxis(createYAxis(0)); |
1935
5b51f5232661
Added handling of empty plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1934
diff
changeset
|
441 } |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
442 } |
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
443 |
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
444 |
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
|
445 /** |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
446 * 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
|
447 */ |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
448 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
|
449 for (int i = 0, num = plot.getDomainAxisCount(); i < num; i++) { |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
450 logger.debug("Check whether to expand a x axis."); |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
451 |
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
|
452 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
|
453 Bounds b = getXBounds(key); |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
454 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
455 if (b != null && b.getLower() == b.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
|
456 double lo = (Double) b.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
|
457 double hi = (Double) b.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
|
458 double add = (hi - lo) / 100 * 5; |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
459 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
460 setXBounds(key, new DoubleBounds(lo-add, hi+add)); |
1686
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
461 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
462 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
463 } |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
464 |
e8d1e531687a
Bugfix: #114 Enabled rendering charts with a single data point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1685
diff
changeset
|
465 |
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
|
466 /** |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
467 * 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
|
468 * 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
|
469 * 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
|
470 * 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
|
471 * 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
|
472 * |
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
|
473 * @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
|
474 */ |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
475 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
|
476 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
|
477 |
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
|
478 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
|
479 Range yrange = getValueAxisRange(); |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
480 |
2050
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
481 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
|
482 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
483 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
|
484 if (fixedXRange != null) { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
485 xAxis.setRange(fixedXRange); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
486 } |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
487 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
|
488 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
|
489 } |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
718
diff
changeset
|
490 |
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
|
491 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
|
492 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
|
493 |
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
|
494 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
|
495 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
|
496 |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
497 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
|
498 if (fixedRange != null) { |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
499 yaxis.setRange(fixedRange); |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
500 continue; |
c4e0e433f825
Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2049
diff
changeset
|
501 } |
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
|
502 } |
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
|
503 |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
504 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
|
505 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
|
506 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
|
507 } |
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
|
508 |
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
|
509 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
|
510 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
|
511 } |
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
|
512 } |
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
|
513 |
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
|
514 |
2395
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
515 protected Range getDomainAxisRange() { |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
516 String[] ranges = getDomainAxisRangeFromRequest(); |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
517 |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
518 if (ranges == null || ranges.length < 2) { |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
519 logger.debug("No zoom range for domain axis specified."); |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
520 return null; |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
521 } |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
522 |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
523 if (ranges[0].length() > 0 && ranges[1].length() > 0) { |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
524 try { |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
525 double from = Double.parseDouble(ranges[0]); |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
526 double to = Double.parseDouble(ranges[1]); |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
527 |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
528 if (from == 0 && to == 0) { |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
529 logger.debug("No range specified. Lower and upper X == 0"); |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
530 return null; |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
531 } |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
532 |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
533 if (from > to) { |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
534 double tmp = to; |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
535 to = from; |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
536 from = tmp; |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
537 } |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
538 |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
539 return new Range(from, to); |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
540 } |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
541 catch (NumberFormatException nfe) { |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
542 logger.warn("Wrong values for domain axis range."); |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
543 } |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
544 } |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
545 |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
546 return null; |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
547 } |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
548 |
cd4fb19ab892
Some API changes in ChartGenerator and XYChartGenerator for fetching user specified zoom values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2325
diff
changeset
|
549 |
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
|
550 protected Range getValueAxisRange() { |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
551 String[] ranges = getValueAxisRangeFromRequest(); |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
552 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
553 if (ranges == null || ranges.length < 2) { |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
554 logger.debug("No range specified. Lower and upper Y == 0"); |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
555 return null; |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
556 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
557 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
558 if (ranges[0].length() > 0 && ranges[1].length() > 0) { |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
559 try { |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
560 double from = Double.parseDouble(ranges[0]); |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
561 double to = Double.parseDouble(ranges[1]); |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
562 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
563 if (from == 0 && to == 0) { |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
564 logger.debug("No range specified. Lower and upper Y == 0"); |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
565 return null; |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
566 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
567 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
568 return from > to |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
569 ? new Range(to, from) |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
570 : new Range(from, to); |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
571 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
572 catch (NumberFormatException nfe) { |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
573 logger.warn("Wrong values for value axis range."); |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
574 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
575 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
576 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
577 return null; |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
578 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
579 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
580 |
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
|
581 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
|
582 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
|
583 } |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
584 |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
585 |
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
|
586 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
|
587 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
|
588 } |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
589 |
f3fd8c9b7f51
#157 Computed discharge curve charts always have a lower bound set to 0.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
717
diff
changeset
|
590 |
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
|
591 /** |
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
|
592 * 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
|
593 * |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
594 * @param plot The XYPlot. |
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
595 * @param axis The axis the shoud be modified. |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
667
diff
changeset
|
596 * @param range The whole range specified by a dataset. |
1958
82cefa3f954f
Partial fix for flys/issue420 (Mosel/DischargeCurves), do survive empty datasets when calculating axis extents.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
597 * @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
|
598 * |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
599 * @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
|
600 */ |
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
|
601 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
|
602 |
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
|
603 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
|
604 return false; |
0155cbaba182
XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1735
diff
changeset
|
605 } |
0155cbaba182
XYChartGenerator: Do not crash if no zoom axis given
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1735
diff
changeset
|
606 |
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
|
607 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
|
608 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
|
609 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
|
610 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
611 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
|
612 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
|
613 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
|
614 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
|
615 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
|
616 } |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
617 |
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
|
618 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
|
619 |
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
|
620 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
|
621 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
|
622 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
|
623 |
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
|
624 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
|
625 |
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
|
626 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
|
627 |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
628 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
|
629 } |
654
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
630 |
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
|
631 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
|
632 return false; |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
633 } |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
634 |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
635 |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
636 /** |
2710
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
637 * 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
|
638 * 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
|
639 * |
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
|
640 * @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
|
641 * |
bbc966c81809
#90 Removed margins between data area border and curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
653
diff
changeset
|
642 * @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
|
643 */ |
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
|
644 @Override |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1943
diff
changeset
|
645 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
|
646 logger.debug("getRangesForAxis " + index); |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
647 |
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
|
648 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
|
649 Bounds ry = getYBounds(Integer.valueOf(index)); |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
650 |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
651 if (rx == null) { |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
652 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
|
653 " 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
|
654 rx = new DoubleBounds(0, 1); |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
655 } |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
656 if (ry == null) { |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
657 logger.warn("Range for y" + index + |
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
658 " 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
|
659 ry = new DoubleBounds(0, 1); |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2110
diff
changeset
|
660 } |
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
|
661 |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
662 return new Range[] { |
bece6f604899
Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2584
diff
changeset
|
663 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
|
664 new Range(ry.getLower().doubleValue(), ry.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
|
665 }; |
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
|
666 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
667 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
668 |
2710
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
669 /** Get 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
|
670 @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
|
671 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
|
672 return xBounds.get(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
|
673 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
674 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
675 |
2710
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
676 /** 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
|
677 @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
|
678 protected void setXBounds(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
|
679 xBounds.put(axis, bounds); |
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
|
680 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
681 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
682 |
2710
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
683 /** 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
|
684 @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
|
685 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
|
686 return yBounds.get(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
|
687 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
688 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
689 |
2710
013882485011
Cosmetics (docs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2706
diff
changeset
|
690 /** 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
|
691 @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
|
692 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
|
693 yBounds.put(axis, bounds); |
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
|
694 } |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
695 |
5d8d24984819
New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2395
diff
changeset
|
696 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
697 /** |
2054
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
698 * 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
|
699 * X axis. |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
700 * |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
701 * @param plot The XYPlot of the chart. |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
702 */ |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
703 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
|
704 ValueAxis xaxis = plot.getDomainAxis(); |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
705 |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
706 ChartSettings chartSettings = getChartSettings(); |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
707 if (chartSettings == null) { |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
708 return; |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1930
diff
changeset
|
709 } |
2054
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
710 |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
711 Font labelFont = new Font( |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
712 DEFAULT_FONT_NAME, |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
713 Font.BOLD, |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
714 getXAxisLabelFontSize()); |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
715 |
a653295c9ac0
Make use of user defined axes font sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2053
diff
changeset
|
716 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
|
717 xaxis.setTickLabelFont(labelFont); |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
718 } |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
719 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
375
diff
changeset
|
720 |
1940
0d12e70766c8
Refactored XYChartGenerator to have better working multi-axes features.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1935
diff
changeset
|
721 /** |
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
|
722 * 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
|
723 * 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
|
724 * 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
|
725 * |
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
|
726 * @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
|
727 */ |
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
|
728 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
|
729 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
|
730 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
|
731 |
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
|
732 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
|
733 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
|
734 } |
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
|
735 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
|
736 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
|
737 } |
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
|
738 } |
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
|
739 |
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
|
740 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
|
741 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
|
742 |
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
|
743 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
|
744 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
|
745 } |
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
|
746 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
|
747 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
|
748 } |
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
|
749 } |
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
|
750 } |
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
|
751 |
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
|
752 |
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
|
753 /** |
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
|
754 * 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
|
755 * 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
|
756 * |
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
|
757 * @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
|
758 */ |
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
|
759 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
|
760 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
|
761 ((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
|
762 } |
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
|
763 |
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
|
764 |
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
|
765 /** |
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
|
766 * 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
|
767 * 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
|
768 * |
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
|
769 * @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
|
770 */ |
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
|
771 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
|
772 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
|
773 ((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
|
774 } |
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
|
775 |
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
|
776 |
1932
17e18948fe5e
Fix legend and themeing with new multiaxis feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
777 /** |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
778 * Do Points out. |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
779 */ |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
780 protected void doPoints( |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
781 Object o, |
2325
1fcaeced48f2
#485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2300
diff
changeset
|
782 ArtifactAndFacet aandf, |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
783 Document theme, |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
784 boolean visible, |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
785 int axisIndex |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
786 ) { |
2325
1fcaeced48f2
#485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2300
diff
changeset
|
787 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
|
788 XYSeries series = new StyledXYSeries(seriesName, theme); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
789 |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
790 // 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
|
791 List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>(); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
792 |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
793 try { |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
794 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
|
795 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
|
796 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
|
797 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
|
798 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
|
799 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
|
800 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
|
801 if (!act) { |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
802 continue; |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
803 } |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
804 //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
|
805 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
|
806 xy.add(new CollisionFreeXYTextAnnotation(name, x, y)); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
807 } |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
808 } |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
809 catch(JSONException e){ |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
810 logger.error("Could not decode json."); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
811 } |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3064
diff
changeset
|
812 |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
813 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
|
814 annotations.setTextAnnotations(xy); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
815 |
2574
3598690dc9e2
Fix flys/issue501 (manual points have two legend entries).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2553
diff
changeset
|
816 // Do not generate second legend entry. (null was passed for the aand before). |
3598690dc9e2
Fix flys/issue501 (manual points have two legend entries).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2553
diff
changeset
|
817 doAnnotations(annotations, null, theme, visible); |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
818 addAxisSeries(series, axisIndex, visible); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
819 } |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
820 |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2193
diff
changeset
|
821 |
2584
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
822 /** |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
823 * Create a hash from a legenditem. |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
824 * 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
|
825 * @return hash for given legenditem to identify mergeables. |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
826 */ |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
827 public static String legendItemHash(LegendItem li) { |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
828 // 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
|
829 // getFillPaint() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
830 // getFillPaintTransformer() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
831 // getLabel() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
832 // getLine() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
833 // getLinePaint() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
834 // getLineStroke() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
835 // getOutlinePaint() |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3064
diff
changeset
|
836 // getOutlineStroke() |
2584
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
837 // Shape getShape() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
838 // String getToolTipText() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
839 // String getURLText() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
840 // boolean isLineVisible() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
841 // boolean isShapeFilled() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
842 // boolean isShapeOutlineVisible() |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
843 // boolean isShapeVisible() |
2711
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
844 String hash = li.getLinePaint().toString(); |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
845 String label = li.getLabel(); |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
846 if (label.startsWith("W (") || label.startsWith("W(")) { |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
847 hash += "-W-"; |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
848 } |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
849 else if (label.startsWith("Q(") || label.startsWith("Q (")) { |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
850 hash += "-Q-"; |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
851 } |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
852 |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
853 // WQ.java holds example of using regex Matcher/Pattern. |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
854 |
fa8ae7dbcb72
More stable legend item aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2710
diff
changeset
|
855 return hash; |
2584
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
856 } |
5d5457a1bd5f
Stubby legend aggregation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2574
diff
changeset
|
857 |
369
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
858 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
859 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |