annotate artifacts/src/main/java/org/dive4elements/river/jfree/EnhancedLineAndShapeRenderer.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents af13ceeba52a
children 5e38e2924c07
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);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
92 float w = (float) hotspotBox.getWidth(), h = (float) hotspotBox.getHeight();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
93 hotspotBox.setRect(textX, textY-h, w, h);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
94 Color oldColor = g2.getColor();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
95 g2.setColor(bgColor);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
96 g2.fill(hotspotBox);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
97 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
98 }
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
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
101 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
102 * 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
103 * be rendered with shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
104 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 public boolean getItemShapeVisible(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
106 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
107 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
108 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 if (isMinimumShapeVisible(series) && isMinimum(dataset, 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
111 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
112 }
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 if (isMaximumShapeVisible(series) && isMaximum(dataset, 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
115 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
116 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
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 false;
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
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
122 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
123 * Rectangle used to draw maximums shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
124 */
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
125 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
126 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
127 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
128
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
129
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
130 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
131 * Rectangle used to draw minimums shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
132 */
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
133 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
134 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
135 }
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
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
138 /** 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
139 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
140 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
141
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
142 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
143 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
144 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
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 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
147 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
148 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
149
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
150 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
151 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
152
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
153 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
154 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
155 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
156
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
157
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
158 /** 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
159 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
160 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
161
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
162 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
163 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
164 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
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 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
167 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
168 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
169
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
170 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
171 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
172
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
173 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
174 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
175 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
176
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
177
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 /**
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 * 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
180 * 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
181 * 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
182 */
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 @Override
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 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
185 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
186 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
187 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
188 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
189 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
190 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
191 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
192 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
193 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
194 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
195 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
196 ) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 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
198
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 // 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
200 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
201 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
202 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
203 return;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 }
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 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
207 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
208 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
209 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
210 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
211
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 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
213 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
214
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
215 // 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
216 // 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
217 // content does not change during rendering).
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
218 // NOTE: Above OPTIMIZE might already be fulfilled to 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
219 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
220 && 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
221
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
222 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
223 && 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
224
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
225 if (isMinimum) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
226 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
227 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
228 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
229 else if (isMaximum) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
230 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
231 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
232 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
233 else {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
234 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
235 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
236
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 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
238 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
239 transX1);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241 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
242 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
243 transY1);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
245 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
246 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
247 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
248 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
249 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
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 {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 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
253 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254 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
255 }
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 (getDrawOutlines()) {
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 (getUseOutlinePaint()) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 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
259 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260 else {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261 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
262 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
263 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
264 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
265 }
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
266
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
267 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
268 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
269 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
270 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
271 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
272 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
273 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
274 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
275 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
276 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
277 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
278 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
279 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
280 }
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281 }
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
282 } // 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
283
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284 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
285 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
286 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
287 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
288 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
289 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
291 // 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
292 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
293 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
294 (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
295 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
296
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
297 // Draw label of line.
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
298 if (dataset instanceof XYSeriesCollection
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
299 && isShowLineLabel(series)
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
300 && isMinimumX (dataset, series, item)
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
301 ) {
2653
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
302 XYSeries xYSeries = ((XYSeriesCollection) dataset).getSeries(series);
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
303 String waterlevelLabel = (xYSeries instanceof HasLabel)
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
304 ? ((HasLabel)xYSeries).getLabel()
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
305 : xYSeries.getKey().toString();
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
306 // TODO Force water of some German rivers to flow direction mountains.
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
307
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
308 Font oldFont = g2.getFont();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
309
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
310 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
311 g2.setFont(this.getLineLabelFont(series));
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
312 g2.setColor(this.getLineLabelTextColor(series));
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
313 g2.setBackground(Color.black);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
314
3625
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
315 // 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
316 if (!isPointInRect(dataArea, xx, yy)) {
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
317 // Move into the data area.
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
318 xx = Math.max(xx, dataArea.getMinX());
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
319 xx = Math.min(xx, dataArea.getMaxX());
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
320 yy = Math.max(yy, dataArea.getMinY());
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
321 yy = Math.min(yy, dataArea.getMaxY());
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
322 }
f2a5fe968b98 issue814 line labels always visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3464
diff changeset
323
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
324 // Move to right until no collisions exist anymore
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
325 Shape hotspot = TextUtilities.calculateRotatedStringBounds(
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
326 waterlevelLabel, g2, (float)xx, (float)yy-3f,
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
327 TextAnchor.CENTER_LEFT,
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
328 0f, TextAnchor.CENTER_LEFT);
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
329 while (JFreeUtil.collides(hotspot, entities,
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
330 CollisionFreeLineLabelEntity.class)) {
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
331 xx += 5f;
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
332 hotspot = TextUtilities.calculateRotatedStringBounds(
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
333 waterlevelLabel, g2, (float)xx, (float)yy-3f, TextAnchor.CENTER_LEFT,
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
334 0f, TextAnchor.CENTER_LEFT);
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
335 }
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
336
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
337 // Register to avoid collissions.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
338 entities.add(new CollisionFreeLineLabelEntity(hotspot,
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
339 1, "", ""));
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
340
2662
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
341 // Fill background.
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
342 if (isShowLineLabelBG(series)) {
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
343 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
344 getLineLabelBGColor(series));
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
345 }
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
346
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
347 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
348
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
349 g2.setFont(oldFont);
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
350 g2.setColor(oldColor);
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
351 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
352
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
353 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
354 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
355 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
356 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
357
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
358 // 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
359 // area...
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
360 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
361 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
362 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
363 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
364
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
365
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
366 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
367 * 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
368 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
369 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
370 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
371 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
372
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
373
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
374 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
375 * Whether or not the minimum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
376 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
377 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
378 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
379 return false;
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
380 }
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
381
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
382 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
383 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
384
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
385
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
386 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
387 * Sets whether or not the maximum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
388 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
389 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
390 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
391 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
392
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
393
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
394 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
395 * Whether or not the maximum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
396 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
397 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
398 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
399 return false;
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
400 }
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
401
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
402 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
403 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
404
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
405 /** 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
406 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
407 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
408 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
409 }
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
410
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
411 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
412 }
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
413
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
414
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
415 /** 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
416 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
417 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
418 }
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
419
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
420
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
421 /** 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
422 public boolean isShowLineLabelBG(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
423 if (this.showLineLabelBG.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
424 return false;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
425 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
426
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
427 return showLineLabelBG.getBoolean(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
428 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
429
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
430
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
431 public void setShowLineLabelBG(int series, boolean doShow) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
432 this.showLineLabelBG.setBoolean(series, doShow);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
433 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
434
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
435 public Color getLineLabelBGColor(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
436 if (this.lineLabelBGColors.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
437 return null;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
438 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
439
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
440 return this.lineLabelBGColors.get(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
441 }
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 public void setLineLabelBGColor(int series, Color color) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
444 this.lineLabelBGColors.put(series, color);
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
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
447 public Color getLineLabelTextColor(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
448 if (this.lineLabelTextColors.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
449 return null;
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 return this.lineLabelTextColors.get(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
453 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
454
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
455 public void setLineLabelTextColor(int series, Color color) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
456 this.lineLabelTextColors.put(series, color);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
457 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
458
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
459 public void setLineLabelFont(Font font, int series) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
460 this.lineLabelFonts.put(series, font);
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
461 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
462
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
463 public Font getLineLabelFont(int series) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
464 return this.lineLabelFonts.get(series);
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
465 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
466
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
467
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
468 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
469 * True if the given item of given dataset has the smallest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
470 * X value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
471 */
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
472 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
473 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
474 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
475
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
476
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
477 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
478 * Get Minimum X Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
479 * 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
480 */
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
481 public double getMinimumX(XYDataset dataset, int series) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
482 Integer key = Integer.valueOf(series);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
483 Double old = seriesMinimumX.get(key);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
484
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
485 if (old != null) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
486 return old.doubleValue();
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
487 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
488
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
489 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
490
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
491 double min = Double.MAX_VALUE;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
492
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
493 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
494 double tmpValue = dataset.getXValue(series, i);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
495
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
496 if (tmpValue < min) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
497 min = tmpValue;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
498 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
499 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
500
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
501 seriesMinimumX.put(key, Double.valueOf(min));
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
502
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
503 return min;
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
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
506
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
507 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
508 * True if the given item of given dataset has the smallest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
509 * Y value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
510 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
511 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
512 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
513 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
514
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
515
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
516 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
517 * Get Minimum Y Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
518 * 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
519 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
520 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
521 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
522 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
523
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
524 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
525 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
526 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
527
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
528 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
529
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
530 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
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 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
533 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
534
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
535 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
536 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
537 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
538 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
539
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
540 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
541
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 min;
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
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
545
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
546 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
547 * True if the given item of given dataset has the biggest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
548 * Y value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
549 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
550 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
551 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
552 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
553
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
554
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
555 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
556 * Get maximum Y Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
557 * 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
558 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
559 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
560 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
561 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
562
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
563 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
564 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
565 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
566
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
567 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
568
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
569 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
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 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
572 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
573
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
574 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
575 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
576 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
577 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
578
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
579 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
580
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 max;
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 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
584 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org