PieChart2D positions of labels uncorrect
Hi all,
I have encoutered a problem with position of labels only
when data have some specific values !
See:
http://webservices.ipsl.fr/migration/bug_pie_labels.phpThe code is simple as it should be.
Now change array(5,1,1) to array(5,1,2)
and the labels are set correctly.
Note that with pie3D, the labels are well positionned.
Any help and corrections to class/pPie.class.php
are welcome
Regards
Patrick
<?php
#=============================================================
include("../pChart/class/pData.class.php");
include("../pChart/class/pDraw.class.php");
include("../pChart/class/pImage.class.php");
include("../pChart/class/pPie.class.php");
#=============================================================
$w=200;
$myData = new pData();
$myData->addPoints(array(5,1,1));
$myData->addPoints(array("ok","failed","todo"),"Labels");
$myData->setAbscissa("Labels");
$myPicture = new pImage($w,$w,$myData,TRUE);
$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,
"FontName"=>"../pChart/fonts/verdana.ttf",
"FontSize"=>8));
/* Draw a solid background */
$Settings = array("R"=>100, "G"=>100, "B"=>100, "Alpha"=>0);
$myPicture->drawFilledRectangle(0,0,100,100,$Settings);
/* Create the pPie object */
$PieChart = new pPie($myPicture,$myData);
$PieChart->setSliceColor(0,array("R"=>187,"G"=>224,"B"=>45));
$PieChart->setSliceColor(1,array("R"=>252,"G"=>71,"B"=>43));
$PieChart->setSliceColor(2,array("R"=>46,"G"=>186,"B"=>224));
$PieChart->draw2DPie($w/2,$w/2,array("WriteValues"=>PIE_VALUE_NATURAL,"ValuePosition"=>PIE_VALUE_INSIDE,
"ValueR"=>0,"ValueG"=>0,"ValueB"=>0,"DrawLabels"=>FALSE,
"Radius"=>$w*0.4,"Border"=>TRUE));
$myPicture->Stroke();
?>