annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledXYSeries.java @ 5543:732a8bd44650

Wst Parser: Yet another attempt to fix the order of the Q ranges (made by S. Teichmann)
author Tom Gottfried <tom.gottfried@intevation.de>
date Wed, 03 Apr 2013 21:02:17 +0200
parents 0f7abd95c6e2
children
rev   line source
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.jfree;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
3 import java.util.List;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import org.w3c.dom.Document;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
9 import org.jfree.data.xy.XYDataItem;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.jfree.data.xy.XYSeries;
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 /**
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
13 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 */
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
15 public class StyledXYSeries extends XYSeries implements StyledSeries, HasLabel {
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 private static final Logger logger = Logger.getLogger(StyledXYSeries.class);
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
19 protected Style style;
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
20
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
21 /** If this Series is to be labelled, use this String as label. */
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
22 protected String label;
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
23
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 public StyledXYSeries(String key, Document theme) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 this(key, true, theme);
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
27 this.label = key.toString();
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 }
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
29
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
30
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
31 public StyledXYSeries(String key, Document theme, XYSeries unstyledSeries) {
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
32 this(key, theme);
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
33 add(unstyledSeries);
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
34 }
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 /**
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 * @param sorted whether or not to sort the points. Sorting will move NANs
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 * to one extrema which can cause problems in certain
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 * algorithms.
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 */
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 public StyledXYSeries(String key, boolean sorted, Document theme) {
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 super(key, sorted);
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
44 setStyle(new XYStyle(theme));
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
45 this.label = key.toString();
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
49 @Override
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
50 public void setStyle(Style style) {
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
51 this.style = style;
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2074
diff changeset
52 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2074
diff changeset
53
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2074
diff changeset
54
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
55 @Override
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
56 public Style getStyle() {
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
57 return style;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 }
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
59
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2652
diff changeset
60
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
61 @Override
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
62 public String getLabel() {
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
63 return label;
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
64 }
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
65
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
66 @Override
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
67 public void setLabel(String label) {
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
68 this.label = label;
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2321
diff changeset
69 }
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
70
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
71 protected void add(XYSeries series) {
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
72 List<XYDataItem> items = series.getItems();
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
73 add(items);
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
74 }
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
75
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
76 protected void add(List<XYDataItem> items) {
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
77 for(XYDataItem item : items) {
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
78 add(item.getXValue(), item.getYValue());
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
79 }
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
80 }
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org