From fae953847fad0282cfe50b75bd7a379d1754ce70 Mon Sep 17 00:00:00 2001 From: Kore Nordmann Date: Mon, 23 Oct 2006 17:54:23 +0000 Subject: - Fixed sorting order of 2d bar chart elements. --- src/renderer/2d.php | 2 +- .../ezcGraphRenderer2dTest_testRenderFilledLineBarChart.svg | 2 +- tests/renderer_2d_test.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/renderer/2d.php b/src/renderer/2d.php index 03be22e..8e08f88 100644 --- a/src/renderer/2d.php +++ b/src/renderer/2d.php @@ -478,7 +478,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $margin = $stepSize * $this->options->barMargin; $padding = $stepSize * $this->options->barPadding; $barWidth = ( $stepSize - $margin ) / $dataCount - $padding; - $offset = - $stepSize / 2 + $margin / 2 + $dataNumber * ( $padding + $barWidth ) + $padding / 2; + $offset = - $stepSize / 2 + $margin / 2 + ( $dataCount - $dataNumber -1 ) * ( $padding + $barWidth ) + $padding / 2; $barPointArray = array( new ezcGraphCoordinate( diff --git a/tests/data/compare/ezcGraphRenderer2dTest_testRenderFilledLineBarChart.svg b/tests/data/compare/ezcGraphRenderer2dTest_testRenderFilledLineBarChart.svg index 07351d9..b96b148 100644 --- a/tests/data/compare/ezcGraphRenderer2dTest_testRenderFilledLineBarChart.svg +++ b/tests/data/compare/ezcGraphRenderer2dTest_testRenderFilledLineBarChart.svg @@ -1,2 +1,2 @@ -Line 0Line 1Line 2sample 1sample 2sample 3sample 4sample 50250500750 +Line 0Line 1Line 2sample 1sample 2sample 3sample 4sample 50250500750 diff --git a/tests/renderer_2d_test.php b/tests/renderer_2d_test.php index 8b5bfad..8feedeb 100644 --- a/tests/renderer_2d_test.php +++ b/tests/renderer_2d_test.php @@ -370,10 +370,10 @@ class ezcGraphRenderer2dTest extends ezcTestCase ->method( 'drawPolygon' ) ->with( $this->equalTo( array( - new ezcGraphCoordinate( 202.5, 0. ), - new ezcGraphCoordinate( 202.5, 40. ), - new ezcGraphCoordinate( 242.5, 40. ), - new ezcGraphCoordinate( 242.5, 0. ), + new ezcGraphCoordinate( 157.5, 0. ), + new ezcGraphCoordinate( 157.5, 40. ), + new ezcGraphCoordinate( 197.5, 40. ), + new ezcGraphCoordinate( 197.5, 0. ), ), 1. ), $this->equalTo( ezcGraphColor::fromHex( '#FF0000' ) ), $this->equalTo( 1 ) -- cgit v1.1