[PATCH 4 of 5] Add more Inversion logic to the DiagramGenerator
Wald Commits
scm-commit at wald.intevation.org
Mon Sep 23 16:43:53 CEST 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1379944802 -7200
# Branch generator-refactoring
# Node ID eb3a2bc5d5912f2a3fbb121b1acd5df23ecec9d2
# Parent 5009b151f146e82276de004c78e3886fbac76f83
Add more Inversion logic to the DiagramGenerator
The diagram generator has the inverted / not inverted logic
so it should not be necessary to override some methods to
make it acutally work
diff -r 5009b151f146 -r eb3a2bc5d591 artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java Mon Sep 23 15:55:09 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java Mon Sep 23 16:00:02 2013 +0200
@@ -188,20 +188,22 @@
/**
* Return left most data points x value (on first axis).
- * Shortcut, especially to be overridden in (LS) charts where
- * axis could be inverted.
*/
protected double getLeftX() {
+ if (isInverted()) {
+ return (Double)getXBounds(0).getUpper();
+ }
return (Double)getXBounds(0).getLower();
}
/**
* Return right most data points x value (on first axis).
- * Shortcut, especially to be overridden in (LS) charts where
- * axis could be inverted.
*/
protected double getRightX() {
+ if (isInverted()) {
+ return (Double)getXBounds(0).getLower();
+ }
return (Double)getXBounds(0).getUpper();
}
@@ -833,7 +835,7 @@
/**
* Adjusts the axes of a plot. This method sets the <i>labelFont</i> of the
- * X axis.
+ * X axis and applies the inversion if isInverted.
*
* (Duplicate in TimeseriesChartGenerator)
*
@@ -854,6 +856,11 @@
xaxis.setLabelFont(labelFont);
xaxis.setTickLabelFont(labelFont);
+
+ if (isInverted()) {
+ logger.debug("X-Axis.setInverted(true)");
+ xaxis.setInverted(true);
+ }
}
More information about the Dive4elements-commits
mailing list