Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java @ 7241:32db4f89b65f
Add new option to diagram axes "logarithmic" that can be set to an evaluator
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 04 Oct 2013 17:02:01 +0200 |
parents | 2fd238b681a9 |
children | 7ea428c4aca0 |
comparison
equal
deleted
inserted
replaced
7240:bb4a6b0077cf | 7241:32db4f89b65f |
---|---|
354 plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND); | 354 plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND); |
355 } | 355 } |
356 | 356 |
357 | 357 |
358 protected NumberAxis createXAxis(String label) { | 358 protected NumberAxis createXAxis(String label) { |
359 return new NumberAxis(label); | 359 boolean logarithmic = (Boolean)diagramAttributes.getDomainAxis(). |
360 isLog().evaluate((D4EArtifact)getMaster(), context); | |
361 | |
362 if (logarithmic) { | |
363 return new LogarithmicAxis(label); | |
364 } else { | |
365 return new NumberAxis(label); | |
366 } | |
360 } | 367 } |
361 | 368 |
362 | 369 |
363 @Override | 370 @Override |
364 protected Series getSeriesOf(XYDataset dataset, int idx) { | 371 protected Series getSeriesOf(XYDataset dataset, int idx) { |
1088 } | 1095 } |
1089 | 1096 |
1090 return axisSections; | 1097 return axisSections; |
1091 } | 1098 } |
1092 | 1099 |
1100 protected String getYAxisLabel(int index) { | |
1101 return getYAxisLabel(diagramAttributes.getAxisName(index)); | |
1102 } | |
1103 | |
1093 /** | 1104 /** |
1094 * Returns the Y-Axis label of a chart at position <i>pos</i>. | 1105 * Returns the Y-Axis label of a chart at position <i>pos</i>. |
1095 * | 1106 * |
1096 * @return the Y-Axis label of a chart at position <i>0</i>. | 1107 * @return the Y-Axis label of a chart at position <i>0</i>. |
1097 */ | 1108 */ |
1155 } | 1166 } |
1156 } | 1167 } |
1157 | 1168 |
1158 @Override | 1169 @Override |
1159 protected NumberAxis createYAxis(int index) { | 1170 protected NumberAxis createYAxis(int index) { |
1160 NumberAxis axis = super.createYAxis(index); | 1171 NumberAxis axis; |
1172 boolean logarithmic = (Boolean)diagramAttributes.getAxesAttributes(). | |
1173 get(index).isLog().evaluate((D4EArtifact)getMaster(), context); | |
1174 | |
1175 if (logarithmic) { | |
1176 axis = new LogarithmicAxis(getYAxisLabel(index)); | |
1177 } else { | |
1178 axis = super.createYAxis(index); | |
1179 } | |
1161 | 1180 |
1162 if (diagramAttributes.getAxesAttributes().get(index).includeZero()) { | 1181 if (diagramAttributes.getAxesAttributes().get(index).includeZero()) { |
1163 axis.setAutoRangeIncludesZero(true); | 1182 axis.setAutoRangeIncludesZero(true); |
1164 } | 1183 } |
1165 return axis; | 1184 return axis; |