#013634: Make Offset of ezcGraphAxisRotatedLabelRenderer optional

Description:

When using the ezcGraphAxisRotatedLabelRenderer an angle such 45, an offset is calculated and Data as well as the labels will be moved to the right to accommodate the rotated label size. This however causes an ugly (large) space between the Y Axis line and the start of the Data.

If the Offset is disabled, the Label would enter into the Y Axis Space. I think however that this is acceptable (as well as desirable) in certain situations, hence i request that the offset calculation be made optional.

The following code modification of the axis_label_rotated.php would add an additional property called 'allowOffset' that would allow the above to be controlled:


renderer/axis_label_rotated.php
===================================================================
renderer/axis_label_rotated.php    (base)
renderer/axis_label_rotated.php    (suggestion)
@@ -70,6 +70,7 @@
     {
         parent::__construct( $options );
         $this->properties['angle'] = null;
+        $this->properties['allowOffset'] = true;
     }
 
     /**
@@ -97,6 +98,9 @@
                 $reducement = (int) ( $propertyValue - $propertyValue % 360 );
                 $this->properties['angle'] = (float) $propertyValue - $reducement;
                 break;
+            case 'allowOffset':
+                $this->properties['allowOffset'] = ($propertyValue?true:false);
+                break;
             default:
                 return parent::__set( $propertyName, $propertyValue );
         }
@@ -193,10 +197,13 @@
             $degTextAngle += 360.;
         }
 
-        $this->offset =
-            ( $this->angle < 0 ? -1 : 1 ) *
-            ( $axis->position & ( ezcGraph::TOP | ezcGraph::LEFT ) ? 1 : -1 ) *
-            ( 1 - cos( deg2rad( $this->angle * 2 ) ) );
+        if($this->properties['allowOffset'])
+        {
+            $this->offset =
+                ( $this->angle < 0 ? -1 : 1 ) *
+                ( $axis->position & ( ezcGraph::TOP | ezcGraph::LEFT ) ? 1 : -1 ) *
+                ( 1 - cos( deg2rad( $this->angle * 2 ) ) );
+        }
 
         $axisSpaceFactor = abs(
             ( $this->direction->x == 0 ? 0 :

Environment:

Operating System: All
PHP Version: All
Database and version:
Browser (and version): All


Steps to Reproduce:

Create a Line Graph with a RotatedLabelRenderer, set the Angle to 45. A Large Gap is created between the y Axis Line and the start of the first data point.


- Attachments

No attachments for this issue.


- Comments

Implemented in revision #9765.

#259857 by Kore Nordmann on January 20th, 2009 [Permanent Link]

- History
Properties
Type Enhancement
Priority Medium
Component Components » Graph
Affects 2008.1RC1 - eZ components 2008.1RC1
Fix Version 2009.1alpha1 - eZ components 2009.1alpha1
Reporter Raven 737
Responsible Kore Nordmann
Status 0 Closed
Resolution Implemented
Created September 19th, 2008
Updated January 20th, 2009
Resolved January 20th, 2009
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels