$p1->SetCenter(0.5, 0.45); // Label font and color setup $p1->value->SetFont(FF_ARIAL, FS_BOLD, 12); $p1->value->SetColor('white'); // Setup the title on the center circle $p1->midtitle->Set("Test mid\nRow 1\nRow 2"); $p1->midtitle->SetFont(FF_ARIAL, FS_NORMAL, 14); // Set color for mid circle $p1->SetMidColor('yellow'); // Use percentage values in the legends values (This is also the default) $p1->SetLabelType(PIE_VALUE_PER); // The label array values may have printf() formatting in them. The argument to the // form,at string will be the value of the slice (either the percetage or absolute // depending on what was specified in the SetLabelType() above. $lbl = array("adam\n%.1f%%", "bertil\n%.1f%%", "johan\n%.1f%%", "peter\n%.1f%%", "daniel\n%.1f%%", "erik\n%.1f%%"); $p1->SetLabels($lbl); // Uncomment this line to remove the borders around the slices // $p1->ShowBorder(false); // Add drop shadow to slices $p1->SetShadow(); // Explode all slices 15 pixels $p1->ExplodeAll(15); // Setup the CSIM targets $targ = array("piec_csimex1.php#1", "piec_csimex1.php#2", "piec_csimex1.php#3", "piec_csimex1.php#4", "piec_csimex1.php#5", "piec_csimex1.php#6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $p1->SetCSIMTargets($targ, $alts); $p1->SetMidCSIM("piec_csimex1.php#7", "Center"); // Setup a small help text in the image $txt = new Text("Note: This is an example of image map. Hold\nyour mouse over the slices to see the values.\nThe URL just points back to this page"); $txt->SetFont(FF_FONT1, FS_BOLD); $txt->SetPos(0.5, 0.97, 'center', 'bottom');
public function graficar_pastel() { $sql = "call PRGetGraficaDias('{$this->fecha_inicial}','{$this->fecha_final}');"; $res = mysql_query($sql); while ($row = mysql_fetch_array($res)) { $datos[] = $row["Contador"]; $labels[] = $row["Estado"]; } if (empty($datos)) { echo 'No existe datos a mostrarse.'; } else { // A new graph $graph = new PieGraph(1000, 800, 'auto'); $graph->SetFrame(false); $graph->img->SetAntiAliasing(); // Setup title $graph->title->Set("Porcentaje de Personas que Entran - Salen"); $graph->title->SetFont(FF_ARIAL, FS_BOLD, 22); $graph->title->SetMargin(20); // The pie plot $p1 = new PiePlotC($datos); $p1->SetSliceColors(array('hotpink', 'aquamarine3')); // Move center of pie to the left to make better room // for the legend $p1->SetSize(0.3); // Set color for mid circle $p1->SetMidColor('white'); $p1->SetCenter(0.5, 0.4); $p1->value->SetFont(FF_ARIAL, FS_BOLD, 20); $p1->value->SetColor('white'); $p1->value->Show(); $p1->SetLabelType(PIE_VALUE_PER); $lbl = array("%.1f%%", "%.1f%%"); $p1->SetLabels($lbl); $p1->ExplodeAll(10); // Legends $p1->SetLegends(array("ENTRA", "SALE")); $graph->legend->SetFont(FF_ARIAL, FS_BOLD, 15); $graph->legend->SetPos(0.5, 0.4, 'center', 'bottom'); $graph->legend->SetColumns(2); $graph->Add($p1); $graph->Stroke(); } }