Author: Kore Nordmann
Date: 2006-11-13 11:42:28 +0100 (Mon, 13 Nov 2006)
New Revision: 3910

Log:
- Fixed: Bug #9403 (Element references do not work with Gleam in SVG)

Modified:
   trunk/Graph/src/renderer/2d.php
   trunk/Graph/src/renderer/3d.php
   trunk/Graph/tests/image_map_test.php

Modified: trunk/Graph/src/renderer/2d.php
===================================================================
--- trunk/Graph/src/renderer/2d.php     2006-11-13 10:41:53 UTC (rev 3909)
+++ trunk/Graph/src/renderer/2d.php     2006-11-13 10:42:28 UTC (rev 3910)
@@ -250,14 +250,16 @@
                     $this->options->pieChartGleamColor->transparent( 
$this->options->pieChartGleam )
                 );
 
-                $this->driver->drawCircleSector(
-                    $circleSector['center'],
-                    $circleSector['width'] - 
$this->options->pieChartGleamBorder * 2,
-                    $circleSector['height'] - 
$this->options->pieChartGleamBorder * 2,
-                    $circleSector['start'],
-                    $circleSector['end'],
-                    $gradient,
-                    true
+                $this->addElementReference( $circleSector['context'],
+                    $this->driver->drawCircleSector(
+                        $circleSector['center'],
+                        $circleSector['width'] - 
$this->options->pieChartGleamBorder * 2,
+                        $circleSector['height'] - 
$this->options->pieChartGleamBorder * 2,
+                        $circleSector['start'],
+                        $circleSector['end'],
+                        $gradient,
+                        true
+                    )
                 );
 
                 $gradient = new ezcGraphLinearGradient(
@@ -273,14 +275,16 @@
                     $this->options->pieChartGleamColor->transparent( 
$this->options->pieChartGleam )
                 );
 
-                $this->driver->drawCircleSector(
-                    $circleSector['center'],
-                    $circleSector['width'] - 
$this->options->pieChartGleamBorder * 2,
-                    $circleSector['height'] - 
$this->options->pieChartGleamBorder * 2,
-                    $circleSector['start'],
-                    $circleSector['end'],
-                    $gradient,
-                    true
+                $this->addElementReference( $circleSector['context'],
+                    $this->driver->drawCircleSector(
+                        $circleSector['center'],
+                        $circleSector['width'] - 
$this->options->pieChartGleamBorder * 2,
+                        $circleSector['height'] - 
$this->options->pieChartGleamBorder * 2,
+                        $circleSector['start'],
+                        $circleSector['end'],
+                        $gradient,
+                        true
+                    )
                 );
             }
         }

Modified: trunk/Graph/src/renderer/3d.php
===================================================================
--- trunk/Graph/src/renderer/3d.php     2006-11-13 10:41:53 UTC (rev 3909)
+++ trunk/Graph/src/renderer/3d.php     2006-11-13 10:42:28 UTC (rev 3910)
@@ -636,14 +636,16 @@
                     $this->options->pieChartGleamColor->transparent( 
$this->options->pieChartGleam )
                 );
 
-                $this->driver->drawCircleSector(
-                    $circleSector['center'],
-                    $circleSector['width'] - 
$this->options->pieChartGleamBorder * 2,
-                    $circleSector['height'] - 
$this->options->pieChartGleamBorder * 2 * $this->options->pieChartRotation,
-                    $circleSector['start'],
-                    $circleSector['end'],
-                    $gradient,
-                    true
+                $this->addElementReference( $circleSector['context'],
+                    $this->driver->drawCircleSector(
+                        $circleSector['center'],
+                        $circleSector['width'] - 
$this->options->pieChartGleamBorder * 2,
+                        $circleSector['height'] - 
$this->options->pieChartGleamBorder * 2 * $this->options->pieChartRotation,
+                        $circleSector['start'],
+                        $circleSector['end'],
+                        $gradient,
+                        true
+                    )
                 );
             }
 

Modified: trunk/Graph/tests/image_map_test.php
===================================================================
--- trunk/Graph/tests/image_map_test.php        2006-11-13 10:41:53 UTC (rev 
3909)
+++ trunk/Graph/tests/image_map_test.php        2006-11-13 10:42:28 UTC (rev 
3910)
@@ -214,7 +214,6 @@
         $chart->palette = new ezcGraphPaletteBlack();
         $chart->renderer = new ezcGraphRenderer3d();
 
