Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java @ 2645:4f7d1ea38404
Added simple Grubb's outlier test.
flys-artifacts/trunk@4300 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 25 Apr 2012 15:57:23 +0000 |
parents | 0a84313efe60 |
children | 4b7a28e81643 |
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; |
2591
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
5 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
|
6 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
|
7 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
|
8 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
|
9 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
|
10 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 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
|
12 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.jfree.chart.axis.ValueAxis; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.jfree.chart.entity.EntityCollection; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.jfree.chart.plot.CrosshairState; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.jfree.chart.plot.PlotOrientation; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.jfree.chart.plot.XYPlot; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import org.jfree.data.xy.XYDataset; |
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.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
|
21 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
|
22 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
|
23 |
2642
42b05a4bed25
Cosmetics, added doc, TODO and OPTIMIZE to Enhanced*Renderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2591
diff
changeset
|
24 /** |
42b05a4bed25
Cosmetics, added doc, TODO and OPTIMIZE to Enhanced*Renderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2591
diff
changeset
|
25 * Renderer with additional functionality. |
42b05a4bed25
Cosmetics, added doc, TODO and OPTIMIZE to Enhanced*Renderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2591
diff
changeset
|
26 */ |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 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
|
28 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 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
|
30 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
|
31 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 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
|
33 protected BooleanList isMaximumShapeVisible; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 protected Map<Integer, Double> seriesMinimum; |
2644
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
36 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
|
37 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
|
38 |
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 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
|
41 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
|
42 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
|
43 this.isMaximumShapeVisible = 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
|
44 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
|
45 this.seriesMaximum = new HashMap<Integer, Double>(); |
2644
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
46 this.seriesMinimumX = new HashMap<Integer, Double>(); |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 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
|
51 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
|
52 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
|
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 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 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
|
56 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
|
57 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 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
|
60 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
|
61 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 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
|
64 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
2591
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
67 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
|
68 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
|
69 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
70 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
71 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
72 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
|
73 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
|
74 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
75 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
76 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
77 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
|
78 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
|
79 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
80 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
|
81 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
|
82 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
|
83 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
84 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
|
85 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
|
86 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
87 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
88 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
|
89 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
90 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
91 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
|
92 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
|
93 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
94 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
95 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
96 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
|
97 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
|
98 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
103 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
|
104 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
|
105 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
106 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
107 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
|
108 } |
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 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
|
111 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
|
112 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
113 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
114 |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 /** |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 * 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
|
117 * 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
|
118 * 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
|
119 */ |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 @Override |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 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
|
133 ) { |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 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
|
135 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 // 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
|
137 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
|
138 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
|
139 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
|
140 return; |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 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
|
144 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
|
145 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
|
146 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
|
147 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
|
148 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 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
|
150 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
|
151 |
2644
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
152 // 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
|
153 // 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
|
154 // content does not change during rendering). |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
155 // 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
|
156 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
|
157 && 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
|
158 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
159 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
|
160 && 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
|
161 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
162 if (isMinimum) { |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
163 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
|
164 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
|
165 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
166 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
|
167 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
|
168 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
|
169 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
170 else { |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
171 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
|
172 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
173 |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 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
|
175 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
|
176 transX1); |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 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
|
179 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
|
180 transY1); |
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 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 else { |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 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
|
190 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 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
|
192 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 else { |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 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
|
199 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 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
|
201 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
|
202 } |
2591
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
203 |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 } |
74c02dbf17ca
#523 Improved the look of minimum and maximum shapes in chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2241
diff
changeset
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 } |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 } |
2642
42b05a4bed25
Cosmetics, added doc, TODO and OPTIMIZE to Enhanced*Renderer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2591
diff
changeset
|
219 // TODO labeling of waterlevels could happen here, too. |
2644
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
220 } // 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
|
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 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
|
223 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
|
224 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
|
225 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
|
226 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
|
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 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 // 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
|
230 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
|
231 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
|
232 (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
|
233 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 |
2644
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
235 boolean doWaterlevelLabel = false; |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
236 if (isMinimumX (dataset, series, item)) { |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
237 String waterlevelLabel = "label"; |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
238 // TODO Force water of some German rivers to flow direction mountains. |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
239 g2.drawString("waterlevel label", (float)xx, (float)yy-3f); |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
240 } |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
241 |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 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
|
246 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 // 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
|
248 // area... |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 if (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
|
250 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
|
251 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 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
|
256 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
|
257 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 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
|
261 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
|
262 return false; |
2b232871ba28
New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2075
diff
changeset
|
263 } |
2b232871ba28
New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2075
diff
changeset
|
264 |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 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
|
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 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 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
|
270 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
|
271 } |
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 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 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
|
275 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
|
276 return false; |
2b232871ba28
New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2075
diff
changeset
|
277 } |
2b232871ba28
New helper functions in ChartHelper and improvements in EnhancedLineAndShapeRenderer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2075
diff
changeset
|
278 |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 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
|
280 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 |
2644
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
283 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
|
284 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
|
285 } |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
286 |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
287 public double getMinimumX(XYDataset dataset, int series) { |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
288 Integer key = Integer.valueOf(series); |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
289 Double old = seriesMinimumX.get(key); |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
290 |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
291 if (old != null) { |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
292 return old.doubleValue(); |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
293 } |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
294 |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
295 logger.debug("Compute minimum of Series: " + series); |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
296 |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
297 double min = Double.MAX_VALUE; |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
298 |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
299 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
|
300 double tmpValue = dataset.getXValue(series, i); |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
301 |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
302 if (tmpValue < min) { |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
303 min = tmpValue; |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
304 } |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
305 } |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
306 |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
307 seriesMinimumX.put(key, Double.valueOf(min)); |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
308 |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
309 return min; |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
310 } |
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
311 |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
312 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
|
313 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
|
314 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
315 |
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 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
|
318 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
|
319 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
|
320 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
321 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
|
322 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
|
323 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
324 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
325 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
|
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 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
|
328 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
329 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
|
330 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
|
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 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
|
333 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
|
334 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
335 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
336 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
337 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
|
338 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
339 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
|
340 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
341 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
342 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
343 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
|
344 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
|
345 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
346 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
347 |
2644
0a84313efe60
Stub for labeling dataseries in EnhancedLineAndShapeRenerer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2642
diff
changeset
|
348 // |
2074
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
349 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
|
350 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
|
351 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
|
352 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
353 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
|
354 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
|
355 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
356 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
357 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
|
358 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
359 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
|
360 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
361 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
|
362 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
|
363 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
364 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
|
365 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
|
366 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
367 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
368 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
369 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
|
370 |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
371 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
|
372 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
373 } |
a026d005accd
Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
374 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |