Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java @ 2780:772d0c8100d3
Improved 'line-to-curve' rendering.
flys-artifacts/trunk@4519 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 25 May 2012 13:34:46 +0000 |
parents | bdc86e61428c |
children | 22def36d37b7 |
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 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public XYStyle(Document theme) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 this.theme = theme; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
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 * 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
|
31 * whether to draw lines and/or points. |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public XYLineAndShapeRenderer applyTheme(XYLineAndShapeRenderer r, int idx){ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 applyLineColor(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 applyLineSize(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 applyLineType(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 applyShowLine(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 applyShowPoints(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 applyPointSize(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 applyShowMinimum(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 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
|
42 applyShowLineLabel(r, idx); |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
43 applyLineLabelFont(r, idx); |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
44 applyLineLabelColor(r, idx); |
2662
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
45 applyShowLineLabelBG(r, idx); |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
46 applyLineLabelBGColor(r, idx); |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 return r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
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 /** Set line color to renderer. */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 protected void applyLineColor(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 Color c = ThemeUtil.parseLineColorField(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 r.setSeriesPaint(idx, c); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
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
|
59 /** 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
|
60 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
|
61 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
|
62 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
|
63 } |
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 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
|
65 ((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
|
66 } |
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 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
68 |
2662
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
69 /** 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
|
70 protected void applyShowLineLabelBG(XYLineAndShapeRenderer r, int idx) { |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
71 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
72 return; |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
73 } |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
74 boolean showLabelLine = ThemeUtil.parseShowLineLabelBG(theme); |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
75 ((EnhancedLineAndShapeRenderer)r).setShowLineLabelBG(idx, showLabelLine); |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
76 } |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
77 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
78 /** 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
|
79 * linelabels. */ |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
80 protected void applyLineLabelFont(XYLineAndShapeRenderer r, int idx) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
81 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
82 return; |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
83 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
84 ((EnhancedLineAndShapeRenderer)r).setLineLabelFont(ThemeUtil.parseLineLabelFont(theme), idx); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
85 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
86 |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
87 /** 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
|
88 * linelabels. */ |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
89 protected void applyLineLabelColor(XYLineAndShapeRenderer r, int idx) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
90 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
91 return; |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
92 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
93 ((EnhancedLineAndShapeRenderer)r).setLineLabelTextColor(idx, ThemeUtil.parseLineLabelTextColor(theme)); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
94 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
95 |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
96 /** 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
|
97 * linelabels. */ |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
98 protected void applyLineLabelBGColor(XYLineAndShapeRenderer r, int idx) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
99 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
100 return; |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
101 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
102 ((EnhancedLineAndShapeRenderer)r).setLineLabelBGColor(idx, |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
103 ThemeUtil.parseLineLabelBGColor(theme)); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
104 } |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
105 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
106 /** Set stroke of series. */ |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 protected void applyLineSize(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 int size = ThemeUtil.parseLineWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 r.setSeriesStroke( |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 idx, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 new BasicStroke(Integer.valueOf(size))); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
115 /** Set stroke strength of series. */ |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 protected void applyLineType(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 int size = ThemeUtil.parseLineWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 float[] dashes = ThemeUtil.parseLineStyle(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 // Do not apply the dashed style. |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 if (dashes.length <= 1) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 return; |
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 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 r.setSeriesStroke( |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 idx, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 new BasicStroke(Integer.valueOf(size), |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 BasicStroke.CAP_BUTT, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 BasicStroke.JOIN_ROUND, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 1.0f, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 dashes, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 0.0f)); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 protected void applyPointSize(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 int size = ThemeUtil.parsePointWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 int dim = 2 * size; |
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 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
|
141 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
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 /** |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 * Sets form and visibility of points. |
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 protected void applyShowPoints(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 boolean show = ThemeUtil.parseShowPoints(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 r.setSeriesShapesVisible(idx, show); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 r.setDrawOutlines(true); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 protected void applyShowLine(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 boolean show = ThemeUtil.parseShowLine(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 r.setSeriesLinesVisible(idx, show); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 } |
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 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 protected void applyShowMinimum(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 return; |
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 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 boolean visible = ThemeUtil.parseShowMinimum(theme); |
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 EnhancedLineAndShapeRenderer er = (EnhancedLineAndShapeRenderer) r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 er.setIsMinimumShapeVisisble(idx, visible); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 protected void applyShowMaximum(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 return; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 boolean visible = ThemeUtil.parseShowMaximum(theme); |
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 EnhancedLineAndShapeRenderer er = (EnhancedLineAndShapeRenderer) r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 er.setIsMaximumShapeVisible(idx, visible); |
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 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |