[Schmitzm-commits] r827 - trunk/src/schmitzm/jfree/chart/style
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed May 5 16:36:32 CEST 2010
Author: mojays
Date: 2010-05-05 16:36:31 +0200 (Wed, 05 May 2010)
New Revision: 827
Modified:
trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java
Log:
BugFix for axis labels: centered label alignment for not rotated labels
Modified: trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java 2010-05-05 13:29:49 UTC (rev 826)
+++ trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java 2010-05-05 14:36:31 UTC (rev 827)
@@ -36,9 +36,14 @@
import org.jfree.chart.axis.Axis;
import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPosition;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.NumberAxis;
+import org.jfree.text.TextBlockAnchor;
+import org.jfree.ui.RectangleAnchor;
+import org.jfree.ui.RectangleInsets;
+import org.jfree.ui.TextAnchor;
import schmitzm.lang.LangUtil;
import skrueger.i8n.Translation;
@@ -218,7 +223,7 @@
if (getLabelAngle() != null)
axis.setLabelAngle( getLabelAngle() );
axis.setVisible( isVisible() );
-
+
// Apply values format and angel according to the specific axis type
if (axis instanceof CategoryAxis)
applyToCategoryAxis((CategoryAxis)axis);
@@ -239,7 +244,13 @@
*/
protected void applyToCategoryAxis(CategoryAxis axis) {
// any angle can be applied
- axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions( getValuesAngleRadian() ));
+ // Angle > 0 -> create a rotated label with right alignment to the tick
+ // Angle = 0 -> STANDARD (centered alignment to the tick)
+ if ( getValuesAngleRadian() != 0.0 )
+ axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions( getValuesAngleRadian() ));
+ else
+ axis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
+
// format can not be applied to category axis values,
// so give a warn if style should apply one
if ( getValuesFormat() != null )
More information about the Schmitzm-commits
mailing list