summaryrefslogtreecommitdiffstats
path: root/src/axis
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-07-24 11:55:24 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-07-24 11:55:24 +0000
commitff849eb9f302289b044b9f98eadc02cca4ed2130 (patch)
tree23c0f6d4e2ab84451d22b43ce98d9f0cc120ccee /src/axis
parent49ded86c90d1bfa6cc0b780b1ad00544f9d198fd (diff)
downloadzetacomponents-graph-ff849eb9f302289b044b9f98eadc02cca4ed2130.zip
zetacomponents-graph-ff849eb9f302289b044b9f98eadc02cca4ed2130.tar.gz
- Finished exact label renderer and render chart labals again
Diffstat (limited to 'src/axis')
-rw-r--r--src/axis/labeled.php7
-rw-r--r--src/axis/numeric.php141
2 files changed, 7 insertions, 141 deletions
diff --git a/src/axis/labeled.php b/src/axis/labeled.php
index 1d202ce..cf1277f 100644
--- a/src/axis/labeled.php
+++ b/src/axis/labeled.php
@@ -35,6 +35,13 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis
*/
const MAX_LABEL_COUNT = 10;
+ public function __construct( array $options = array() )
+ {
+ $this->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
+
+ parent::__construct( $options );
+ }
+
protected function increaseKeys( $array, $startKey )
{
foreach ( $array as $key => $value )
diff --git a/src/axis/numeric.php b/src/axis/numeric.php
index 023a9ea..8713f1c 100644
--- a/src/axis/numeric.php
+++ b/src/axis/numeric.php
@@ -317,147 +317,6 @@ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis
}
/**
- * Draw labels for an axis
- *
- * @param ezcGraphRenderer $renderer
- * @param ezcGraphCoordinate $start
- * @param ezcGraphCoordinate $end
- * @param ezcGraphBoundings $boundings
- * @return void
- */
- protected function drawLabels( ezcGraphRenderer $renderer, ezcGraphCoordinate $start, ezcGraphCoordinate $end, ezcGraphBoundings $boundings )
- {
- // Draw major steps
- $steps = $this->getMajorStepCount();
-
- // Calculate stepsize
- $xStepsize = ( $end->x - $start->x ) / $steps;
- $yStepsize = ( $end->y - $start->y ) / $steps;
-
- // Caluclate datafree chart border
- $xBorder = abs ( ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) );
- $yBorder = abs ( ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) );
-
- for ( $i = 0; $i <= $steps; ++$i )
- {
- // Draw label
- if ( $i < $steps )
- {
- $label = sprintf( $this->formatString, $this->getLabel( $i ) );
-
- switch ( $this->position )
- {
- case ezcGraph::LEFT:
- $renderer->drawTextBox(
- new ezcGraphCoordinate(
- (int) round( $start->x + $i * $xStepsize + $this->labelPadding ),
- (int) round( $start->y + $i * $yStepsize + $this->labelPadding )
- ),
- $label,
- (int) round( $xStepsize ) - $this->labelPadding,
- $yBorder - $this->labelPadding,
- ezcGraph::LEFT | ezcGraph::TOP
- );
- break;
- case ezcGraph::RIGHT:
- $renderer->drawTextBox(
- new ezcGraphCoordinate(
- (int) round( $start->x + $i * $xStepsize + $xStepsize ),
- (int) round( $start->y + $i * $yStepsize + $this->labelPadding )
- ),
- $label,
- (int) round( -$xStepsize ) - $this->labelPadding,
- $yBorder - $this->labelPadding,
- ezcGraph::RIGHT | ezcGraph::TOP
- );
- break;
- case ezcGraph::BOTTOM:
- $renderer->drawTextBox(
- new ezcGraphCoordinate(
- (int) round( $start->x + $i * $xStepsize - $xBorder ),
- (int) round( $start->y + $i * $yStepsize + $yStepsize )
- ),
- $label,
- $xBorder - $this->labelPadding,
- (int) round( -$yStepsize ) - $this->labelPadding,
- ezcGraph::RIGHT | ezcGraph::BOTTOM
- );
- break;
- case ezcGraph::TOP:
- $renderer->drawTextBox(
- new ezcGraphCoordinate(
- (int) round( $start->x + $i * $xStepsize - $xBorder ),
- (int) round( $start->y + $i * $yStepsize + $this->labelPadding )
- ),
- $label,
- $xBorder - $this->labelPadding,
- (int) round( $yStepsize ) - $this->labelPadding,
- ezcGraph::RIGHT | ezcGraph::TOP
- );
- break;
- }
- }
- else
- {
- $label = $this->getLabel( $i-- );
-
- switch ( $this->position )
- {
- case ezcGraph::LEFT:
- $renderer->drawTextBox(
- new ezcGraphCoordinate(
- (int) round( $start->x + $i * $xStepsize + $this->labelPadding ),
- (int) round( $start->y + $i * $yStepsize + $this->labelPadding )
- ),
- $label,
- (int) round( $xStepsize ) - $this->labelPadding,
- $yBorder - $this->labelPadding,
- ezcGraph::RIGHT | ezcGraph::TOP
- );
- break;
- case ezcGraph::RIGHT:
- $renderer->drawTextBox(
- new ezcGraphCoordinate(
- (int) round( $start->x + $i * $xStepsize + $xStepsize ),
- (int) round( $start->y + $i * $yStepsize + $this->labelPadding )
- ),
- $label,
- (int) round( -$xStepsize ) - $this->labelPadding,
- $yBorder - $this->labelPadding,
- ezcGraph::LEFT | ezcGraph::TOP
- );
- break;
- case ezcGraph::BOTTOM:
- $renderer->drawTextBox(
- new ezcGraphCoordinate(
- (int) round( $start->x + $i * $xStepsize - $xBorder ),
- (int) round( $start->y + $i * $yStepsize + $yStepsize + $this->labelPadding )
- ),
- $label,
- $xBorder - $this->labelPadding,
- (int) round( -$yStepsize ) - $this->labelPadding,
- ezcGraph::RIGHT | ezcGraph::TOP
- );
- break;
- case ezcGraph::TOP:
- $renderer->drawTextBox(
- new ezcGraphCoordinate(
- (int) round( $start->x + $i * $xStepsize - $xBorder ),
- (int) round( $start->y + $i * $yStepsize + $this->labelPadding )
- ),
- $label,
- $xBorder - $this->labelPadding,
- (int) round( $yStepsize ) - $this->labelPadding,
- ezcGraph::RIGHT | ezcGraph::BOTTOM
- );
- break;
- }
- ++$i;
- }
- }
- }
-
- /**
* Get label for a dedicated step on the axis
*
* @param integer $step Number of step
OpenPOWER on IntegriCloud