[Schmitzm-commits] r1971 - trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Thu Apr 26 12:08:15 CEST 2012
Author: mojays
Date: 2012-04-26 12:08:15 +0200 (Thu, 26 Apr 2012)
New Revision: 1971
Modified:
trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style/ChartAxisStyle.java
Log:
ChartAxisStyle extended with RangeType (only for NumberAxis)
Modified: trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style/ChartAxisStyle.java
===================================================================
--- trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style/ChartAxisStyle.java 2012-04-25 17:34:26 UTC (rev 1970)
+++ trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style/ChartAxisStyle.java 2012-04-26 10:08:15 UTC (rev 1971)
@@ -40,6 +40,7 @@
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.NumberAxis;
+import org.jfree.data.RangeType;
import de.schmitzm.i18n.Translation;
import de.schmitzm.lang.LangUtil;
@@ -69,7 +70,8 @@
protected String unitString = null;
/** Indicates whether the unit is visible in axis label (Default is {@code true}). */
protected boolean unitStringVisible = true;
-
+ /** Holds the range type for the axis. */
+ protected RangeType rangeType = null;
/**
* Creates a new style with default values (empty label, color black, angle 0).
*/
@@ -141,6 +143,7 @@
dest.setValuesFormat(getValuesFormat());
dest.setUnitString(getUnitString());
dest.setUnitVisible(isUnitVisible());
+ dest.setRangeType(getRangeType());
return dest;
}
@@ -271,7 +274,23 @@
this.valuesFormat = format;
}
- /**
+ /**
+ * Returns the type of the axis (positive/negative/full). Only
+ * applicable for {@link NumberAxis}.
+ */
+ public RangeType getRangeType() {
+ return rangeType;
+ }
+
+ /**
+ * Sets the type of the axis (positive/negative/full). Only
+ * applicable for {@link NumberAxis}.
+ */
+ public void setRangeType(RangeType rangeType) {
+ this.rangeType = rangeType;
+ }
+
+ /**
* Applies the style to a specific axis.<br>
* Note: Some style properties can only be applied to specific axis types.
*
@@ -368,6 +387,10 @@
// Give a warn if another angle should be applied to NumberAxis
LOGGER.warn("Only 0 or 90 degrees (horizontal/vertical) can be applied to values of "
+ LangUtil.getSimpleClassName(axis) + ": " + angle);
+
+ // Apply range type
+ if ( getRangeType() != null )
+ axis.setRangeType(getRangeType());
}
/**
More information about the Schmitzm-commits
mailing list