annotate artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java @ 7034:557cb3a3d772 generator-refactoring

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

http://dive4elements.wald.intevation.org