|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <?php /* CAT:Pie charts */ /* pChart library inclusions */ include("../class/pData.class.php"); include("../class/pDraw.class.php"); include("../class/pPie.class.php"); include("../class/pImage.class.php"); /* Create and populate the pData object */ $MyData = new pData(); $MyData->addPoints(array(40,30,20),"ScoreA"); $MyData->setSerieDescription("ScoreA","Application A"); /* Define the absissa serie */ $MyData->addPoints(array("A","B","C"),"Labels"); $MyData->setAbscissa("Labels"); /* Create the pChart object */ $myPicture = new pImage(240,180,$MyData,TRUE); /* Set the default font properties */ $myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>10,"R"=>80,"G"=>80,"B"=>80)); /* Create the pPie object */ $PieChart = new pPie($myPicture,$MyData); /* Enable shadow computing */ $myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); /* Draw a splitted pie chart */ $PieChart->draw3DPie(120,90,array("Radius"=>100,"DataGapAngle"=>10,"DataGapRadius"=>6,"Border"=>TRUE)); /* Write the legend box */ $myPicture->setFontProperties(array("FontName"=>"../fonts/Silkscreen.ttf","FontSize"=>6,"R"=>0,"G"=>0,"B"=>0)); $PieChart->drawPieLegend(140,160,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); /* Render the picture (choose the best way) */ $myPicture->autoOutput("pictures/example.draw3DPie.transparent.png"); ?> |