diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-11-30 10:28:24 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-11-30 10:28:24 +0000 |
commit | 52e8f6cd727f0fd0bbd735d2c72fe7cffff8f565 (patch) | |
tree | 3905d60edc997d3e17a4f1b8bfcdca5d86ad1b89 | |
parent | 7854dda880c76ae04d9bca5a5240271f6971c1bd (diff) | |
download | zetacomponents-graph-52e8f6cd727f0fd0bbd735d2c72fe7cffff8f565.zip zetacomponents-graph-52e8f6cd727f0fd0bbd735d2c72fe7cffff8f565.tar.gz |
- Fixed: Bug #9545 (pie chart tresh hold does not work if agregated data stays below tresh hold)
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/charts/pie.php | 5 | ||||
-rw-r--r-- | tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithLowAbsoluteThreshold.svg | 2 | ||||
-rw-r--r-- | tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithLowPercentageThreshold.svg | 2 | ||||
-rw-r--r-- | tests/pie_test.php | 55 |
5 files changed, 66 insertions, 0 deletions
@@ -12,6 +12,8 @@ - Fixed issue #9568: Devision by zero warning - Fixed issue #9655: pieChartOffset and highlight do not work together in 2d renderer +- Fixed issue #9545: pie chart tresh hold does not work if agregated data + stays below tresh hold 1.0beta2 - Monday 20 November 2006 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/charts/pie.php b/src/charts/pie.php index 2201ac7..eb7539c 100644 --- a/src/charts/pie.php +++ b/src/charts/pie.php @@ -145,6 +145,11 @@ class ezcGraphPieChart extends ezcGraphChart $unset = array(); foreach ( $dataset as $label => $value ) { + if ( $label === $this->options->summarizeCaption ) + { + continue; + } + if ( ( $value <= $this->options->absoluteThreshold ) || ( ( $value / $sum ) <= $this->options->percentThreshold ) ) { diff --git a/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithLowAbsoluteThreshold.svg b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithLowAbsoluteThreshold.svg new file mode 100644 index 0000000..fdf0d48 --- /dev/null +++ b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithLowAbsoluteThreshold.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="500" height="300" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 0.0000,300.0000 L 0.0000,0.0000 L 500.0000,0.0000 L 500.0000,300.0000 L 0.0000,300.0000 z " style="fill: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_1"/><path d=" M 0.0000,300.0000 L 0.0000,0.0000 L 100.0000,0.0000 L 100.0000,300.0000 L 0.0000,300.0000 z " style="fill: #000000; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_2"/><path d=" M 2.0000,16.0000 L 2.0000,2.0000 L 16.0000,2.0000 L 16.0000,16.0000 L 2.0000,16.0000 z " style="fill: #4e9a06; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_3"/><path d=" M 2.0000,34.0000 L 2.0000,20.0000 L 16.0000,20.0000 L 16.0000,34.0000 L 2.0000,34.0000 z " style="fill: #cc0000; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_5"/><path d=" M 2.0000,52.0000 L 2.0000,38.0000 L 16.0000,38.0000 L 16.0000,52.0000 L 2.0000,52.0000 z " style="fill: #edd400; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_7"/><path d=" M 2.0000,70.0000 L 2.0000,56.0000 L 16.0000,56.0000 L 16.0000,70.0000 L 2.0000,70.0000 z " style="fill: #75505b; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_9"/><path d=" M 2.0000,88.0000 L 2.0000,74.0000 L 16.0000,74.0000 L 16.0000,88.0000 L 2.0000,88.0000 z " style="fill: #3465a4; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_11"/><path d="M 300.00,150.00 L 390.00,150.00 A 90.00,90.00 0 1,1 215.43,119.22 z" style="fill: #4e9a06; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_13"/><path d="M 300.00,150.00 L 390.00,150.00 A 90.00,90.00 0 1,1 215.43,119.22 z" style="fill: none; stroke: #274d03; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_14"/><path d="M 300.00,150.00 L 215.43,119.22 A 90.00,90.00 0 0,1 284.37,61.37 z" style="fill: #cc0000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_15"/><path d="M 300.00,150.00 L 215.43,119.22 A 90.00,90.00 0 0,1 284.37,61.37 z" style="fill: none; stroke: #660000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_16"/><path d="M 300.00,150.00 L 284.37,61.37 A 90.00,90.00 0 0,1 345.00,72.06 z" style="fill: #edd400; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_17"/><path d="M 300.00,150.00 L 284.37,61.37 A 90.00,90.00 0 0,1 345.00,72.06 z" style="fill: none; stroke: #776a00; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_18"/><path d="M 300.00,150.00 L 345.00,72.06 A 90.00,90.00 0 0,1 384.57,119.22 z" style="fill: #75505b; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_19"/><path d="M 300.00,150.00 L 345.00,72.06 A 90.00,90.00 0 0,1 384.57,119.22 z" style="fill: none; stroke: #3b282e; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_20"/><path d="M 300.00,150.00 L 384.57,119.22 A 90.00,90.00 0 0,1 390.00,150.00 z" style="fill: #3465a4; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_21"/><path d="M 300.00,150.00 L 384.57,119.22 A 90.00,90.00 0 0,1 390.00,150.00 z" style="fill: none; stroke: #1a3352; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_22"/><path d=" M 257.1475,98.9304 L 230.1956,73.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_23"/><ellipse cx="257.14749268756" cy="98.930370458735" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_24"/><ellipse cx="230.1956114362" cy="73" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_25"/><path d=" M 288.4235,215.6539 L 274.1003,248.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_27"/><ellipse cx="288.4234548222" cy="215.65385020081" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_28"/><ellipse cx="274.10025125787" cy="248" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_29"/><path d=" M 311.5765,84.3461 L 320.1067,51.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_31"/><ellipse cx="311.5765451778" cy="84.346149799186" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_32"/><ellipse cx="320.10673597967" cy="51" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_33"/><path d=" M 351.0696,107.1475 L 381.9934,85.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_35"/><ellipse cx="351.06962954127" cy="107.14749268756" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_36"/><ellipse cx="381.99342076785" cy="85" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_37"/><path d=" M 365.6539,138.4235 L 404.3667,132.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_39"/><ellipse cx="365.65385020081" cy="138.4234548222" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_40"/><ellipse cx="404.36666101886" cy="132" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_41"/><g id="ezcGraphTextBox_4"><path d=" M 16.5000,17.0000 L 16.5000,1.5000 L 84.7800,1.5000 L 84.7800,17.0000 L 16.5000,17.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_43"/><text id="ezcGraphTextBox_4_text" x="17" text-length="66.78px" y="13.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Norwegian</text></g><g id="ezcGraphTextBox_6"><path d=" M 16.5000,35.0000 L 16.5000,19.5000 L 55.1000,19.5000 L 55.1000,35.0000 L 16.5000,35.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_44"/><text id="ezcGraphTextBox_6_text" x="17" text-length="37.1px" y="31.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Dutch</text></g><g id="ezcGraphTextBox_8"><path d=" M 16.5000,53.0000 L 16.5000,37.5000 L 62.5200,37.5000 L 62.5200,53.0000 L 16.5000,53.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_45"/><text id="ezcGraphTextBox_8_text" x="17" text-length="44.52px" y="49.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">German</text></g><g id="ezcGraphTextBox_10"><path d=" M 16.5000,71.0000 L 16.5000,55.5000 L 62.5200,55.5000 L 62.5200,71.0000 L 16.5000,71.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_46"/><text id="ezcGraphTextBox_10_text" x="17" text-length="44.52px" y="67.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">French</text></g><g id="ezcGraphTextBox_12"><path d=" M 16.5000,89.0000 L 16.5000,73.5000 L 47.6800,73.5000 L 47.6800,89.0000 L 16.5000,89.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_47"/><text id="ezcGraphTextBox_12_text" x="17" text-length="29.68px" y="85.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Misc</text></g><g id="ezcGraphTextBox_26"><path d=" M 104.9756,81.0000 L 104.9756,65.5000 L 225.1956,65.5000 L 225.1956,81.0000 L 104.9756,81.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_48"/><text id="ezcGraphTextBox_26_text" x="105.4756114362" text-length="118.72px" y="77.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Dutch: 3 (16.7%)</text></g><g id="ezcGraphTextBox_30"><path d=" M 111.7803,256.0000 L 111.7803,240.5000 L 269.1003,240.5000 L 269.1003,256.0000 L 111.7803,256.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_49"/><text id="ezcGraphTextBox_30_text" x="112.28025125787" text-length="155.82px" y="252.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Norwegian: 10 (55.6%)</text></g><g id="ezcGraphTextBox_34"><path d=" M 325.6067,59.0000 L 325.6067,43.5000 L 453.2467,43.5000 L 453.2467,59.0000 L 325.6067,59.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_50"/><text id="ezcGraphTextBox_34_text" x="326.10673597967" text-length="126.14px" y="55.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">German: 2 (11.1%)</text></g><g id="ezcGraphTextBox_38"><path d=" M 387.4934,100.0500 L 387.4934,70.4500 L 455.7734,70.4500 L 455.7734,100.0500 L 387.4934,100.0500 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_51"/><text id="ezcGraphTextBox_38_text" x="387.99342076785" text-length="66.78px" y="82.85" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">French: 2</text><text id="ezcGraphTextBox_38_text" x="387.99342076785" text-length="51.94px" y="98.25" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">(11.1%)</text></g><g id="ezcGraphTextBox_42"><path d=" M 409.8667,147.0500 L 409.8667,117.4500 L 463.3067,117.4500 L 463.3067,147.0500 L 409.8667,147.0500 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_52"/><text id="ezcGraphTextBox_42_text" x="410.36666101886" text-length="51.94px" y="129.85" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Misc: 1</text><text id="ezcGraphTextBox_42_text" x="410.36666101886" text-length="44.52px" y="145.25" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">(5.6%)</text></g></g></svg> diff --git a/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithLowPercentageThreshold.svg b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithLowPercentageThreshold.svg new file mode 100644 index 0000000..4261e51 --- /dev/null +++ b/tests/data/compare/ezcGraphPieChartTest_testRenderPieChartWithLowPercentageThreshold.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="500" height="300" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 0.0000,300.0000 L 0.0000,0.0000 L 500.0000,0.0000 L 500.0000,300.0000 L 0.0000,300.0000 z " style="fill: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_1"/><path d=" M 0.0000,300.0000 L 0.0000,0.0000 L 100.0000,0.0000 L 100.0000,300.0000 L 0.0000,300.0000 z " style="fill: #000000; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_2"/><path d=" M 2.0000,16.0000 L 2.0000,2.0000 L 16.0000,2.0000 L 16.0000,16.0000 L 2.0000,16.0000 z " style="fill: #4e9a06; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_3"/><path d=" M 2.0000,34.0000 L 2.0000,20.0000 L 16.0000,20.0000 L 16.0000,34.0000 L 2.0000,34.0000 z " style="fill: #cc0000; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_5"/><path d=" M 2.0000,52.0000 L 2.0000,38.0000 L 16.0000,38.0000 L 16.0000,52.0000 L 2.0000,52.0000 z " style="fill: #edd400; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_7"/><path d=" M 2.0000,70.0000 L 2.0000,56.0000 L 16.0000,56.0000 L 16.0000,70.0000 L 2.0000,70.0000 z " style="fill: #75505b; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_9"/><path d=" M 2.0000,88.0000 L 2.0000,74.0000 L 16.0000,74.0000 L 16.0000,88.0000 L 2.0000,88.0000 z " style="fill: #3465a4; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_11"/><path d="M 300.00,150.00 L 390.00,150.00 A 90.00,90.00 0 1,1 215.43,119.22 z" style="fill: #4e9a06; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_13"/><path d="M 300.00,150.00 L 390.00,150.00 A 90.00,90.00 0 1,1 215.43,119.22 z" style="fill: none; stroke: #274d03; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_14"/><path d="M 300.00,150.00 L 215.43,119.22 A 90.00,90.00 0 0,1 284.37,61.37 z" style="fill: #cc0000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_15"/><path d="M 300.00,150.00 L 215.43,119.22 A 90.00,90.00 0 0,1 284.37,61.37 z" style="fill: none; stroke: #660000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_16"/><path d="M 300.00,150.00 L 284.37,61.37 A 90.00,90.00 0 0,1 345.00,72.06 z" style="fill: #edd400; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_17"/><path d="M 300.00,150.00 L 284.37,61.37 A 90.00,90.00 0 0,1 345.00,72.06 z" style="fill: none; stroke: #776a00; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_18"/><path d="M 300.00,150.00 L 345.00,72.06 A 90.00,90.00 0 0,1 384.57,119.22 z" style="fill: #75505b; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_19"/><path d="M 300.00,150.00 L 345.00,72.06 A 90.00,90.00 0 0,1 384.57,119.22 z" style="fill: none; stroke: #3b282e; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_20"/><path d="M 300.00,150.00 L 384.57,119.22 A 90.00,90.00 0 0,1 390.00,150.00 z" style="fill: #3465a4; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircleSector_21"/><path d="M 300.00,150.00 L 384.57,119.22 A 90.00,90.00 0 0,1 390.00,150.00 z" style="fill: none; stroke: #1a3352; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_22"/><path d=" M 257.1475,98.9304 L 230.1956,73.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_23"/><ellipse cx="257.14749268756" cy="98.930370458735" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_24"/><ellipse cx="230.1956114362" cy="73" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_25"/><path d=" M 288.4235,215.6539 L 274.1003,248.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_27"/><ellipse cx="288.4234548222" cy="215.65385020081" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_28"/><ellipse cx="274.10025125787" cy="248" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_29"/><path d=" M 311.5765,84.3461 L 320.1067,51.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_31"/><ellipse cx="311.5765451778" cy="84.346149799186" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_32"/><ellipse cx="320.10673597967" cy="51" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_33"/><path d=" M 351.0696,107.1475 L 381.9934,85.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_35"/><ellipse cx="351.06962954127" cy="107.14749268756" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_36"/><ellipse cx="381.99342076785" cy="85" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_37"/><path d=" M 365.6539,138.4235 L 404.3667,132.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_39"/><ellipse cx="365.65385020081" cy="138.4234548222" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_40"/><ellipse cx="404.36666101886" cy="132" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_41"/><g id="ezcGraphTextBox_4"><path d=" M 16.5000,17.0000 L 16.5000,1.5000 L 84.7800,1.5000 L 84.7800,17.0000 L 16.5000,17.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_43"/><text id="ezcGraphTextBox_4_text" x="17" text-length="66.78px" y="13.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Norwegian</text></g><g id="ezcGraphTextBox_6"><path d=" M 16.5000,35.0000 L 16.5000,19.5000 L 55.1000,19.5000 L 55.1000,35.0000 L 16.5000,35.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_44"/><text id="ezcGraphTextBox_6_text" x="17" text-length="37.1px" y="31.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Dutch</text></g><g id="ezcGraphTextBox_8"><path d=" M 16.5000,53.0000 L 16.5000,37.5000 L 62.5200,37.5000 L 62.5200,53.0000 L 16.5000,53.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_45"/><text id="ezcGraphTextBox_8_text" x="17" text-length="44.52px" y="49.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">German</text></g><g id="ezcGraphTextBox_10"><path d=" M 16.5000,71.0000 L 16.5000,55.5000 L 62.5200,55.5000 L 62.5200,71.0000 L 16.5000,71.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_46"/><text id="ezcGraphTextBox_10_text" x="17" text-length="44.52px" y="67.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">French</text></g><g id="ezcGraphTextBox_12"><path d=" M 16.5000,89.0000 L 16.5000,73.5000 L 62.5200,73.5000 L 62.5200,89.0000 L 16.5000,89.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_47"/><text id="ezcGraphTextBox_12_text" x="17" text-length="44.52px" y="85.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Others</text></g><g id="ezcGraphTextBox_26"><path d=" M 104.9756,81.0000 L 104.9756,65.5000 L 225.1956,65.5000 L 225.1956,81.0000 L 104.9756,81.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_48"/><text id="ezcGraphTextBox_26_text" x="105.4756114362" text-length="118.72px" y="77.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Dutch: 3 (16.7%)</text></g><g id="ezcGraphTextBox_30"><path d=" M 111.7803,256.0000 L 111.7803,240.5000 L 269.1003,240.5000 L 269.1003,256.0000 L 111.7803,256.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_49"/><text id="ezcGraphTextBox_30_text" x="112.28025125787" text-length="155.82px" y="252.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Norwegian: 10 (55.6%)</text></g><g id="ezcGraphTextBox_34"><path d=" M 325.6067,59.0000 L 325.6067,43.5000 L 453.2467,43.5000 L 453.2467,59.0000 L 325.6067,59.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_50"/><text id="ezcGraphTextBox_34_text" x="326.10673597967" text-length="126.14px" y="55.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">German: 2 (11.1%)</text></g><g id="ezcGraphTextBox_38"><path d=" M 387.4934,100.0500 L 387.4934,70.4500 L 455.7734,70.4500 L 455.7734,100.0500 L 387.4934,100.0500 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_51"/><text id="ezcGraphTextBox_38_text" x="387.99342076785" text-length="66.78px" y="82.85" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">French: 2</text><text id="ezcGraphTextBox_38_text" x="387.99342076785" text-length="51.94px" y="98.25" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">(11.1%)</text></g><g id="ezcGraphTextBox_42"><path d=" M 409.8667,147.0500 L 409.8667,117.4500 L 478.1467,117.4500 L 478.1467,147.0500 L 409.8667,147.0500 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_52"/><text id="ezcGraphTextBox_42_text" x="410.36666101886" text-length="66.78px" y="129.85" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Others: 1</text><text id="ezcGraphTextBox_42_text" x="410.36666101886" text-length="44.52px" y="145.25" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">(5.6%)</text></g></g></svg> diff --git a/tests/pie_test.php b/tests/pie_test.php index 1c54a71..a871621 100644 --- a/tests/pie_test.php +++ b/tests/pie_test.php @@ -548,6 +548,61 @@ class ezcGraphPieChartTest extends ezcImageTestCase $this->fail( 'Expected ezcBaseValueException.' ); } + public function testRenderPieChartWithLowAbsoluteThreshold() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $chart = new ezcGraphPieChart(); + $chart->options->absoluteThreshold = 1; + $chart->data['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1 ) ); + + $chart->render( 500, 300, $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + + try + { + $chart->options->absoluteThreshold = false; + } + catch( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'Expected ezcBaseValueException.' ); + } + + public function testRenderPieChartWithLowPercentageThreshold() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $chart = new ezcGraphPieChart(); + $chart->options->percentThreshold = .06; + $chart->options->summarizeCaption = 'Others'; + $chart->data['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1 ) ); + + $chart->render( 500, 300, $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + + try + { + $chart->options->percentThreshold = false; + } + catch( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'Expected ezcBaseValueException.' ); + } + public function testRenderPieChartWithPercentageThresholdAndCustomSum() { $filename = $this->tempDir . __FUNCTION__ . '.svg'; |