diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2009-05-28 14:33:36 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2009-05-28 14:33:36 +0000 |
commit | eb36eb0b72d1e0b01b46f4570c2f6e77ba723e63 (patch) | |
tree | 4cf08c70237495df7c39cd2a828515e2c59895d1 /src/renderer | |
parent | b24c848560db8723e04cffe2d04c0a6f7089181e (diff) | |
download | zetacomponents-graph-eb36eb0b72d1e0b01b46f4570c2f6e77ba723e63.zip zetacomponents-graph-eb36eb0b72d1e0b01b46f4570c2f6e77ba723e63.tar.gz |
- Fixed #14857: Highlight text misplaced in charts with multiple bar data
sets.
Diffstat (limited to 'src/renderer')
-rw-r--r-- | src/renderer/2d.php | 20 | ||||
-rw-r--r-- | src/renderer/3d.php | 6 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/renderer/2d.php b/src/renderer/2d.php index 64e5d9a..082f2c3 100644 --- a/src/renderer/2d.php +++ b/src/renderer/2d.php @@ -532,7 +532,7 @@ class ezcGraphRenderer2d $margin = $stepSize * $this->options->barMargin; $padding = $stepSize * $this->options->barPadding; $barWidth = ( $stepSize - $margin ) / $dataCount - $padding; - $offset = - $stepSize / 2 + $margin / 2 + ( $dataCount - $dataNumber -1 ) * ( $padding + $barWidth ) + $padding / 2; + $offset = - $stepSize / 2 + $margin / 2 + ( $dataCount - $dataNumber - 1 ) * ( $padding + $barWidth ) + $padding / 2; $barPointArray = array( new ezcGraphCoordinate( @@ -948,6 +948,8 @@ class ezcGraphRenderer2d * @param ezcGraphColor $markLines * @param int $xOffset * @param int $yOffset + * @param float $stepSize + * @param int $type * @return void */ public function drawDataHighlightText( @@ -962,13 +964,25 @@ class ezcGraphRenderer2d $size, ezcGraphColor $markLines = null, $xOffset = 0, - $yOffset = 0 ) + $yOffset = 0, + $stepSize = 0., + $type = ezcGraph::LINE ) { + // Bar specific calculations + if ( $type !== ezcGraph::LINE ) + { + $margin = $stepSize * $this->options->barMargin; + $padding = $stepSize * $this->options->barPadding; + $barWidth = ( $stepSize - $margin ) / $dataCount - $padding; + $offset = -( $dataNumber + ( $dataCount - 1 ) / -2 ) * ( $barWidth + $padding ); + } + $this->driver->options->font = $font; $width = $boundings->width / $dataCount; $dataPoint = new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->width ) * $end->x + $xOffset, + $boundings->x0 + ( $boundings->width ) * $end->x + $xOffset + + ( $type === ezcGraph::LINE ? 0 : $offset ), $boundings->y0 + ( $boundings->height ) * $end->y + $yOffset ); diff --git a/src/renderer/3d.php b/src/renderer/3d.php index 1978c2a..c730a6e 100644 --- a/src/renderer/3d.php +++ b/src/renderer/3d.php @@ -1552,6 +1552,8 @@ class ezcGraphRenderer3d * @param ezcGraphColor $markLines * @param int $xOffset * @param int $yOffset + * @param float $stepSize + * @param int $type * @return void */ public function drawDataHighlightText( @@ -1566,7 +1568,9 @@ class ezcGraphRenderer3d $size, ezcGraphColor $markLines = null, $xOffset = 0, - $yOffset = 0 ) + $yOffset = 0, + $stepSize = 0., + $type = ezcGraph::LINE ) { $this->driver->options->font = $font; $width = $this->dataBoundings->width / $dataCount; |