comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java @ 8889:f87f435df856

Allow to configure lower and upper margin of a chart axis
author gernotbelger
date Wed, 14 Feb 2018 18:45:01 +0100
parents e5f688820951
children 87a242425467
comparison
equal deleted inserted replaced
8888:caa52aec08c0 8889:f87f435df856
34 import org.dive4elements.artifactdatabase.state.Facet; 34 import org.dive4elements.artifactdatabase.state.Facet;
35 35
36 import org.dive4elements.artifacts.CallContext; 36 import org.dive4elements.artifacts.CallContext;
37 37
38 import org.dive4elements.river.artifacts.D4EArtifact; 38 import org.dive4elements.river.artifacts.D4EArtifact;
39 39 import org.dive4elements.river.exports.DiagramAttributes.AxisAttributes;
40 import org.dive4elements.river.exports.process.Processor; 40 import org.dive4elements.river.exports.process.Processor;
41 41
42 import org.dive4elements.river.jfree.RiverAnnotation; 42 import org.dive4elements.river.jfree.RiverAnnotation;
43 import org.dive4elements.river.jfree.AnnotationHelper; 43 import org.dive4elements.river.jfree.AnnotationHelper;
44 import org.dive4elements.river.jfree.AxisDataset; 44 import org.dive4elements.river.jfree.AxisDataset;
1268 } 1268 }
1269 } 1269 }
1270 1270
1271 @Override 1271 @Override
1272 protected NumberAxis createYAxis(int index) { 1272 protected NumberAxis createYAxis(int index) {
1273
1274 final AxisAttributes axisAttributes = diagramAttributes.getAxesAttributes().get(index);
1275
1276 boolean logarithmic = (Boolean)axisAttributes.isLog().evaluate((D4EArtifact)getMaster(), context);
1277
1273 NumberAxis axis; 1278 NumberAxis axis;
1274 boolean logarithmic = (Boolean)diagramAttributes.getAxesAttributes().
1275 get(index).isLog().evaluate((D4EArtifact)getMaster(), context);
1276
1277 if (logarithmic) { 1279 if (logarithmic) {
1278 axis = new LogarithmicAxis(getYAxisLabel(index)); 1280 axis = new LogarithmicAxis(getYAxisLabel(index));
1279 } else { 1281 } else {
1280 axis = super.createYAxis(index); 1282 axis = super.createYAxis(index);
1281 } 1283 }
1282 1284
1283 if (diagramAttributes.getAxesAttributes().get(index).includeZero()) { 1285 if (axisAttributes.includeZero()) {
1284 axis.setAutoRangeIncludesZero(true); 1286 axis.setAutoRangeIncludesZero(true);
1285 } 1287 }
1288
1289 axis.setLowerMargin(axisAttributes.getLowerMargin());
1290 axis.setUpperMargin(axisAttributes.getUpperMargin());
1291
1286 return axis; 1292 return axis;
1287 } 1293 }
1288 1294
1289 /** 1295 /**
1290 * @return the subtitle parts 1296 * @return the subtitle parts

http://dive4elements.wald.intevation.org