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