[Schmitzm-commits] r693 - trunk/src/schmitzm/jfree/chart/style
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Feb 11 21:13:27 CET 2010
Author: mojays
Date: 2010-02-11 21:13:26 +0100 (Thu, 11 Feb 2010)
New Revision: 693
Modified:
trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java
Log:
ChartAxisStyle: is/setUnitVisible(.) to hide the unit in axis label (e.g. in case of normalization)
Modified: trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java 2010-02-11 19:00:00 UTC (rev 692)
+++ trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java 2010-02-11 20:13:26 UTC (rev 693)
@@ -58,8 +58,10 @@
/** Holds the number format to display the axis values. */
protected Format valuesFormat = null;
/** Holds a String that reflects the values units */
- protected String unitString;
-
+ protected String unitString = null;
+ /** Indicates whether the unit is visible in axis label (Default is {@code true}). */
+ protected boolean unitStringVisible = true;
+
/**
* Creates a new style with default values (empty label, color black, angle 0).
*/
@@ -203,10 +205,9 @@
}
// If unit is set, add it to axis title
- // TODO: http://wald.intevation.org/tracker/index.php?func=detail&aid=1276&group_id=47&atid=293
String axisLabel = getLabel();
String unitString = getUnitString();
- if ( unitString != null && !"".equals(unitString.trim()) )
+ if ( isUnitVisible() && unitString != null && !"".equals(unitString.trim()) )
axisLabel += " ["+unitString.trim()+"]";
// Apply common attributes
@@ -307,4 +308,20 @@
public String getUnitString() {
return unitString;
}
+
+ /**
+ * Sets whether the unit string is visible in the axis label. In case
+ * of normalized data it may be useful to "deactivate" the unit without
+ * clearing the whole unit string.
+ */
+ public void setUnitVisible(boolean visible) {
+ this.unitStringVisible = visible;
+ }
+
+ /**
+ * Returns whether the unit string is visible in the axis label.
+ */
+ public boolean isUnitVisible() {
+ return this.unitStringVisible;
+ }
}
More information about the Schmitzm-commits
mailing list