-        $chart = new ezcGraphPieChart();
         $chart->data['sample'] = new ezcGraphArrayDataSet( array(
             'Mozilla' => 4375,
             'IE' => 345,
@@ -231,8 +230,43 @@
         $this->assertSame( 1, count( $reference['data'] ), 'One dataset 
expected.' );
         $this->assertSame( 5, count( $reference['data']['sample'] ), '5 
datapoints expected.' );
         $this->assertSame( 2, count( $reference['data']['sample']['Mozilla'] 
), '2 elements for datapoint expexted' );
+        $this->assertSame( 'ezcGraphCircleSector_40', 
$reference['data']['sample']['Mozilla'][0], 'ezcGraphCircleSector expected.' );
+        $this->assertSame( 'ezcGraphTextBox_61', 
$reference['data']['sample']['Mozilla'][1], 'ezcGraphTextBox expected.' );
+
+        // Check legend references
+        $this->assertSame( 5, count( $reference['legend'] ), '5 legend items 
expected.' );
+        $this->assertSame( 2, count( $reference['legend']['IE'] ), '2 elements 
for legend item expected.' );
+        $this->assertSame( 'ezcGraphCircle_6', 
$reference['legend']['IE']['symbol'], 'ezcGraphCircle expected as legend 
symbol.' );
+        $this->assertSame( 'ezcGraphTextBox_7', 
$reference['legend']['IE']['text'], 'ezcGraphTextBox expected for legend text.' 
);
+    }
+
+    public function testReturnFrom2dSvgPieChartWithGleam()
+    {
+        $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+        $chart = new ezcGraphPieChart();
+        $chart->renderer->options->pieChartGleam = .5;
+
+        $chart->data['sample'] = new ezcGraphArrayDataSet( array(
+            'Mozilla' => 4375,
+            'IE' => 345,
+            'Opera' => 1204,
+            'wget' => 231,
+            'Safari' => 987,
+        ) );
+
+        $chart->render( 500, 200, $filename );
+
+        $reference = $chart->renderer->getElementReferences();
+
+        // Check data references
+        $this->assertSame( 1, count( $reference['data'] ), 'One dataset 
expected.' );
+        $this->assertSame( 5, count( $reference['data']['sample'] ), '5 
datapoints expected.' );
+        $this->assertSame( 4, count( $reference['data']['sample']['Mozilla'] 
), '2 elements for datapoint expexted' );
         $this->assertSame( 'ezcGraphCircleSector_13', 
$reference['data']['sample']['Mozilla'][0], 'ezcGraphCircleSector expected.' );
-        $this->assertSame( 'ezcGraphTextBox_34', 
$reference['data']['sample']['Mozilla'][1], 'ezcGraphTextBox expected.' );
+        $this->assertSame( 'ezcGraphCircleSector_15', 
$reference['data']['sample']['Mozilla'][1], 'ezcGraphCircleSector expected.' );
+        $this->assertSame( 'ezcGraphCircleSector_16', 
$reference['data']['sample']['Mozilla'][2], 'ezcGraphCircleSector expected.' );
+        $this->assertSame( 'ezcGraphTextBox_44', 
$reference['data']['sample']['Mozilla'][3], 'ezcGraphTextBox expected.' );
 
         // Check legend references
         $this->assertSame( 5, count( $reference['legend'] ), '5 legend items 
expected.' );
@@ -240,6 +274,41 @@
         $this->assertSame( 'ezcGraphPolygon_5', 
$reference['legend']['IE']['symbol'], 'ezcGraphPolygon expected as legend 
symbol.' );
         $this->assertSame( 'ezcGraphTextBox_6', 
$reference['legend']['IE']['text'], 'ezcGraphTextBox expected for legend text.' 
);
     }
+
+    public function testReturnFrom3dSvgPieChartWithGleam()
+    {
+        $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+        $chart = new ezcGraphPieChart();
+        $chart->renderer = new ezcGraphRenderer3d();
+        $chart->renderer->options->pieChartGleam = .5;
+
+        $chart->data['sample'] = new ezcGraphArrayDataSet( array(
+            'Mozilla' => 4375,
+            'IE' => 345,
+            'Opera' => 1204,
+            'wget' => 231,
+            'Safari' => 987,
+        ) );
+
+        $chart->render( 500, 200, $filename );
+
+        $reference = $chart->renderer->getElementReferences();
+
+        // Check data references
+        $this->assertSame( 1, count( $reference['data'] ), 'One dataset 
expected.' );
+        $this->assertSame( 5, count( $reference['data']['sample'] ), '5 
datapoints expected.' );
+        $this->assertSame( 3, count( $reference['data']['sample']['Mozilla'] 
), '2 elements for datapoint expexted' );
+        $this->assertSame( 'ezcGraphCircleSector_39', 
$reference['data']['sample']['Mozilla'][0], 'ezcGraphCircleSector expected.' );
+        $this->assertSame( 'ezcGraphCircleSector_40', 
$reference['data']['sample']['Mozilla'][1], 'ezcGraphCircleSector expected.' );
+        $this->assertSame( 'ezcGraphTextBox_71', 
$reference['data']['sample']['Mozilla'][2], 'ezcGraphTextBox expected.' );
+
+        // Check legend references
+        $this->assertSame( 5, count( $reference['legend'] ), '5 legend items 
expected.' );
+        $this->assertSame( 2, count( $reference['legend']['IE'] ), '2 elements 
for legend item expected.' );
+        $this->assertSame( 'ezcGraphPolygon_5', 
$reference['legend']['IE']['symbol'], 'ezcGraphPolygon expected as legend 
symbol.' );
+        $this->assertSame( 'ezcGraphTextBox_6', 
$reference['legend']['IE']['text'], 'ezcGraphTextBox expected for legend text.' 
);
+    }
 }
 
 ?>

-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to