annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java @ 3015:9cea02b51241

Added better doc and todo. flys-artifacts/trunk@4580 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 05 Jun 2012 11:53:51 +0000
parents bdc86e61428c
children e19ff9086035
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;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.awt.Graphics2D;
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
5 import java.awt.Font;
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
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.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
15 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
16 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
17 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
18 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
19 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
20 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
21 import org.jfree.data.xy.XYSeries;
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
22 import org.jfree.data.xy.XYSeriesCollection;
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;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import org.jfree.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
25 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
26
2653
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
27 import de.intevation.flys.jfree.HasLabel;
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
28
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
29
2642
42b05a4bed25 Cosmetics, added doc, TODO and OPTIMIZE to Enhanced*Renderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2591
diff changeset
30 /**
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
31 * Renderer with additional the additional functionality of renderering minima
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
32 * 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
33 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 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
35
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
36 /** 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
37 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
38 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
39
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 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
41 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
42 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
43
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 Map<Integer, Double> seriesMinimum;
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
45 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
46 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
47
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
48 protected Map<Integer, Font> lineLabelFonts;
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
49 protected Map<Integer, Color> lineLabelTextColors;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
50 protected BooleanList showLineLabelBG;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
51 protected Map<Integer, Color> lineLabelBGColors;
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
52
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 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
55 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
56 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
57 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
58 this.showLineLabel = new BooleanList();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
59 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
60 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
61 this.seriesMaximum = new HashMap<Integer, Double>();
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
62 this.seriesMinimumX = new HashMap<Integer, Double>();
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
63 this.lineLabelFonts = new HashMap<Integer, Font>();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
64 this.lineLabelTextColors = new HashMap<Integer, Color>();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
65 this.lineLabelBGColors = new HashMap<Integer, Color>();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
66 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
67
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
68
3015
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
69 /**
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
70 * 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
71 * @param g2 graphics device to use
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
72 * @param text text to draw
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
73 * @param textX x-position for text
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
74 * @param textY y-position for text
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
75 * @param bgColor color to fill box with.
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
76 */
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
77 public static void drawTextBox(Graphics2D g2,
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
78 String text, float textX, float textY, Color bgColor
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
79 ) {
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
80 Rectangle2D hotspotBox = g2.getFontMetrics().getStringBounds(text, g2);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
81 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
82 hotspotBox.setRect(textX, textY-h, w, h);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
83 Color oldColor = g2.getColor();
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
84 g2.setColor(bgColor);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
85 g2.fill(hotspotBox);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
86 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
87 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 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
91 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
92 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
93 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 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
96 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
97 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 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
100 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
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
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 false;
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
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
107 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
108 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
109 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
110
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
111
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
112 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
113 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
114 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
115
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
116
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 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
118 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
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 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
121 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
122 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
123
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
124 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
125 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
126 }
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 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
129 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
130
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
131 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
132 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
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
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
135
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
136 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
137 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
138
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
139 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
140 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
141 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
142
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
143 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
144 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
145 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
146
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
147 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
148 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
149
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
150 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
151 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
152 }
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
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 /**
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 * 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
157 * 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
158 * 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
159 */
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 @Override
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170 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
171 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
172 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
173 ) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 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
175
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 // 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
177 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
178 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
179 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
180 return;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 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
184 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
185 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
186 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
187 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
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 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
190 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
191
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
192 // 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
193 // 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
194 // content does not change during rendering).
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
195 // 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
196 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
197 && 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
198
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
199 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
200 && 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
201
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
202 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
203 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
204 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
205 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
206 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
207 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
208 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
209 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
210 else {
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
211 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
212 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
213
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 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
215 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
216 transX1);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 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
219 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
220 transY1);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 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
223 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
224 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
225 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
226 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
227 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228 else {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229 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
230 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231 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
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 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
234 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
235 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
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 else {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238 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
239 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 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
241 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
242 }
2591
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
243
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
244 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
245 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
246 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
247 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
248 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
249 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
250 }
74c02dbf17ca #523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2241
diff changeset
251 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
252 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
253 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
254 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
255 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
256 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
257 }
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 }
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
259 } // 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
260
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261 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
262 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
263 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
264 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
265 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
266 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 // draw the item label if there is one...
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269 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
270 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
271 (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
272 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
274 // Draw label of line.
3015
9cea02b51241 Added better doc and todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
275 // TODO add colision detection
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
276 if (isShowLineLabel(series) && isMinimumX (dataset, series, item)) {
2653
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
277 XYSeries xYSeries = ((XYSeriesCollection) dataset).getSeries(series);
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
278 String waterlevelLabel = (xYSeries instanceof HasLabel)
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
279 ? ((HasLabel)xYSeries).getLabel()
fa363aac788b Added accidentally ommitted File in last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2649
diff changeset
280 : xYSeries.getKey().toString();
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
281 // TODO Force water of some German rivers to flow direction mountains.
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
282 Font oldFont = g2.getFont();
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
283
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
284 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
285 g2.setFont(this.getLineLabelFont(series));
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
286 g2.setColor(this.getLineLabelTextColor(series));
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
287 g2.setBackground(Color.black);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
288
2662
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
289 // Fill background.
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
290 if (isShowLineLabelBG(series)) {
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
291 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
292 getLineLabelBGColor(series));
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
293 }
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
294
2649
6f5fc3de0d48 Most of issue454: Label waterlines.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
295 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
296
2659
4d8959a4b49d Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2656
diff changeset
297 g2.setFont(oldFont);
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
298 g2.setColor(oldColor);
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
299 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
300
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
301 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
302 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
303 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
304 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
305
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
306 // add an entity for the item, but only if it falls within the data
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
307 // area...
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
308 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
309 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
310 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
311 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
312
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
313
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
314 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
315 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
316 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
317
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
318
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
319 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
320 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
321 return false;
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
322 }
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
323
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
324 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
325 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
326
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
327
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
328 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
329 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
330 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
331
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
332
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
333 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
334 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
335 return false;
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
336 }
2b232871ba28 New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2075
diff changeset
337
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
338 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
339 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
340
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
341 /** 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
342 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
343 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
344 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
345 }
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
346
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
347 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
348 }
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
349
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
350
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
351 /** 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
352 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
353 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
354 }
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
355
2660
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
356 /** 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
357 public boolean isShowLineLabelBG(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
358 if (this.showLineLabelBG.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
359 return false;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
360 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
361
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
362 return showLineLabelBG.getBoolean(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
363 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
364
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
365 public void setShowLineLabelBG(int series, boolean doShow) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
366 this.showLineLabelBG.setBoolean(series, doShow);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
367 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
368
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
369 public Color getLineLabelBGColor(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
370 if (this.lineLabelBGColors.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
371 return null;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
372 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
373
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
374 return this.lineLabelBGColors.get(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
375 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
376
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
377 public void setLineLabelBGColor(int series, Color color) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
378 this.lineLabelBGColors.put(series, color);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
379 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
380
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
381 public Color getLineLabelTextColor(int series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
382 if (this.lineLabelTextColors.size() <= series) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
383 return null;
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
384 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
385
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
386 return this.lineLabelTextColors.get(series);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
387 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
388
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
389 public void setLineLabelTextColor(int series, Color color) {
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
390 this.lineLabelTextColors.put(series, color);
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
391 }
1a044c51abe4 Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2659
diff changeset
392
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
393 public void setLineLabelFont(Font font, int series) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
394 this.lineLabelFonts.put(series, font);
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
395 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
396
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
397 public Font getLineLabelFont(int series) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
398 return this.lineLabelFonts.get(series);
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
399 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2653
diff changeset
400
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
401
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
402 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
403 * True if the given item of given dataset has the smallest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
404 * X value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
405 */
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
406 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
407 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
408 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
409
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
410
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
411 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
412 * Get Minimum X Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
413 * 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
414 */
2644
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
415 public double getMinimumX(XYDataset dataset, int series) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
416 Integer key = Integer.valueOf(series);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
417 Double old = seriesMinimumX.get(key);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
418
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
419 if (old != null) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
420 return old.doubleValue();
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
421 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
422
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
423 logger.debug("Compute minimum of Series: " + series);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
424
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
425 double min = Double.MAX_VALUE;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
426
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
427 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
428 double tmpValue = dataset.getXValue(series, i);
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
429
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
430 if (tmpValue < min) {
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
431 min = tmpValue;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
432 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
433 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
434
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
435 seriesMinimumX.put(key, Double.valueOf(min));
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
436
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
437 return min;
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
438 }
0a84313efe60 Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2642
diff changeset
439
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
440
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
441 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
442 * True if the given item of given dataset has the smallest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
443 * Y value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
444 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
445 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
446 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
447 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
448
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
449
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
450 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
451 * Get Minimum Y Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
452 * 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
453 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
454 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
455 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
456 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
457
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
458 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
459 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
460 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
461
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
462 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
463
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
464 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
465
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
466 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
467 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
468
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
469 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
470 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
471 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
472 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
473
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
474 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
475
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
476 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
477 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
478
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
479
2647
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
480 /**
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
481 * True if the given item of given dataset has the biggest
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
482 * Y value within this set.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
483 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
484 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
485 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
486 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
487
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
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 * Get maximum Y Value of a given series in a dataset.
4b7a28e81643 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2644
diff changeset
491 * 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
492 */
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
493 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
494 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
495 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
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 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
498 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
499 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
500
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
501 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
502
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
503 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
504
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
505 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
506 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
507
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
508 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
509 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
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 }
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 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
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 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
516 }
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org