コード例 #1
0
ファイル: lib.php プロジェクト: sumitnegi933/Moodle_lms_New
 public static function drawchart($data)
 {
     // Include the chart libraries.
     $plib = '../iomad/pchart';
     require_once "{$plib}/class/pDraw.class.php";
     require_once "{$plib}/class/pPie.class.php";
     require_once "{$plib}/class/pImage.class.php";
     require_once "{$plib}/class/pData.class.php";
     // Chart data.
     $chartdata = new pData();
     $chartdata->addPoints(array($data->notstarted, $data->inprogress, $data->completed), "Value");
     // Labels.
     $chartdata->addPoints(array('Not started', 'In progress', 'Completed'), "Legend");
     $chartdata->setAbscissa("Legend");
     // Chart object.
     $chart = new pImage(350, 180, $chartdata);
     // Pie chart object.
     $pie = new pPie($chart, $chartdata);
     $chart->setShadow(false);
     $chart->setFontProperties(array("FontName" => "{$plib}/fonts/GeosansLight.ttf", "FontSize" => 11));
     $pie->setSliceColor(0, array("R" => 200, "G" => 0, "B" => 0));
     $pie->setSliceColor(1, array("R" => 200, "G" => 200, "B" => 0));
     $pie->setSliceColor(2, array("R" => 0, "G" => 200, "B" => 0));
     $pie->draw3Dpie(175, 100, array("Radius" => 80, "DrawLabels" => true, "DataGapAngle" => 10, "DataGapRadius" => 6, "Border" => true));
     // Display the chart.
     $chart->stroke();
 }