Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java @ 3136:f12a8ed8d973
FixA: Fixed stupid i/j switch bug.
flys-artifacts/trunk@4744 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 21 Jun 2012 13:48:26 +0000 |
parents | 5a0aef74c316 |
children | 74c974b10c75 |
rev | line source |
---|---|
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.jfree; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.awt.BasicStroke; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.awt.Color; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.awt.geom.Ellipse2D; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Document; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.utils.ThemeUtil; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 /** |
2648
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
16 * Utility to apply theme-settings to a renderer. |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 public class XYStyle implements Style { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 protected Document theme; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
23 protected XYLineAndShapeRenderer renderer; |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 public XYStyle(Document theme) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 this.theme = theme; |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
27 this.renderer = null; |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 /** |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 * Applies line color, size and type attributes to renderer, also |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 * whether to draw lines and/or points. |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 public XYLineAndShapeRenderer applyTheme(XYLineAndShapeRenderer r, int idx){ |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
36 this.renderer = r; |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 applyLineColor(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 applyLineSize(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 applyLineType(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 applyShowLine(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 applyShowPoints(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 applyPointSize(r, idx); |
3090
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
43 applyPointColor(r, idx); |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 applyShowMinimum(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 applyShowMaximum(r, idx); |
2648
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
46 applyShowLineLabel(r, idx); |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
47 applyLineLabelFont(r, idx); |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
48 applyLineLabelColor(r, idx); |
2662
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
49 applyShowLineLabelBG(r, idx); |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
50 applyLineLabelBGColor(r, idx); |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 return r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 /** Set line color to renderer. */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 protected void applyLineColor(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 Color c = ThemeUtil.parseLineColorField(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 r.setSeriesPaint(idx, c); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
2648
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
63 /** Tells the renderer whether or not to add a label to a line. */ |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
64 protected void applyShowLineLabel(XYLineAndShapeRenderer r, int idx) { |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
65 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
66 return; |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
67 } |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
68 boolean showLabelLine = ThemeUtil.parseShowLineLabel(theme); |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
69 ((EnhancedLineAndShapeRenderer)r).setShowLineLabel(showLabelLine, idx); |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
70 } |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
71 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
72 |
2662
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
73 /** Tells the renderer whether or not to fill the bg of a lines label. */ |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
74 protected void applyShowLineLabelBG(XYLineAndShapeRenderer r, int idx) { |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
75 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
76 return; |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
77 } |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
78 boolean showLabelLine = ThemeUtil.parseShowLineLabelBG(theme); |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
79 ((EnhancedLineAndShapeRenderer)r).setShowLineLabelBG(idx, showLabelLine); |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
80 } |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
81 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
82 /** Tell the renderer which font (and -size and -style) to use for |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
83 * linelabels. */ |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
84 protected void applyLineLabelFont(XYLineAndShapeRenderer r, int idx) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
85 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
86 return; |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
87 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
88 ((EnhancedLineAndShapeRenderer)r).setLineLabelFont(ThemeUtil.parseLineLabelFont(theme), idx); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
89 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
90 |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
91 /** Tell the renderer which color to use for |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
92 * linelabels. */ |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
93 protected void applyLineLabelColor(XYLineAndShapeRenderer r, int idx) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
94 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
95 return; |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
96 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
97 ((EnhancedLineAndShapeRenderer)r).setLineLabelTextColor(idx, ThemeUtil.parseLineLabelTextColor(theme)); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
98 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
99 |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
100 /** Tell the renderer which color to use for bg of |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
101 * linelabels. */ |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
102 protected void applyLineLabelBGColor(XYLineAndShapeRenderer r, int idx) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
103 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
104 return; |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
105 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
106 ((EnhancedLineAndShapeRenderer)r).setLineLabelBGColor(idx, |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
107 ThemeUtil.parseLineLabelBGColor(theme)); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
108 } |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
109 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
110 /** Set stroke of series. */ |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 protected void applyLineSize(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 int size = ThemeUtil.parseLineWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 r.setSeriesStroke( |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 idx, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 new BasicStroke(Integer.valueOf(size))); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
119 /** Set stroke strength of series. */ |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 protected void applyLineType(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 int size = ThemeUtil.parseLineWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 float[] dashes = ThemeUtil.parseLineStyle(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 // Do not apply the dashed style. |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 if (dashes.length <= 1) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 return; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 r.setSeriesStroke( |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 idx, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 new BasicStroke(Integer.valueOf(size), |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 BasicStroke.CAP_BUTT, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 BasicStroke.JOIN_ROUND, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 1.0f, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 dashes, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 0.0f)); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 protected void applyPointSize(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 int size = ThemeUtil.parsePointWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 int dim = 2 * size; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 r.setSeriesShape(idx, new Ellipse2D.Double(-size, -size, dim, dim)); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 |
3090
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
148 protected void applyPointColor(XYLineAndShapeRenderer r, int idx) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
149 Color c = ThemeUtil.parsePointColor(theme); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
150 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
151 if (c != null) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
152 r.setSeriesFillPaint(idx, c); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
153 r.setUseFillPaint(true); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
154 r.setDrawOutlines(false); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
155 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
156 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
157 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
158 |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 /** |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 * Sets form and visibility of points. |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 protected void applyShowPoints(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 boolean show = ThemeUtil.parseShowPoints(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 r.setSeriesShapesVisible(idx, show); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 r.setDrawOutlines(true); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 protected void applyShowLine(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 boolean show = ThemeUtil.parseShowLine(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 r.setSeriesLinesVisible(idx, show); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 protected void applyShowMinimum(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 return; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 boolean visible = ThemeUtil.parseShowMinimum(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 EnhancedLineAndShapeRenderer er = (EnhancedLineAndShapeRenderer) r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 er.setIsMinimumShapeVisisble(idx, visible); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 protected void applyShowMaximum(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 return; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 boolean visible = ThemeUtil.parseShowMaximum(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 EnhancedLineAndShapeRenderer er = (EnhancedLineAndShapeRenderer) r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 er.setIsMaximumShapeVisible(idx, visible); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 } |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
198 |
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
199 |
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
200 public XYLineAndShapeRenderer getRenderer() { |
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
201 return this.renderer; |
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
202 } |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |