pChart 2.x forum
http://wiki.pchart.net/forum/

pie chart bug?
http://wiki.pchart.net/forum/viewtopic.php?f=5&t=1604
Page 1 of 1

Author:  kietas0 [ Wed Jul 06, 2011 6:36 pm ]
Post subject:  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 />";

?>

Author:  jean-damien [ Wed Aug 03, 2011 12:35 pm ]
Post subject:  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.

Author:  jean-damien [ Fri Aug 05, 2011 8:51 am ]
Post subject:  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.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/