pChart 2.x forum http://wiki.pchart.net/forum/ |
|
PieChart2D positions of labels uncorrect http://wiki.pchart.net/forum/viewtopic.php?f=5&t=29596 |
Page 1 of 1 |
Author: | pbrock [ Wed Sep 19, 2012 10:52 am ] |
Post subject: | 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.php The 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(); ?> |
Author: | pbrock [ Fri Oct 12, 2012 11:22 am ] |
Post subject: | Re: PieChart2D positions of labels uncorrect |
Hi all, Come back on this issue. I am still looking for a patch to correct this small bug. Patrick |
Author: | pbrock [ Wed Dec 19, 2012 1:55 pm ] |
Post subject: | Re: PieChart2D positions of labels uncorrect |
Hi All, Any news on this bug ? Patrick |
Author: | vivalaakam [ Tue Jun 25, 2013 5:29 am ] |
Post subject: | Re: PieChart2D positions of labels uncorrect |
I fixed this problem as follows Replace on 266 str. Code: $EndAngle = ($Value*$ScaleFactor) + $Offset; if ( $EndAngle > 360 ) { $EndAngle = 0; } Code: $EndAngle = ($Value*$ScaleFactor) + $Offset; if ( $EndAngle > 360 ) { $EndAngle = 360; } OR on 267 str. Code: $Angle = ($EndAngle - $Offset)/2 + $Offset; Code: $Angle = (((360+$EndAngle - $Offset)%360)/2 + $Offset; Unfortunately, the paint because of what happened so I can not, so how bad know English |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |