diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-07-11 08:49:26 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-07-11 08:49:26 +0000 |
commit | 6f359d97e38932b0da23abb0940f32bf5380c0d8 (patch) | |
tree | bc6221534bf65aa6777245e7f555e943cdd2bbc6 /src/interfaces/element.php | |
parent | 663493a7224dc7869c6c63d770016f9fd8850e2a (diff) | |
download | zetacomponents-graph-6f359d97e38932b0da23abb0940f32bf5380c0d8.zip zetacomponents-graph-6f359d97e38932b0da23abb0940f32bf5380c0d8.tar.gz |
- Refactored ezcGraphRenderer
# Most test run again, but complete result is still errnous
Diffstat (limited to 'src/interfaces/element.php')
-rw-r--r-- | src/interfaces/element.php | 101 |
1 files changed, 9 insertions, 92 deletions
diff --git a/src/interfaces/element.php b/src/interfaces/element.php index 8aeb8bf..ebb06a4 100644 --- a/src/interfaces/element.php +++ b/src/interfaces/element.php @@ -235,105 +235,22 @@ abstract class ezcGraphChartElement extends ezcBaseOptions */ abstract public function render( ezcGraphRenderer $renderer, ezcGraphBoundings $boundings ); - protected function renderBorder( ezcGraphRenderer $renderer ) + protected function getTitleSize( ezcGraphBoundings $boundings, $direction = ezcGraph::HORIZONTAL ) { - // Apply margin - $this->boundings->x0 += $this->margin; - $this->boundings->y0 += $this->margin; - $this->boundings->x1 -= $this->margin; - $this->boundings->y1 -= $this->margin; - - if ( ( $this->border instanceof ezcGraphColor ) && - ( $this->borderWidth > 0 ) ) + if ( $direction === ezcGraph::HORIZONTAL ) { - // Default bordervalue to 1 - $this->borderWidth = max( 1, $this->borderWidth ); - - // Draw border - $renderer->drawRect( - $this->border, - new ezcGraphCoordinate( $this->boundings->x0, $this->boundings->y0 ), - $this->boundings->x1 - $this->boundings->x0, - $this->boundings->y1 - $this->boundings->y0, - $this->borderWidth + return min( + $this->maxTitleHeight, + ( $boundings->y1 - $boundings->y0 ) * $this->landscapeTitleSize ); - - // Reduce local boundings by borderWidth - $this->boundings->x0 += $this->borderWidth; - $this->boundings->y0 += $this->borderWidth; - $this->boundings->x1 -= $this->borderWidth; - $this->boundings->y1 -= $this->borderWidth; } - } - - protected function renderBackground( ezcGraphRenderer $renderer ) - { - if ( $this->background instanceof ezcGraphColor ) + else { - $renderer->drawBackground( - $this->background, - new ezcGraphCoordinate( $this->boundings->x0, $this->boundings->y0 ), - $this->boundings->x1 - $this->boundings->x0, - $this->boundings->y1 - $this->boundings->y0 + return min( + $this->maxTitleHeight, + ( $boundings->y1 - $boundings->y0 ) * $this->portraitTitleSize ); } - - // Apply padding - $this->boundings->x0 += $this->padding; - $this->boundings->y0 += $this->padding; - $this->boundings->x1 -= $this->padding; - $this->boundings->y1 -= $this->padding; - } - - protected function renderTitle( ezcGraphRenderer $renderer ) - { - if ( !empty( $this->title ) ) - { - switch ( $this->position ) - { - case ezcGraph::LEFT: - case ezcGraph::RIGHT: - case ezcGraph::CENTER: - $height = min( - $this->maxTitleHeight, - ( $this->boundings->y1 - $this->boundings->y0 ) * $this->portraitTitleSize - ); - $renderer->drawTextBox( - new ezcGraphCoordinate( $this->boundings->x0, $this->boundings->y0 ), - $this->title, - $this->boundings->x1 - $this->boundings->x0, - $height - ); - $this->boundings->y0 += $height; - break; - case ezcGraph::TOP: - $height = min( - $this->maxTitleHeight, - ( $this->boundings->y1 - $this->boundings->y0 ) * $this->landscapeTitleSize - ); - $renderer->drawTextBox( - new ezcGraphCoordinate( $this->boundings->x0, $this->boundings->y0 ), - $this->title, - $this->boundings->x1 - $this->boundings->x0, - $height - ); - $this->boundings->y0 += $height; - break; - case ezcGraph::BOTTOM: - $height = min( - $this->maxTitleHeight, - ( $this->boundings->y1 - $this->boundings->y0 ) * $this->landscapeTitleSize - ); - $renderer->drawTextBox( - new ezcGraphCoordinate( $this->boundings->x0, $this->boundings->y1 - $height ), - $this->title, - $this->boundings->x1 - $this->boundings->x0, - $height - ); - $this->boundings->y1 -= $height; - break; - } - } } } |