annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledXYSeries.java @ 3248:4eb91fb1e73e

Fix weird code with help of new ChartHelper. flys-artifacts/trunk@4881 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 06 Jul 2012 09:37:24 +0000
parents 8c78c707aa2d
children 0f7abd95c6e2
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
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
12 import de.intevation.flys.jfree.HasLabel;
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
13
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
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 /**
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
16 * @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
17 */
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
18 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
19
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 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
21
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
22 protected Style style;
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
23
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
24 /** 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
25 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
26
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 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
29 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
30 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
31 }
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
32
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
33
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
34 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
35 this(key, theme);
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
36 add(unstyledSeries);
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
37 }
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 /**
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 * @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
42 * 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
43 * algorithms.
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 */
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 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
46 super(key, sorted);
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
47 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
48 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
49 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
52 @Override
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
53 public void setStyle(Style style) {
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
54 this.style = style;
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2074
diff changeset
55 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2074
diff changeset
56
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2074
diff changeset
57
2321
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
58 @Override
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
59 public Style getStyle() {
991e4a5df323 Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
60 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
61 }
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
62
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2652
diff changeset
63
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
64 @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
65 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
66 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
67 }
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
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 @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
70 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
71 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
72 }
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
73
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
74 protected void add(XYSeries series) {
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
75 List<XYDataItem> items = series.getItems();
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
76 add(items);
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
77 }
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
78
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
79 protected void add(List<XYDataItem> items) {
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
80 for(XYDataItem item : items) {
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
81 add(item.getXValue(), item.getYValue());
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
82 }
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3076
diff changeset
83 }
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 }
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org