View unanswered posts | View active topics It is currently Sat Apr 27, 2024 10:23 pm



Reply to topic  [ 3 posts ] 
pie chart bug? 
Author Message
New pChart user
New pChart user

Joined: Wed Jul 06, 2011 6:25 pm
Posts: 1
Post pie chart bug?
Hello,
I've noticed something interesting:
if I put two points to the chart 0 and 1, i get this chart:
Image

if I turn them around (1 and 0), i get the same chart:
Image

shouldn't in the first example the lable at the pie say "false"? or am I doing something wrong?

here's my code:
Code:
<?php
/* pChart library inclusions */
include_once("../pChart/class/pData.class.php");
include_once("../pChart/class/pDraw.class.php");
include_once("../pChart/class/pPie.class.php");
include_once("../pChart/class/pImage.class.php");
                                   
/* Create and populate the pData object */
$MyData = new pData();   
$MyData->addPoints(array(0, 1),"Values"); 
$MyData->setSerieDescription("ScoreA","Application A");
                                           
/* Define the absissa serie */
$MyData->addPoints(array("TRUE","FALSE"),"Labels");
$MyData->setAbscissa("Labels");
                                           
/* Create the pChart object */
$myPicture = new pImage(500,260,$MyData);
                                         
/* Draw a solid background */
$Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
$myPicture->drawFilledRectangle(0,0,500,260,$Settings);
                                           
/* Overlay with a gradient */
$Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
$myPicture->drawGradientArea(0,0,500,260,DIRECTION_VERTICAL,$Settings);
$myPicture->drawGradientArea(0,0,500,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100));
                                           
/* Add a border to the picture */
$myPicture->drawRectangle(0,0,499,259,array("R"=>0,"G"=>0,"B"=>0));
                                           
/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>"../pChart/fonts/arial.ttf","FontSize"=>10));
$myPicture->drawText(70,20,"",array("R"=>255,"G"=>255,"B"=>255));
                                           
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>"../pChart/fonts/arial.ttf","FontSize"=>10,"R"=>80,"G"=>80,"B"=>80));
                                           
/* Create the pPie object */
$PieChart = new pPie($myPicture,$MyData);
                                   
/* Define the slice color */
$PieChart->setSliceColor(0,array("R"=>0,"G"=>204,"B"=>5));
$PieChart->setSliceColor(1,array("R"=>255,"G"=>40,"B"=>0));
                                   
/* Draw a splitted pie chart */
$PieChart->draw3DPie(250,160,array("WriteValues"=>TRUE,"DrawLabels"=>TRUE,"LabelStacked"=>FALSE,"DataGapAngle"=>10,"DataGapRadius"=>6,"Border"=>TRUE));
                                           
/* Write the legend box */
$myPicture->setShadow(TRUE);
$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0));
$PieChart->drawPieLegend(15,40,array("Alpha"=>20));
                                           
/* Render the picture (choose the best way) */
$myPicture->render("images/chart_history_track.png");
echo "<br /><img src=\"images/chart.png\" alt=\"Grafikas\" /><br /><br />";

?>


Wed Jul 06, 2011 6:36 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: pie chart bug?
Indeed that's a bug ;o) I've fixed it right away for the next release.

Thank you very much for having reported it.

Kind regards,
JD.


Wed Aug 03, 2011 12:35 pm
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: pie chart bug?
The 2.1.2 version has been published yesterday correcting this bug and is now available for download at http://www.pchart.net/download.

JD.


Fri Aug 05, 2011 8:51 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 12 guests


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