kietas0
New pChart user
Joined: Wed Jul 06, 2011 6:25 pm Posts: 1
|
pie chart bug?
Hello, I've noticed something interesting: if I put two points to the chart 0 and 1, i get this chart: if I turn them around (1 and 0), i get the same chart: 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 />";
?>
|