comparison flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java @ 1684:bdb05dc9b763

Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained. flys-artifacts/trunk@2902 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 07 Oct 2011 10:51:09 +0000
parents f7761914f745
children 6d9184c745dd
comparison
equal deleted inserted replaced
1683:acb4d20b130e 1684:bdb05dc9b763
117 plot.setRangeAxis(1, qAxis); 117 plot.setRangeAxis(1, qAxis);
118 } 118 }
119 119
120 120
121 @Override 121 @Override
122 public void doOut(Artifact artifact, Facet facet, Document attr) { 122 public void doOut(
123 Artifact artifact,
124 Facet facet,
125 Document attr,
126 boolean visible
127 ) {
123 String name = facet != null ? facet.getName() : null; 128 String name = facet != null ? facet.getName() : null;
124 129
125 logger.debug("DurationCurveGenerator.doOut: " + name); 130 logger.debug("DurationCurveGenerator.doOut: " + name);
126 131
127 if (name == null || name.length() == 0) { 132 if (name == null || name.length() == 0) {
131 136
132 FLYSArtifact flys = (FLYSArtifact) artifact; 137 FLYSArtifact flys = (FLYSArtifact) artifact;
133 Facet f = flys.getNativeFacet(facet); 138 Facet f = flys.getNativeFacet(facet);
134 139
135 if (name.equals(DURATION_W)) { 140 if (name.equals(DURATION_W)) {
136 doWOut((WQDay) f.getData(artifact, context), attr); 141 doWOut((WQDay) f.getData(artifact, context), attr, visible);
137 } 142 }
138 else if (name.equals(DURATION_Q)) { 143 else if (name.equals(DURATION_Q)) {
139 doQOut((WQDay) f.getData(artifact, context), attr); 144 doQOut((WQDay) f.getData(artifact, context), attr, visible);
140 } 145 }
141 else { 146 else {
142 logger.warn("Unknown facet name: " + name); 147 logger.warn("Unknown facet name: " + name);
143 return; 148 return;
144 } 149 }
149 * Creates the series for a duration curve's W facet. 154 * Creates the series for a duration curve's W facet.
150 * 155 *
151 * @param wqdays The WQDay store that contains the Ws. 156 * @param wqdays The WQDay store that contains the Ws.
152 * @param theme 157 * @param theme
153 */ 158 */
154 protected void doWOut(WQDay wqdays, Document theme) { 159 protected void doWOut(WQDay wqdays, Document theme, boolean visible) {
155 logger.debug("DurationCurveGenerator.doWOut"); 160 logger.debug("DurationCurveGenerator.doWOut");
156 161
157 // TODO find the correct series name 162 // TODO find the correct series name
158 XYSeries series = new StyledXYSeries( 163 XYSeries series = new StyledXYSeries(
159 getSeriesName(getRiverName(), DURATION_W), theme); 164 getSeriesName(getRiverName(), DURATION_W), theme);
164 double w = wqdays.getW(i); 169 double w = wqdays.getW(i);
165 170
166 series.add((double) day, w); 171 series.add((double) day, w);
167 } 172 }
168 173
169 addFirstAxisSeries(series); 174 addFirstAxisSeries(series, visible);
170 } 175 }
171 176
172 177
173 /** 178 /**
174 * Creates the series for a duration curve's Q facet. 179 * Creates the series for a duration curve's Q facet.
175 * 180 *
176 * @param wqdays The WQDay store that contains the Qs. 181 * @param wqdays The WQDay store that contains the Qs.
177 * @param theme 182 * @param theme
178 */ 183 */
179 protected void doQOut(WQDay wqdays, Document theme) { 184 protected void doQOut(WQDay wqdays, Document theme, boolean visible) {
180 logger.debug("DurationCurveGenerator.doQOut"); 185 logger.debug("DurationCurveGenerator.doQOut");
181 186
182 // TODO find the correct series name 187 // TODO find the correct series name
183 XYSeries series = new StyledXYSeries( 188 XYSeries series = new StyledXYSeries(
184 getSeriesName(getRiverName(), DURATION_Q), theme); 189 getSeriesName(getRiverName(), DURATION_Q), theme);
189 double q = wqdays.getQ(i); 194 double q = wqdays.getQ(i);
190 195
191 series.add((double) day, q); 196 series.add((double) day, q);
192 } 197 }
193 198
194 addSecondAxisSeries(series); 199 addSecondAxisSeries(series, visible);
195 } 200 }
196 201
197 202
198 protected String getSeriesName(String river, String type) { 203 protected String getSeriesName(String river, String type) {
199 Object[] args = new Object[] { river }; 204 Object[] args = new Object[] { river };

http://dive4elements.wald.intevation.org