annotate artifacts/src/main/java/org/dive4elements/river/jfree/EnhancedLineAndShapeRenderer.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents e4606eae8ea5
children eec4df8165a1 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
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: 5863
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: 3625
diff changeset
9 package org.dive4elements.river.jfree;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
11 import java.awt.Color;
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
12 import java.awt.Font;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import java.awt.Graphics2D;
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
14 import java.awt.Paint;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import java.awt.Shape;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import java.awt.geom.Rectangle2D;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import java.util.HashMap;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import java.util.Map;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.Logger;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import org.jfree.chart.axis.ValueAxis;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import org.jfree.chart.entity.EntityCollection;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import org.jfree.chart.plot.CrosshairState;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import org.jfree.chart.plot.PlotOrientation;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import org.jfree.chart.plot.XYPlot;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 import org.jfree.data.xy.XYDataset;
2653
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
28 import org.jfree.data.xy.XYSeries;
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
29 import org.jfree.data.xy.XYSeriesCollection;
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
30 import org.jfree.text.TextUtilities;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 import org.jfree.ui.RectangleEdge;
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
32 import org.jfree.ui.TextAnchor;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 import org.jfree.util.BooleanList;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 import org.jfree.util.ShapeUtilities;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
2642
42b05a4bed25 Cosmetics, added doc, TODO and OPTIMIZE to Enhanced*Renderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2591
diff changeset
36 /**
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
37 * Renderer with additional the additional functionality of renderering minima
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
38 * and/or maxima of dataseries contained in datasets.
2642
42b05a4bed25 Cosmetics, added doc, TODO and OPTIMIZE to Enhanced*Renderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2591
diff changeset
39 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public class EnhancedLineAndShapeRenderer extends XYLineAndShapeRenderer {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
42 /**
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
43 *
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
44 */
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
45 private static final long serialVersionUID = 1L;
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
46
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
47 /** Own log. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
48 private static final Logger log =
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 Logger.getLogger(EnhancedLineAndShapeRenderer.class);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 protected BooleanList isMinimumShapeVisible;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 protected BooleanList isMaximumShapeVisible;
2648
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
53 protected BooleanList showLineLabel;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 protected Map<Integer, Double> seriesMinimum;
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
56 protected Map<Integer, Double> seriesMinimumX;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 protected Map<Integer, Double> seriesMaximum;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
59 protected Map<Integer, Font> lineLabelFonts;
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
60 protected Map<Integer, Color> lineLabelTextColors;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
61 protected BooleanList showLineLabelBG;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
62 protected Map<Integer, Color> lineLabelBGColors;
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
63
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 public EnhancedLineAndShapeRenderer(boolean lines, boolean shapes) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 super(lines, shapes);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 this.isMinimumShapeVisible = new BooleanList();
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 this.isMaximumShapeVisible = new BooleanList();
2648
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
69 this.showLineLabel = new BooleanList();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
70 this.showLineLabelBG = new BooleanList();
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 this.seriesMinimum = new HashMap<Integer, Double>();
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 this.seriesMaximum = new HashMap<Integer, Double>();
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
73 this.seriesMinimumX = new HashMap<Integer, Double>();
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
74 this.lineLabelFonts = new HashMap<Integer, Font>();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
75 this.lineLabelTextColors = new HashMap<Integer, Color>();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
76 this.lineLabelBGColors = new HashMap<Integer, Color>();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
77 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
78
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
79
3015
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
80 /**
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
81 * Draw a background-box of a text to render.
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
82 * @param g2 graphics device to use
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
83 * @param text text to draw
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
84 * @param textX x-position for text
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
85 * @param textY y-position for text
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
86 * @param bgColor color to fill box with.
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
87 */
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
88 public static void drawTextBox(Graphics2D g2,
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
89 String text, float textX, float textY, Color bgColor
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
90 ) {
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
91 Rectangle2D hotspotBox = g2.getFontMetrics().getStringBounds(text, g2);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
92 float w = (float)hotspotBox.getWidth();
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
93 float h = (float)hotspotBox.getHeight();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
94 hotspotBox.setRect(textX, textY-h, w, h);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
95 Color oldColor = g2.getColor();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
96 g2.setColor(bgColor);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
97 g2.fill(hotspotBox);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
98 g2.setColor(oldColor);
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
102 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
103 * Whether or not a specific item in a series (maybe the maxima) should
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
104 * be rendered with shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
105 */
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
106 public boolean getItemShapeVisible(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
107 XYDataset dataset,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
108 int series,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
109 int item
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
110 ){
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 if (super.getItemShapeVisible(series, item)) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 return true;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
115 if (isMinimumShapeVisible(series)
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
116 && isMinimum(dataset, series, item)
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
117 ) {
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 return true;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
121 if (isMaximumShapeVisible(series)
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
122 && isMaximum(dataset, series, item)
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
123 ) {
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 return true;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 return false;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
131 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
132 * Rectangle used to draw maximums shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
133 */
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
134 public Shape getMaximumShape(int series, int column) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
135 return new Rectangle2D.Double(-5d, -5d, 10d, 10d);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
136 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
137
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
138
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
139 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
140 * Rectangle used to draw minimums shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
141 */
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
142 public Shape getMinimumShape(int series, int column) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
143 return new Rectangle2D.Double(-5d, -5d, 10d, 10d);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
144 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
145
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
146
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
147 /** Get fill paint for the maximum indicators. */
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
148 public Paint getMaximumFillPaint(int series, int column) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
149 Paint p = getItemPaint(series, column);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
150
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
151 if (p instanceof Color) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
152 Color c = (Color) p;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
153 Color b = c;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
154
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
155 for (int i = 0; i < 2; i++) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
156 b = b.darker();
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
157 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
158
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
159 return b;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
160 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
161
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
162 log.warn("Item paint is no instance of Color!");
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
163 return p;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
164 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
165
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
166
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
167 /** Get fill paint for the minimum indicators. */
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
168 public Paint getMinimumFillPaint(int series, int column) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
169 Paint p = getItemPaint(series, column);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
170
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
171 if (p instanceof Color) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
172 Color c = (Color) p;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
173 Color b = c;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
174
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
175 for (int i = 0; i < 2; i++) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
176 b = b.darker();
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
177 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
178
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
179 return b;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
180 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
181
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
182 log.warn("Item paint is no instance of Color!");
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
183 return p;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
184 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
185
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
186
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 /**
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 * Overrides XYLineAndShapeRenderer.drawSecondaryPass() to call an adapted
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 * method getItemShapeVisible() which now takes an XYDataset. So, 99% of
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 * code equal the code in XYLineAndShapeRenderer.
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 */
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 @Override
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 protected void drawSecondaryPass(
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 Graphics2D g2,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195 XYPlot plot,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 XYDataset dataset,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 int pass,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 int series,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 int item,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 ValueAxis domainAxis,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201 Rectangle2D dataArea,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 ValueAxis rangeAxis,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 CrosshairState crosshairState,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 EntityCollection entities
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 ) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206 Shape entityArea = null;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 // get the data point...
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 double x1 = dataset.getXValue(series, item);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 double y1 = dataset.getYValue(series, item);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 if (Double.isNaN(y1) || Double.isNaN(x1)) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 return;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 PlotOrientation orientation = plot.getOrientation();
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 if (getItemShapeVisible(dataset, series, item)) {
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
222 Shape shape = null;
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
223
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
224 // OPTIMIZE: instead of calculating minimum and maximum for every
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
225 // point, calculate it just once (assume that dataset
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
226 // content does not change during rendering).
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
227 // NOTE: Above OPTIMIZE might already be fulfilled to
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
228 // most extend.
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
229 boolean isMinimum = isMinimumShapeVisible(series)
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
230 && isMinimum(dataset, series, item);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
231
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
232 boolean isMaximum = isMaximumShapeVisible(series)
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
233 && isMaximum(dataset, series, item);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
234
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
235 if (isMinimum) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
236 log.debug("Create a Minimum shape.");
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
237 shape = getMinimumShape(series, item);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
238 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
239 else if (isMaximum) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
240 log.debug("Create a Maximum shape.");
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
241 shape = getMaximumShape(series, item);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
242 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
243 else {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
244 shape = getItemShape(series, item);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
245 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
246
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247 if (orientation == PlotOrientation.HORIZONTAL) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
248 shape = ShapeUtilities.createTranslatedShape(shape, transY1,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 transX1);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251 else if (orientation == PlotOrientation.VERTICAL) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 shape = ShapeUtilities.createTranslatedShape(shape, transX1,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253 transY1);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 entityArea = shape;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 if (shape.intersects(dataArea)) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257 if (getItemShapeFilled(series, item)) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 if (getUseFillPaint()) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259 g2.setPaint(getItemFillPaint(series, item));
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261 else {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262 g2.setPaint(getItemPaint(series, item));
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
263 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
264 g2.fill(shape);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
265 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
266 if (getDrawOutlines()) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267 if (getUseOutlinePaint()) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 g2.setPaint(getItemOutlinePaint(series, item));
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270 else {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271 g2.setPaint(getItemPaint(series, item));
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273 g2.setStroke(getItemOutlineStroke(series, item));
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
274 g2.draw(shape);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275 }
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
276
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
277 if (isMinimum) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
278 g2.setPaint(getMinimumFillPaint(series, item));
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
279 g2.fill(shape);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
280 g2.setPaint(getItemOutlinePaint(series, item));
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
281 g2.setStroke(getItemOutlineStroke(series, item));
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
282 g2.draw(shape);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
283 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
284 else if (isMaximum) {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
285 g2.setPaint(getMaximumFillPaint(series, item));
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
286 g2.fill(shape);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
287 g2.setPaint(getItemOutlinePaint(series, item));
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
288 g2.setStroke(getItemOutlineStroke(series, item));
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
289 g2.draw(shape);
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
290 }
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
291 }
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
292 } // if (getItemShapeVisible(dataset, series, item))
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
294 double xx = transX1;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
295 double yy = transY1;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
296 if (orientation == PlotOrientation.HORIZONTAL) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
297 xx = transY1;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
298 yy = transX1;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
299 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
300
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
301 // Draw the item label if there is one...
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
302 if (isItemLabelVisible(series, item)) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
303 drawItemLabel(g2, orientation, dataset, series, item, xx, yy,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
304 (y1 < 0.0));
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
305 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
306
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
307 // Draw label of line.
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
308 if (dataset instanceof XYSeriesCollection
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
309 && isShowLineLabel(series)
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
310 && isMinimumX (dataset, series, item)
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
311 ) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
312 XYSeries xYSeries = ((XYSeriesCollection)dataset)
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
313 .getSeries(series);
2653
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
314 String waterlevelLabel = (xYSeries instanceof HasLabel)
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
315 ? ((HasLabel)xYSeries).getLabel()
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
316 : xYSeries.getKey().toString();
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
317 // TODO Force water of some German rivers to flow
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
318 // direction mountains.
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
319
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
320 Font oldFont = g2.getFont();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
321
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
322 Color oldColor = g2.getColor();
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
323 g2.setFont(this.getLineLabelFont(series));
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
324 g2.setColor(this.getLineLabelTextColor(series));
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
325 g2.setBackground(Color.black);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
326
3625
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
327 // Try to always display label if the data is visible.
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
328 if (!isPointInRect(dataArea, xx, yy)) {
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
329 // Move into the data area.
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
330 xx = Math.max(xx, dataArea.getMinX());
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
331 xx = Math.min(xx, dataArea.getMaxX());
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
332 yy = Math.max(yy, dataArea.getMinY());
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
333 yy = Math.min(yy, dataArea.getMaxY());
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
334 }
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
335
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
336 // Move to right until no collisions exist anymore
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
337 Shape hotspot = TextUtilities.calculateRotatedStringBounds(
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
338 waterlevelLabel, g2, (float)xx, (float)yy-3f,
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
339 TextAnchor.CENTER_LEFT,
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
340 0f, TextAnchor.CENTER_LEFT);
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
341 while (JFreeUtil.collides(hotspot, entities,
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
342 CollisionFreeLineLabelEntity.class)) {
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
343 xx += 5f;
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
344 hotspot = TextUtilities.calculateRotatedStringBounds(
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
345 waterlevelLabel,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
346 g2,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
347 (float)xx,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
348 (float)yy-3f,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
349 TextAnchor.CENTER_LEFT,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
350 0f,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
351 TextAnchor.CENTER_LEFT);
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
352 }
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
353
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
354 // Register to avoid collissions.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
355 entities.add(new CollisionFreeLineLabelEntity(hotspot,
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
356 1, "", ""));
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
357
2662
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
358 // Fill background.
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
359 if (isShowLineLabelBG(series)) {
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
360 drawTextBox(g2, waterlevelLabel, (float)xx, (float)yy-3f,
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
361 getLineLabelBGColor(series));
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
362 }
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
363
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
364 g2.drawString(waterlevelLabel, (float)xx, (float)yy-3f);
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
365
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
366 g2.setFont(oldFont);
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
367 g2.setColor(oldColor);
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
368 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
369
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
370 int domainAxisIndex = plot.getDomainAxisIndex(domainAxis);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
371 int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
372 updateCrosshairValues(crosshairState, x1, y1, domainAxisIndex,
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
373 rangeAxisIndex, transX1, transY1, orientation);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
374
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
375 // Add an entity for the item, but only if it falls within the data
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
376 // area...
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
377 if (entities != null && isPointInRect(dataArea, xx, yy)) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
378 addEntity(entities, entityArea, dataset, series, item, xx, yy);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
379 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
380 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
381
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
382
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
383 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
384 * Sets whether or not the minimum should be rendered with shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
385 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
386 public void setIsMinimumShapeVisisble(int series, boolean isVisible) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
387 this.isMinimumShapeVisible.setBoolean(series, isVisible);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
388 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
389
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
390
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
391 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
392 * Whether or not the minimum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
393 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
394 public boolean isMinimumShapeVisible(int series) {
2241
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
395 if (this.isMinimumShapeVisible.size() <= series) {
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
396 return false;
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
397 }
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
398
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
399 return isMinimumShapeVisible.getBoolean(series);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
400 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
401
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
402
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
403 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
404 * Sets whether or not the maximum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
405 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
406 public void setIsMaximumShapeVisible(int series, boolean isVisible) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
407 this.isMaximumShapeVisible.setBoolean(series, isVisible);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
408 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
409
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
410
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
411 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
412 * Whether or not the maximum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
413 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
414 public boolean isMaximumShapeVisible(int series) {
2241
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
415 if (this.isMaximumShapeVisible.size() <= series) {
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
416 return false;
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
417 }
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
418
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
419 return isMaximumShapeVisible.getBoolean(series);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
420 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
421
2648
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
422 /** Whether or not a label should be shown for series. */
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
423 public boolean isShowLineLabel(int series) {
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
424 if (this.showLineLabel.size() <= series) {
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
425 return false;
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
426 }
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
427
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
428 return showLineLabel.getBoolean(series);
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
429 }
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
430
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
431
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
432 /** Sets whether or not a label should be shown for series. */
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
433 public void setShowLineLabel(boolean showLineLabel, int series) {
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
434 this.showLineLabel.setBoolean(series, showLineLabel);
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
435 }
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2647
diff changeset
436
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
437
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
438 /** Whether or not a label should be shown for series. */
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
439 public boolean isShowLineLabelBG(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
440 if (this.showLineLabelBG.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
441 return false;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
442 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
443
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
444 return showLineLabelBG.getBoolean(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
445 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
446
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
447
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
448 public void setShowLineLabelBG(int series, boolean doShow) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
449 this.showLineLabelBG.setBoolean(series, doShow);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
450 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
451
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
452 public Color getLineLabelBGColor(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
453 if (this.lineLabelBGColors.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
454 return null;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
455 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
456
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
457 return this.lineLabelBGColors.get(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
458 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
459
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
460 public void setLineLabelBGColor(int series, Color color) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
461 this.lineLabelBGColors.put(series, color);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
462 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
463
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
464 public Color getLineLabelTextColor(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
465 if (this.lineLabelTextColors.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
466 return null;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
467 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
468
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
469 return this.lineLabelTextColors.get(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
470 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
471
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
472 public void setLineLabelTextColor(int series, Color color) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
473 this.lineLabelTextColors.put(series, color);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
474 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
475
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
476 public void setLineLabelFont(Font font, int series) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
477 this.lineLabelFonts.put(series, font);
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
478 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
479
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
480 public Font getLineLabelFont(int series) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
481 return this.lineLabelFonts.get(series);
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
482 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
483
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
484
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
485 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
486 * True if the given item of given dataset has the smallest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
487 * X value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
488 */
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
489 public boolean isMinimumX(XYDataset dataset, int series, int item) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
490 return dataset.getXValue(series, item) == getMinimumX(dataset, series);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
491 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
492
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
493
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
494 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
495 * Get Minimum X Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
496 * The value is stored for later use if queried the first time.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
497 */
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
498 public double getMinimumX(XYDataset dataset, int series) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
499 Integer key = Integer.valueOf(series);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
500 Double old = seriesMinimumX.get(key);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
501
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
502 if (old != null) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
503 return old.doubleValue();
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
504 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
505
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
506 log.debug("Compute minimum of Series: " + series);
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
507
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
508 double min = Double.MAX_VALUE;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
509
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
510 for (int i = 0, n = dataset.getItemCount(series); i < n; i++) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
511 double tmpValue = dataset.getXValue(series, i);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
512
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
513 if (tmpValue < min) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
514 min = tmpValue;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
515 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
516 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
517
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
518 seriesMinimumX.put(key, Double.valueOf(min));
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
519
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
520 return min;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
521 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
522
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
523
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
524 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
525 * True if the given item of given dataset has the smallest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
526 * Y value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
527 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
528 public boolean isMinimum(XYDataset dataset, int series, int item) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
529 return dataset.getYValue(series, item) == getMinimum(dataset, series);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
530 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
531
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
532
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
533 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
534 * Get Minimum Y Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
535 * The value is stored for later use if queried the first time.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
536 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
537 public double getMinimum(XYDataset dataset, int series) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
538 Integer key = Integer.valueOf(series);
2075
f42b0e624e97 Small bugfix: use correct keys for buffering min/max values in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2074
diff changeset
539 Double old = seriesMinimum.get(key);
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
540
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
541 if (old != null) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
542 return old.doubleValue();
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
543 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
544
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
545 log.debug("Compute minimum of Series: " + series);
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
546
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
547 double min = Double.MAX_VALUE;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
548
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
549 for (int i = 0, n = dataset.getItemCount(series); i < n; i++) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
550 double tmpValue = dataset.getYValue(series, i);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
551
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
552 if (tmpValue < min) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
553 min = tmpValue;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
554 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
555 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
556
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
557 seriesMinimum.put(key, Double.valueOf(min));
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
558
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
559 return min;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
560 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
561
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
562
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
563 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
564 * True if the given item of given dataset has the biggest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
565 * Y value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
566 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
567 public boolean isMaximum(XYDataset dataset, int series, int item) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
568 return dataset.getYValue(series, item) == getMaximum(dataset, series);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
569 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
570
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
571
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
572 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
573 * Get maximum Y Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
574 * The value is stored for later use if queried the first time.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
575 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
576 public double getMaximum(XYDataset dataset, int series) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
577 Integer key = Integer.valueOf(series);
2075
f42b0e624e97 Small bugfix: use correct keys for buffering min/max values in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2074
diff changeset
578 Double old = seriesMaximum.get(key);
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
579
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
580 if (old != null) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
581 return old.doubleValue();
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
582 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
583
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
584 log.debug("Compute maximum of Series: " + series);
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
585
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
586 double max = -Double.MAX_VALUE;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
587
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
588 for (int i = 0, n = dataset.getItemCount(series); i < n; i++) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
589 double tmpValue = dataset.getYValue(series, i);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
590
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
591 if (tmpValue > max) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
592 max = tmpValue;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
593 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
594 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
595
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
596 seriesMaximum.put(key, Double.valueOf(max));
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
597
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
598 return max;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
599 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
600 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
601 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org