View unanswered posts | View active topics It is currently Thu Mar 28, 2024 6:29 pm



Reply to topic  [ 4 posts ] 
PieChart2D positions of labels uncorrect 
Author Message
pChart user
pChart user

Joined: Tue Jun 19, 2012 9:43 am
Posts: 4
Post 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();

?>


Wed Sep 19, 2012 10:52 am
Profile
pChart user
pChart user

Joined: Tue Jun 19, 2012 9:43 am
Posts: 4
Post 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


Fri Oct 12, 2012 11:22 am
Profile
pChart user
pChart user

Joined: Tue Jun 19, 2012 9:43 am
Posts: 4
Post Re: PieChart2D positions of labels uncorrect
Hi All,
Any news on this bug ?
Patrick


Wed Dec 19, 2012 1:55 pm
Profile
New pChart user
New pChart user

Joined: Tue Jun 25, 2013 5:23 am
Posts: 1
Post 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; }
by
Code:
$EndAngle = ($Value*$ScaleFactor) + $Offset; if ( $EndAngle > 360 ) { $EndAngle = 360; }

OR on 267 str.
Code:
$Angle    = ($EndAngle - $Offset)/2 + $Offset;
by
Code:
$Angle    = (((360+$EndAngle - $Offset)%360)/2 + $Offset;

Unfortunately, the paint because of what happened so I can not, so how bad know English


Tue Jun 25, 2013 5:29 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron