annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java @ 3588:76571c601d06

Add more discharge curve data to DC and W/Q diag. flys-artifacts/trunk@5204 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 14 Aug 2012 14:02:28 +0000
parents 0b9b2a0c4e64
children f2a5fe968b98
rev   line source
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.jfree;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
3 import java.awt.Color;
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
4 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
5 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
6 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
7 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
8 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
9 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
10 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
11
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 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
13 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
14 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
15 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
16 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
17 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
18 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
19 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
20 import org.jfree.data.xy.XYSeries;
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
21 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
22 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
23 import org.jfree.ui.RectangleEdge;
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
24 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
25 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
26 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
27
2642
42b05a4bed25 Cosmetics, added doc, TODO and OPTIMIZE to Enhanced*Renderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2591
diff changeset
28 /**
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
29 * Renderer with additional the additional functionality of renderering minima
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
30 * 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
31 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 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
33
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
34 /**
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
35 *
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
36 */
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3395
diff changeset
37 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
38
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
39 /** Own logger. */
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 private static final Logger logger =
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 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
42
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 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
44 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
45 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
46
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 protected Map<Integer, Double> seriesMinimum;
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
48 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
49 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
50
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
51 protected Map<Integer, Font> lineLabelFonts;
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
52 protected Map<Integer, Color> lineLabelTextColors;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
53 protected BooleanList showLineLabelBG;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
54 protected Map<Integer, Color> lineLabelBGColors;
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
55
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 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
58 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
59 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
60 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
61 this.showLineLabel = new BooleanList();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
62 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
63 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
64 this.seriesMaximum = new HashMap<Integer, Double>();
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
65 this.seriesMinimumX = new HashMap<Integer, Double>();
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
66 this.lineLabelFonts = new HashMap<Integer, Font>();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
67 this.lineLabelTextColors = new HashMap<Integer, Color>();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
68 this.lineLabelBGColors = new HashMap<Integer, Color>();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
69 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
70
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
71
3015
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
72 /**
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
73 * 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
74 * @param g2 graphics device to use
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
75 * @param text text to draw
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
76 * @param textX x-position for text
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
77 * @param textY y-position for text
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
78 * @param bgColor color to fill box with.
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
79 */
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
80 public static void drawTextBox(Graphics2D g2,
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
81 String text, float textX, float textY, Color bgColor
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
82 ) {
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
83 Rectangle2D hotspotBox = g2.getFontMetrics().getStringBounds(text, g2);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
84 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
85 hotspotBox.setRect(textX, textY-h, w, h);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
86 Color oldColor = g2.getColor();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
87 g2.setColor(bgColor);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
88 g2.fill(hotspotBox);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
89 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
90 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
93 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
94 * 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
95 * be rendered with shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
96 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 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
98 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
99 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
100 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 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
103 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
104 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
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 (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
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 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
111 }
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
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
114 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
115 * Rectangle used to draw maximums shape.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
116 */
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
117 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
118 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
119 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
120
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
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 minimums 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 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
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
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
130 /** 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
131 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
132 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
133
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
134 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
135 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
136 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
137
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
138 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
139 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
140 }
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 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
143 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
144
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
145 logger.warn("Item paint is no instance of Color!");
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
146 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
147 }
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
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
150 /** 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
151 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
152 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
153
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
154 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
155 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
156 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
157
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
158 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
159 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
160 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
161
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
162 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
163 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
164
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
165 logger.warn("Item paint is no instance of Color!");
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
166 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
167 }
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
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 /**
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 * 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
172 * 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
173 * 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
174 */
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 @Override
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 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
177 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
178 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
179 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
180 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
181 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
182 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
183 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
184 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
185 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
186 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
187 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
188 ) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 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
190
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 // 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
192 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
193 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
194 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
195 return;
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
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 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
199 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
200 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
201 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
202 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
203
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 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
205 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
206
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
207 // 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
208 // 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
209 // content does not change during rendering).
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
210 // 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
211 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
212 && 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
213
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
214 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
215 && 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
216
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
217 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
218 logger.debug("Create a Minimum shape.");
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
219 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
220 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
221 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
222 logger.debug("Create a Maximum shape.");
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
223 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
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 else {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
226 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
227 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
228
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229 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
230 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
231 transX1);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 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
234 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
235 transY1);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 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
238 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
239 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
240 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
241 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
242 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
243 else {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 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
245 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246 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
247 }
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 (getDrawOutlines()) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 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
250 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
251 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 else {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253 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
254 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 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
256 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
257 }
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
258
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
259 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
260 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
261 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
262 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
263 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
264 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
265 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
266 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
267 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
268 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
269 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
270 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
271 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
272 }
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273 }
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
274 } // 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
275
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
276 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
277 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
278 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
279 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
280 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
281 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
283 // 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
284 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
285 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
286 (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
287 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
289 // Draw label of line.
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
290 if (dataset instanceof XYSeriesCollection
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
291 && isShowLineLabel(series)
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
292 && isMinimumX (dataset, series, item)
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
293 ) {
2653
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
294 XYSeries xYSeries = ((XYSeriesCollection) dataset).getSeries(series);
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
295 String waterlevelLabel = (xYSeries instanceof HasLabel)
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
296 ? ((HasLabel)xYSeries).getLabel()
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
297 : xYSeries.getKey().toString();
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
298 // 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
299
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
300 Font oldFont = g2.getFont();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
301
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
302 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
303 g2.setFont(this.getLineLabelFont(series));
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
304 g2.setColor(this.getLineLabelTextColor(series));
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
305 g2.setBackground(Color.black);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
306
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
307 // Move to right until no collisions exist anymore
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
308 Shape hotspot = TextUtilities.calculateRotatedStringBounds(
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
309 waterlevelLabel, g2, (float)xx, (float)yy-3f,
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
310 TextAnchor.CENTER_LEFT,
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
311 0f, TextAnchor.CENTER_LEFT);
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
312 while (JFreeUtil.collides(hotspot, entities,
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
313 CollisionFreeLineLabelEntity.class)) {
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
314 xx += 5f;
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
315 hotspot = TextUtilities.calculateRotatedStringBounds(
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
316 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
317 0f, TextAnchor.CENTER_LEFT);
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
318 }
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
319
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
320 // Register to avoid collissions.
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
321 entities.add(new CollisionFreeLineLabelEntity(hotspot,
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
322 1, "", ""));
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
323
2662
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
324 // Fill background.
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
325 if (isShowLineLabelBG(series)) {
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
326 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
327 getLineLabelBGColor(series));
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
328 }
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
329
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
330 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
331
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
332 g2.setFont(oldFont);
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
333 g2.setColor(oldColor);
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
334 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
335
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
336 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
337 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
338 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
339 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
340
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
341 // 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
342 // area...
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
343 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
344 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
345 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
346 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
347
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
348
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
349 /**
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3015
diff changeset
350 * 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
351 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
352 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
353 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
354 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
355
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
356
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
357 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
358 * Whether or not the minimum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
359 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
360 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
361 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
362 return false;
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
363 }
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
364
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
365 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
366 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
367
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
368
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
369 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
370 * Sets whether or not the maximum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
371 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
372 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
373 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
374 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
375
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
376
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
377 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
378 * Whether or not the maximum should be rendered with shape.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
379 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
380 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
381 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
382 return false;
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
383 }
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
384
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
385 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
386 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
387
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
388 /** 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
389 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
390 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
391 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
392 }
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
393
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
394 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
395 }
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
396
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
397
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
398 /** 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
399 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
400 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
401 }
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
402
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
403
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
404 /** 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
405 public boolean isShowLineLabelBG(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
406 if (this.showLineLabelBG.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
407 return false;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
408 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
409
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
410 return showLineLabelBG.getBoolean(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
411 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
412
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3317
diff changeset
413
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
414 public void setShowLineLabelBG(int series, boolean doShow) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
415 this.showLineLabelBG.setBoolean(series, doShow);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
416 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
417
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
418 public Color getLineLabelBGColor(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
419 if (this.lineLabelBGColors.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
420 return null;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
421 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
422
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
423 return this.lineLabelBGColors.get(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
424 }
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 public void setLineLabelBGColor(int series, Color color) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
427 this.lineLabelBGColors.put(series, color);
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
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
430 public Color getLineLabelTextColor(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
431 if (this.lineLabelTextColors.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
432 return null;
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 return this.lineLabelTextColors.get(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
436 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
437
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
438 public void setLineLabelTextColor(int series, Color color) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
439 this.lineLabelTextColors.put(series, color);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
440 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
441
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
442 public void setLineLabelFont(Font font, int series) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
443 this.lineLabelFonts.put(series, font);
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
444 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
445
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
446 public Font getLineLabelFont(int series) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
447 return this.lineLabelFonts.get(series);
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
448 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
449
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
450
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
451 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
452 * True if the given item of given dataset has the smallest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
453 * X value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
454 */
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
455 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
456 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
457 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
458
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
459
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
460 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
461 * Get Minimum X Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
462 * 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
463 */
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
464 public double getMinimumX(XYDataset dataset, int series) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
465 Integer key = Integer.valueOf(series);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
466 Double old = seriesMinimumX.get(key);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
467
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
468 if (old != null) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
469 return old.doubleValue();
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
470 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
471
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
472 logger.debug("Compute minimum of Series: " + series);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
473
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
474 double min = Double.MAX_VALUE;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
475
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
476 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
477 double tmpValue = dataset.getXValue(series, i);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
478
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
479 if (tmpValue < min) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
480 min = tmpValue;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
481 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
482 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
483
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
484 seriesMinimumX.put(key, Double.valueOf(min));
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
485
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
486 return min;
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
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
489
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
490 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
491 * True if the given item of given dataset has the smallest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
492 * Y value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
493 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
494 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
495 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
496 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
497
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
498
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
499 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
500 * Get Minimum Y Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
501 * 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
502 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
503 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
504 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
505 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
506
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
507 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
508 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
509 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
510
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
511 logger.debug("Compute minimum of Series: " + series);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
512
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
513 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
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 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
516 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
517
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
518 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
519 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
520 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
521 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
522
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
523 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
524
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 min;
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
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
528
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
529 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
530 * True if the given item of given dataset has the biggest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
531 * Y value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
532 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
533 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
534 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
535 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
536
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
537
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
538 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
539 * Get maximum Y Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
540 * 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
541 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
542 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
543 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
544 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
545
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
546 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
547 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
548 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
549
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
550 logger.debug("Compute maximum of Series: " + series);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
551
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
552 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
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 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
555 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
556
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
557 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
558 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
559 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
560 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
561
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
562 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
563
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 max;
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 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
567 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org