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