Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/XMLChartTheme.java @ 591:b8ba642b6866
Fixed the broken JUnittests.
gnv-artifacts/trunk@646 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 29 Jan 2010 13:19:34 +0000 |
parents | 22a6493e8460 |
children | 3d13fa281a7e |
rev | line source |
---|---|
304
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.chart; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.awt.Font; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.awt.Color; |
327
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
5 import java.awt.geom.Ellipse2D; |
304
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.lang.NumberFormatException; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import org.apache.log4j.Logger; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import org.jfree.chart.StandardChartTheme; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import org.jfree.chart.plot.XYPlot; |
327
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
12 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; |
304
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.jfree.ui.RectangleInsets; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.jfree.util.UnitType; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Document; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifactdatabase.Config; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 */ |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public class XMLChartTheme |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 extends StandardChartTheme |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 private static final Color DEFAULT_COLOR = Color.BLACK; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 private Logger log = Logger.getLogger(XMLChartTheme.class); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 protected boolean domainCrosshairVisible; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 protected boolean rangeCrosshairVisible; |
327
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
33 protected boolean renderLines; |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
34 protected boolean renderShapes; |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
35 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
36 protected int pointWidth; |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
37 protected int pointHeight; |
304
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 public XMLChartTheme(String name) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 super(name); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 public void setDomainCrosshairVisible(boolean visible) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 this.domainCrosshairVisible = visible; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 public boolean getDomainCrosshairVisible() { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 return domainCrosshairVisible; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 public boolean getRangeCrosshairVisible() { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 return rangeCrosshairVisible; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 public void setRangeCrosshairVisible(boolean visible) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 this.rangeCrosshairVisible = visible; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 public void applyXMLConfiguration(Document document) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 log.debug("create XMLChartTheme"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 init(document); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 private void init(Document document) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 log.debug("init XMLChartTheme parameters"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 initChartParameters(document); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 initTitleParameters(document); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 initSubtitleParameters(document); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 initPlotParameters(document); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 initAxisParameters(document); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 initLegendParameters(document); |
327
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
81 initRenderer(document); |
304
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 private void initTitleParameters(Document document) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 log.debug("init title parameters."); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 int size = getInt(document, "theme/title/font/size/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 String type = getString(document, "theme/title/font/type/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 boolean bold = getBool(document, "theme/title/font/bold/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 setExtraLargeFont(createFont(type, size, bold)); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 String color = getString(document, "theme/title/font/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 Color c = decodeColor(color); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 setTitlePaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 private void initSubtitleParameters(Document document) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 log.debug("init title parameters."); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 int size = getInt(document, "theme/subtitle/font/size/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 String type = getString(document, "theme/subtitle/font/type/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 boolean bold = getBool(document, "theme/subtitle/font/bold/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 setLargeFont(createFont(type, size, bold)); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 String col = getString(document, "theme/subtitle/font/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 setSubtitlePaint(Color.decode(col)); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 private void initChartParameters(Document document) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 log.debug("init chart parameters."); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 String bg = getString(document, "theme/chart/background/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 Color c = decodeColor(bg); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 setChartBackgroundPaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 private void initPlotParameters(Document document) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 log.debug("init plot parameters."); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 String tmp = null; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 tmp = getString(document, "theme/plot/background/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 Color c = decodeColor(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 setPlotBackgroundPaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 tmp = getString(document, "theme/plot/outline/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 c = decodeColor(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 setPlotOutlinePaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 tmp = getString(document, "theme/plot/domaingridline/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 c = decodeColor(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 setDomainGridlinePaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 tmp = getString(document, "theme/plot/rangegridline/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 c = decodeColor(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 setRangeGridlinePaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 boolean rangeCrosshairVisible = getBool( |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 document, "theme/plot/rangecrosshair/visible/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 setRangeCrosshairVisible(rangeCrosshairVisible); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 boolean domainCrosshairVisible = getBool( |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 document, "theme/plot/domaincrosshair/visible/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 setDomainCrosshairVisible(domainCrosshairVisible); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 int top = getInt(document, "theme/plot/offset/top/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 int bottom = getInt(document, "theme/plot/offset/bottom/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 int left = getInt(document, "theme/plot/offset/left/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 int right = getInt(document, "theme/plot/offset/right/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 setAxisOffset(new RectangleInsets( |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 UnitType.RELATIVE, |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 top, left, bottom, right) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 ); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 private void initAxisParameters(Document document) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 log.debug("init axis parameters."); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 String tmp = null; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 tmp = getString(document, "theme/axis/label/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 Color c = decodeColor(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 setAxisLabelPaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 tmp = getString(document, "theme/axis/ticklabel/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 c = decodeColor(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 setTickLabelPaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 private void initLegendParameters(Document document) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 log.debug("init legend parameters."); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 String tmp = null; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 tmp = getString(document, "theme/legend/font/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 Color c = decodeColor(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 setLegendItemPaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 tmp = getString(document, "theme/legend/background/color/@value"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 c = decodeColor(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 if (c != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 setLegendBackgroundPaint(c); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 |
327
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
200 private void initRenderer(Document document) { |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
201 log.debug("init renderer parameters."); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
202 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
203 pointWidth = getInt(document, "theme/plot/itemrenderer/width/@value"); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
204 log.debug("Read point width of " + pointWidth); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
205 pointHeight = getInt(document, "theme/plot/itemrenderer/height/@value"); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
206 log.debug("Read point height of " + pointHeight); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
207 renderLines = getBool( |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
208 document, "theme/plot/itemrenderer/renderLines/@value" |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
209 ); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
210 renderShapes = getBool( |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
211 document, "theme/plot/itemrenderer/renderPoints/@value" |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
212 ); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
213 } |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
214 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
215 |
304
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 private static String getString(Document document, String xpath) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 return Config.getStringXPath(document, xpath); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 private static int getInt(Document document, String xpath) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 String tmp = getString(document, xpath); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 if (tmp != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 return Integer.parseInt(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 else |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 return 0; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 private static boolean getBool(Document document, String xpath) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 String tmp = getString(document, xpath); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 if (tmp != null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 return Boolean.parseBoolean(tmp); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 else |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 return false; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 protected Color decodeColor(String color) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 try { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 if (color == null) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 return null; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 return Color.decode(color); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 catch (NumberFormatException nfe) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 log.warn("Error while parsing color: " + color, nfe); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 return null; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 protected Font createFont(String type, int size, boolean bold) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 Font font = null; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 if (bold) |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 font = new Font(type, Font.BOLD, size); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 else |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 font = new Font(type, Font.PLAIN, size); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
262 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 return font; |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 protected void applyToXYPlot(XYPlot plot) { |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 log.debug("apply theme parameter to XYPlot"); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 super.applyToXYPlot(plot); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 plot.setDomainCrosshairVisible(this.domainCrosshairVisible); |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 plot.setRangeCrosshairVisible(this.rangeCrosshairVisible); |
327
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
273 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
274 applyToXYLineAndShapeRenderer(plot); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
275 } |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
276 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
277 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
278 protected void applyToXYLineAndShapeRenderer(XYPlot plot) { |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
279 if (plot == null) |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
280 return; |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
281 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
282 XYLineAndShapeRenderer renderer = |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
283 (XYLineAndShapeRenderer) plot.getRenderer(); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
284 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
285 Ellipse2D.Double point = new Ellipse2D.Double( |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
286 -(pointWidth/2), -(pointHeight/2), pointWidth, pointHeight |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
287 ); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
288 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
289 renderer.setSeriesShape(0, point); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
290 renderer.setSeriesShapesVisible(0, renderShapes); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
291 renderer.setSeriesLinesVisible(0, renderLines); |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
292 |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
293 plot.setRenderer(renderer); |
304
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
294 } |
a16d337c5678
The style of charts can be configured with ChartThemes using XML configuration files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 } |