comparison artifacts/src/main/java/org/dive4elements/river/jfree/StyledAreaSeriesCollection.java @ 8885:e5f688820951

Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
author gernotbelger
date Wed, 14 Feb 2018 18:10:28 +0100
parents 5e38e2924c07
children d9c89651bd67
comparison
equal deleted inserted replaced
8884:7a8c12706834 8885:e5f688820951
25 */ 25 */
26 public class StyledAreaSeriesCollection extends XYSeriesCollection { 26 public class StyledAreaSeriesCollection extends XYSeriesCollection {
27 private static final long serialVersionUID = 5274940965666948237L; 27 private static final long serialVersionUID = 5274940965666948237L;
28 28
29 /** Mode, how to draw/which areas to fill. */ 29 /** Mode, how to draw/which areas to fill. */
30 public enum FILL_MODE {UNDER, ABOVE, BETWEEN}; 30 public enum FILL_MODE {UNDER, ABOVE, BETWEEN}
31 31
32 /** MODE in use. */ 32 /** MODE in use. */
33 protected FILL_MODE mode; 33 private FILL_MODE mode;
34 34
35 /** Theme-document with attributes about actual visual representation. */ 35 /** Theme-document with attributes about actual visual representation. */
36 protected ThemeDocument theme; 36 private ThemeDocument theme;
37
38 37
39 /** 38 /**
40 * @param theme the theme-document. 39 * @param theme the theme-document.
41 */ 40 */
42 public StyledAreaSeriesCollection(ThemeDocument theme) { 41 public StyledAreaSeriesCollection(ThemeDocument theme) {
68 ) { 67 ) {
69 applyFillColor(renderer); 68 applyFillColor(renderer);
70 applyShowShape(renderer); 69 applyShowShape(renderer);
71 applyOutlineColor(renderer); 70 applyOutlineColor(renderer);
72 applyOutlineStyle(renderer); 71 applyOutlineStyle(renderer);
72 applyShowLine(renderer);
73 applyShowAreaLabel(renderer); 73 applyShowAreaLabel(renderer);
74 if (mode == FILL_MODE.UNDER) { 74 if (mode == FILL_MODE.UNDER) {
75 renderer.setAreaCalculationMode( 75 renderer.setAreaCalculationMode(
76 StableXYDifferenceRenderer.CALCULATE_NEGATIVE_AREA); 76 StableXYDifferenceRenderer.CALCULATE_NEGATIVE_AREA);
77 } 77 }
88 theme.parseComplexTextStyle().apply(renderer); 88 theme.parseComplexTextStyle().apply(renderer);
89 return renderer; 89 return renderer;
90 } 90 }
91 91
92 92
93 protected void applyFillColor(StableXYDifferenceRenderer renderer) { 93 private void applyFillColor(StableXYDifferenceRenderer renderer) {
94 Color paint = theme.parseAreaBackgroundColor(); 94 Color paint = theme.parseAreaBackgroundColor();
95 95
96 int transparency = theme.parseAreaTransparency(); 96 int transparency = theme.parseAreaTransparency();
97 if (transparency > 0 && paint != null) { 97 if (transparency > 0 && paint != null) {
98 paint = new Color( 98 paint = new Color(
117 renderer.setNegativePaint(paint); 117 renderer.setNegativePaint(paint);
118 } 118 }
119 } 119 }
120 120
121 121
122 protected void applyShowShape(StableXYDifferenceRenderer renderer) { 122 private void applyShowShape(StableXYDifferenceRenderer renderer) {
123 boolean show = theme.parseAreaShowBorder(); 123 boolean show = theme.parseAreaShowBorder();
124 renderer.setDrawOutline(show); 124 renderer.setDrawOutline(show);
125 } 125 }
126 126
127 127
128 protected void applyShowLine(StableXYDifferenceRenderer renderer) { 128 private void applyShowLine(StableXYDifferenceRenderer renderer) {
129 boolean show = theme.parseShowLine(); 129 boolean show = theme.parseShowLine();
130 renderer.setShapesVisible(show); 130 renderer.setShapesVisible(show);
131 } 131 }
132 132
133 133 private void applyOutlineColor(StableXYDifferenceRenderer renderer) {
134 protected void applyOutlineColor(StableXYDifferenceRenderer renderer) {
135 Color c = theme.parseLineColorField(); 134 Color c = theme.parseLineColorField();
136 renderer.setOutlinePaint(c); 135 renderer.setOutlinePaint(c);
137 } 136 }
138 137
139 protected void applyOutlineWidth(StableXYDifferenceRenderer renderer) {
140 // int size = theme.parseLineWidth();
141 // XXX: Why is this not set?
142 }
143
144 /** Inform renderer whether it should draw a label. */ 138 /** Inform renderer whether it should draw a label. */
145 protected void applyShowAreaLabel(StableXYDifferenceRenderer renderer) { 139 private void applyShowAreaLabel(StableXYDifferenceRenderer renderer) {
146 renderer.setLabelArea(theme.parseShowAreaLabel()); 140 renderer.setLabelArea(theme.parseShowAreaLabel());
147 } 141 }
148 142
149 protected void applyOutlineStyle(StableXYDifferenceRenderer renderer) { 143 private void applyOutlineStyle(StableXYDifferenceRenderer renderer) {
150 float[] dashes = theme.parseLineStyle(); 144 float[] dashes = theme.parseLineStyle();
151 int size = theme.parseLineWidth(); 145 int size = theme.parseLineWidth();
152 146
153 Stroke stroke = null; 147 Stroke stroke = null;
154 148
164 0.0f); 158 0.0f);
165 } 159 }
166 160
167 renderer.setOutlineStroke(stroke); 161 renderer.setOutlineStroke(stroke);
168 } 162 }
163
164 public boolean shouldCalculateRange() {
165 return theme.parseCalculateRange();
166 }
169 } 167 }
170 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 168 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org