summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-11-30 08:56:48 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-11-30 08:56:48 +0000
commit0df549c064a08505b195eaa20e13cdf41c2d37e5 (patch)
tree7a0e1d017a6d79bbcac21ff23a8fa477509c78d4
parent3a87182d74c72bdd0fd5c598b3be33301fa24423 (diff)
downloadzetacomponents-graph-0df549c064a08505b195eaa20e13cdf41c2d37e5.zip
zetacomponents-graph-0df549c064a08505b195eaa20e13cdf41c2d37e5.tar.gz
- Fixed: Bug #9656 (Threshold option spelled wrong)
-rw-r--r--ChangeLog2
-rw-r--r--src/charts/pie.php10
-rw-r--r--src/options/pie_chart.php16
-rw-r--r--tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithAbsoluteThreshold.svg (renamed from tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithAbsoluteTreshHold.svg)0
-rw-r--r--tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageThreshold.svg (renamed from tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageTreshHold.svg)0
-rw-r--r--tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageThresholdAndCustomSum.svg (renamed from tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageTreshHoldAndCustomSum.svg)0
-rw-r--r--tests/pie_test.php40
7 files changed, 35 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index b5112c2..8cf8af7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Renamed ezcGraphMingDriver to ezcGraphFlashDriver
+- Renamed pie chart options percentTreshHold to percentThreshold and
+ absoluteTreshHold to absoluteThreshold
- Fixed issue #9583: Data typecasting should only be done in axis
- Fixed issue #9586: No data rendered with string keys on date axis.
diff --git a/src/charts/pie.php b/src/charts/pie.php
index 85bf7a2..58c4ec7 100644
--- a/src/charts/pie.php
+++ b/src/charts/pie.php
@@ -126,9 +126,9 @@ class ezcGraphPieChart extends ezcGraphChart
*
* @return void
*/
- protected function applyTreshHold()
+ protected function applyThreshold()
{
- if ( $this->options->percentTreshHold || $this->options->absoluteTreshHold )
+ if ( $this->options->percentThreshold || $this->options->absoluteThreshold )
{
$dataset = $this->data->rewind();
@@ -145,8 +145,8 @@ class ezcGraphPieChart extends ezcGraphChart
$unset = array();
foreach ( $dataset as $label => $value )
{
- if ( ( $value <= $this->options->absoluteTreshHold ) ||
- ( ( $value / $sum ) <= $this->options->percentTreshHold ) )
+ if ( ( $value <= $this->options->absoluteThreshold ) ||
+ ( ( $value / $sum ) <= $this->options->percentThreshold ) )
{
if ( !isset( $dataset[$this->options->summarizeCaption] ) )
{
@@ -187,7 +187,7 @@ class ezcGraphPieChart extends ezcGraphChart
$this->driver->options->height = $height;
// Apply tresh hold
- $this->applyTreshHold();
+ $this->applyThreshold();
// Generate legend
$this->elements['legend']->generateFromDataSet( $this->data->rewind() );
diff --git a/src/options/pie_chart.php b/src/options/pie_chart.php
index 8e47be7..47f46f1 100644
--- a/src/options/pie_chart.php
+++ b/src/options/pie_chart.php
@@ -22,9 +22,9 @@
* @property float $sum
* Fixed sum of values. This should be used for incomplete pie
* charts.
- * @property float $percentTreshHold
+ * @property float $percentThreshold
* Values with a lower percentage value are aggregated.
- * @property float $absoluteTreshHold
+ * @property float $absoluteThreshold
* Values with a lower absolute value are aggregated.
* @property string $summarizeCaption
* Caption for values summarized because they are lower then the
@@ -47,8 +47,8 @@ class ezcGraphPieChartOptions extends ezcGraphChartOptions
$this->properties['labelCallback'] = null;
$this->properties['sum'] = false;
- $this->properties['percentTreshHold'] = .0;
- $this->properties['absoluteTreshHold'] = .0;
+ $this->properties['percentThreshold'] = .0;
+ $this->properties['absoluteThreshold'] = .0;
$this->properties['summarizeCaption'] = 'Misc';
parent::__construct( $options );
@@ -90,7 +90,7 @@ class ezcGraphPieChartOptions extends ezcGraphChartOptions
$this->properties['sum'] = (float) $propertyValue;
break;
- case 'percentTreshHold':
+ case 'percentThreshold':
if ( !is_numeric( $propertyValue ) ||
( $propertyValue < 0 ) ||
( $propertyValue > 1 ) )
@@ -98,16 +98,16 @@ class ezcGraphPieChartOptions extends ezcGraphChartOptions
throw new ezcBaseValueException( $propertyName, $propertyValue, '0 <= float <= 1' );
}
- $this->properties['percentTreshHold'] = (float) $propertyValue;
+ $this->properties['percentThreshold'] = (float) $propertyValue;
break;
- case 'absoluteTreshHold':
+ case 'absoluteThreshold':
if ( !is_numeric( $propertyValue ) ||
( $propertyValue <= 0 ) )
{
throw new ezcBaseValueException( $propertyName, $propertyValue, 'float > 0' );
}
- $this->properties['absoluteTreshHold'] = (float) $propertyValue;
+ $this->properties['absoluteThreshold'] = (float) $propertyValue;
break;
case 'summarizeCaption':
$this->properties['summarizeCaption'] = (string) $propertyValue;
diff --git a/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithAbsoluteTreshHold.svg b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithAbsoluteThreshold.svg
index 4258e66..4258e66 100644
--- a/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithAbsoluteTreshHold.svg
+++ b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithAbsoluteThreshold.svg
diff --git a/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageTreshHold.svg b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageThreshold.svg
index 48107ba..48107ba 100644
--- a/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageTreshHold.svg
+++ b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageThreshold.svg
diff --git a/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageTreshHoldAndCustomSum.svg b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageThresholdAndCustomSum.svg
index 8b9c9be..8b9c9be 100644
--- a/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageTreshHoldAndCustomSum.svg
+++ b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithPercentageThresholdAndCustomSum.svg
diff --git a/tests/pie_test.php b/tests/pie_test.php
index 5043ee3..1c54a71 100644
--- a/tests/pie_test.php
+++ b/tests/pie_test.php
@@ -138,39 +138,39 @@ class ezcGraphPieChartTest extends ezcImageTestCase
);
}
- public function testPieChartOptionsPropertyPercentTreshHold()
+ public function testPieChartOptionsPropertyPercentThreshold()
{
$options = new ezcGraphPieChartOptions();
$this->assertSame(
0.,
- $options->percentTreshHold,
- 'Wrong default value for property percentTreshHold in class ezcGraphPieChartOptions'
+ $options->percentThreshold,
+ 'Wrong default value for property percentThreshold in class ezcGraphPieChartOptions'
);
- $options->percentTreshHold = .5;
+ $options->percentThreshold = .5;
$this->assertSame(
.5,
- $options->percentTreshHold,
- 'Setting property value did not work for property percentTreshHold in class ezcGraphPieChartOptions'
+ $options->percentThreshold,
+ 'Setting property value did not work for property percentThreshold in class ezcGraphPieChartOptions'
);
}
- public function testPieChartOptionsPropertyAbsoluteTreshHold()
+ public function testPieChartOptionsPropertyAbsoluteThreshold()
{
$options = new ezcGraphPieChartOptions();
$this->assertSame(
0.,
- $options->absoluteTreshHold,
- 'Wrong default value for property absoluteTreshHold in class ezcGraphPieChartOptions'
+ $options->absoluteThreshold,
+ 'Wrong default value for property absoluteThreshold in class ezcGraphPieChartOptions'
);
- $options->absoluteTreshHold = 5;
+ $options->absoluteThreshold = 5;
$this->assertSame(
5.,
- $options->absoluteTreshHold,
- 'Setting property value did not work for property absoluteTreshHold in class ezcGraphPieChartOptions'
+ $options->absoluteThreshold,
+ 'Setting property value did not work for property absoluteThreshold in class ezcGraphPieChartOptions'
);
}
@@ -493,12 +493,12 @@ class ezcGraphPieChartTest extends ezcImageTestCase
$this->fail( 'Expected ezcBaseValueException.' );
}
- public function testRenderPieChartWithAbsoluteTreshHold()
+ public function testRenderPieChartWithAbsoluteThreshold()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
- $chart->options->absoluteTreshHold = 1;
+ $chart->options->absoluteThreshold = 1;
$chart->data['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 ) );
$chart->render( 500, 300, $filename );
@@ -510,7 +510,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase
try
{
- $chart->options->absoluteTreshHold = false;
+ $chart->options->absoluteThreshold = false;
}
catch( ezcBaseValueException $e )
{
@@ -520,12 +520,12 @@ class ezcGraphPieChartTest extends ezcImageTestCase
$this->fail( 'Expected ezcBaseValueException.' );
}
- public function testRenderPieChartWithPercentageTreshHold()
+ public function testRenderPieChartWithPercentageThreshold()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
- $chart->options->percentTreshHold = .05;
+ $chart->options->percentThreshold = .05;
$chart->options->summarizeCaption = 'Others';
$chart->data['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 ) );
@@ -538,7 +538,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase
try
{
- $chart->options->percentTreshHold = false;
+ $chart->options->percentThreshold = false;
}
catch( ezcBaseValueException $e )
{
@@ -548,13 +548,13 @@ class ezcGraphPieChartTest extends ezcImageTestCase
$this->fail( 'Expected ezcBaseValueException.' );
}
- public function testRenderPieChartWithPercentageTreshHoldAndCustomSum()
+ public function testRenderPieChartWithPercentageThresholdAndCustomSum()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
$chart->options->sum = 30;
- $chart->options->percentTreshHold = .05;
+ $chart->options->percentThreshold = .05;
$chart->options->summarizeCaption = 'Others';
$chart->data['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 ) );
OpenPOWER on IntegriCloud