Author: kn
Date: Wed Aug  1 15:12:16 2007
New Revision: 5797

Log:
- Fixed bug #11157: Wrong display of single record with labeled axis

Added:
    
trunk/Graph/tests/data/compare/ezcGraphChartTest_testBarChartWithSingleDataPoint.svg
   (with props)
    
trunk/Graph/tests/data/compare/ezcGraphChartTest_testBarChartWithSingleDataPointNumericAxis.svg
   (with props)
Modified:
    trunk/Graph/ChangeLog
    trunk/Graph/src/axis/labeled.php
    trunk/Graph/tests/chart_test.php

Modified: trunk/Graph/ChangeLog
==============================================================================
--- trunk/Graph/ChangeLog [iso-8859-1] (original)
+++ trunk/Graph/ChangeLog [iso-8859-1] Wed Aug  1 15:12:16 2007
@@ -5,6 +5,7 @@
   chart
 - Fixed bug #11207: Missing URL property for legend, or missing legend, may
   cause PHP notice
+- Fixed bug #11157: Wrong display of single record with labeled axis
 
 1.1 - Monday 02 July 2007
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Modified: trunk/Graph/src/axis/labeled.php
==============================================================================
--- trunk/Graph/src/axis/labeled.php [iso-8859-1] (original)
+++ trunk/Graph/src/axis/labeled.php [iso-8859-1] Wed Aug  1 15:12:16 2007
@@ -187,6 +187,18 @@
 
         if ( $labelCount === 0 )
         {
+            // Create single only step
+            $this->steps = array(
+                new ezcGraphAxisStep(
+                    0,
+                    1,
+                    reset( $this->labels ),
+                    array(),
+                    true,
+                    true
+                ),
+            );
+
             return true;
         }
 

Modified: trunk/Graph/tests/chart_test.php
==============================================================================
--- trunk/Graph/tests/chart_test.php [iso-8859-1] (original)
+++ trunk/Graph/tests/chart_test.php [iso-8859-1] Wed Aug  1 15:12:16 2007
@@ -155,8 +155,8 @@
     {
         try
         {
-            $pieChart = new ezcGraphPieChart();
-            $pieChart->render( 400, 200 );
+            $barChart = new ezcGraphBarChart();
+            $barChart->render( 400, 200 );
         }
         catch ( ezcGraphNoDataException $e )
         {
@@ -164,17 +164,51 @@
         }
     }
 
-    public function testCustomChartClass()
+    public function testBarChartWithSingleDataPoint()
     {
         $filename = $this->tempDir . __FUNCTION__ . '.svg';
 
-        $chart = new ezcCustomTestChart();
-        $chart->render( 400, 200, $filename );
+        $barChart = new ezcGraphBarChart();
+        $barChart->data['test'] = new ezcGraphArrayDataSet(
+            array( 23 )
+        );
+        $barChart->render( 400, 200, $filename );
 
         $this->compare(
             $filename,
             $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . 
'.svg'
         );
     }
+
+    public function testBarChartWithSingleDataPointNumericAxis()
+    {
+        $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+        $barChart = new ezcGraphBarChart();
+        $barChart->xAxis = new ezcGraphChartElementNumericAxis();
+
+        $barChart->data['test'] = new ezcGraphArrayDataSet(
+            array( 23 )
+        );
+        $barChart->render( 400, 200, $filename );
+
+        $this->compare(
+            $filename,
+            $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . 
'.svg'
+        );
+    }
+
+    public function testCustomChartClass()
+    {
+        $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+        $chart = new ezcCustomTestChart();
+        $chart->render( 400, 200, $filename );
+
+        $this->compare(
+            $filename,
+            $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . 
'.svg'
+        );
+    }
 }
 ?>

Added: 
trunk/Graph/tests/data/compare/ezcGraphChartTest_testBarChartWithSingleDataPoint.svg
==============================================================================
Binary file - no diff available.

Propchange: 
trunk/Graph/tests/data/compare/ezcGraphChartTest_testBarChartWithSingleDataPoint.svg
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
trunk/Graph/tests/data/compare/ezcGraphChartTest_testBarChartWithSingleDataPoint.svg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
trunk/Graph/tests/data/compare/ezcGraphChartTest_testBarChartWithSingleDataPointNumericAxis.svg
==============================================================================
Binary file - no diff available.

Propchange: 
trunk/Graph/tests/data/compare/ezcGraphChartTest_testBarChartWithSingleDataPointNumericAxis.svg
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
trunk/Graph/tests/data/compare/ezcGraphChartTest_testBarChartWithSingleDataPointNumericAxis.svg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to