function create_pie_graph() { $graph = new PieGraph($this->width, $this->height, "auto"); //instantiate new PieGraph object $graph->SetShadow(); //displayed with shadow $graph->title->Set($this->title); //setup graph title $graph->title->SetFont(FF_VERDANA, FS_BOLD, 10); //set up font porperties $graph->title->SetColor("darkblue"); $p1 = new PiePlot3D($this->data); //define new 3D image for PieGraph $p1->ExplodeAll(); //explode each sector of the pie $p1->SetTheme("sand"); //set up the theme (Colors) $p1->SetCenter(0.45); //display on center $p1->SetLegends($this->label); //set up legend of the graph //$p1->SetLabel($this->label); //set up the labels of each sector of the pie graph // Setup the slice values $p1->value->SetFont(FF_ARIAL, FS_BOLD, 11); $p1->value->SetColor("navy"); $graph->Add($p1); //add 3D pie to PieGraph object $graph->Stroke(); //display grapg }
<?php // content="text/plain; charset=utf-8" require_once '../../vendor/autoload.php'; \JpGraph\JpGraph::load(); \JpGraph\JpGraph::module('pie'); \JpGraph\JpGraph::module('pie3d'); // Some data $data = array(20, 27, 45, 75, 90); // Create the Pie Graph. $graph = new \PieGraph(350, 200); $graph->SetShadow(); // Set A title for the plot $graph->title->Set("Example 1 3D Pie plot"); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 18); $graph->title->SetColor("darkblue"); $graph->legend->Pos(0.1, 0.2); // Create pie plot $p1 = new \PiePlot3D($data); $p1->SetTheme("sand"); $p1->SetCenter(0.4); $p1->SetAngle(30); $p1->value->SetFont(FF_ARIAL, FS_NORMAL, 12); $p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct")); $graph->Add($p1); $graph->Stroke();
$p1->SetLabelType(PIE_VALUE_ABS); $p1->value->SetFormat("%d"); } else { $p1->SetLabelType(PIE_VALUE_PER); $p1->value->SetFormat(".%dM"); } // Set percentage to enable per percent labels $percentage = 1; if ($percentage > 0) { $p1->SetLabelType(PIE_VALUE_ABS); $p1->value->SetFormat("%d%%"); $p1->SetValueType(PIE_VALUE_PERCENTAGE); } // Set theme colors // Options are "earth", "sand", "water" and doodoo, no, I mean "pastel" :-) $p1->SetTheme("earth"); // Explode all slices $p1->ExplodeAll($topx); // Add drop shadow $aColor = "darkgray"; $p1->SetShadow($aColor); // Finally add the plot $graph->Add($p1); // ... and stroke it // $graph->Stroke(); //$ih = $graph->Stroke(_IMG_HANDLE); // $graph->StrokeCSIM("$graph_name"); $graph->Stroke($fileName); // $mapName = 'Top10'; $imgMap = $graph->GetHTMLImageMap($mapName); // die("?offset=".$offset. "PPP" .$ParamsGET);
// $graph->footer->right->Set ( GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) ); // $graph->footer->right->SetFont( FF_VERA, FS_NORMAL, 8); // $graph->footer->left->Set ("LogAnalyzer v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) ); // $graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 8); // $graph->footer->right->SetColor("darkred"); // Show 0 label on Y-axis (default is not to show) $graph->yscale->ticks->SupressZeroLabel(false); // Set Fonts for graph! $graph->xaxis->SetFont(FF_VERA, FS_NORMAL, 8); $graph->yaxis->SetFont(FF_VERA, FS_NORMAL, 8); $graph->legend->SetFont(FF_VERA, FS_NORMAL, 8); // Create $p1 = new PiePlot3D($YchartData); $p1->SetLegends($XchartData); $p1->SetEdge('#333333', 1); $p1->SetTheme('earth'); /* "earth" * "pastel" * "sand" * "water" */ $p1->SetCSIMTargets($chartImageMapLinks, $chartImageMapAlts, $chartImageMapTargets); // Set label format if ($content['showpercent'] == 1) { $p1->SetLabelType(0); $p1->value->SetFormat("%d%%"); } else { $p1->SetLabelType(1); $p1->value->SetFormat("%d"); } // Set label properties $p1->SetLabelPos(1.0); $p1->SetSliceColors(array('#FFF584', '#CBFF84', '#FF6B9E', '#FF9584', '#EAFF84', '#7BFF51', '#51FFA6', '#51FF52', '#6BCFFF', '#5170FF', '#519CFF', '#EAE3AD', '#FFF184', '#8584FF', '#E698FF', '#C384FF', '#FF84EC', '#FF98A3', '#E5C285', '#FFDA98')); $p1->value->SetFont(FF_VERA, FS_NORMAL, 8); $p1->value->SetColor("black");
$graph->Add($bplot); break; case "T": $textWidth = 56 + $maxChars * 6; $width = 600; if ($textWidth > $width) { $width = $textWidth; } $graph = new PieGraph($width, 200 + count($datax) * 32, "auto"); $graph->SetScale("textlin"); $graph->SetShadow(); $graph->legend->SetFont(FF_ARIAL, FS_NORMAL, 9); $graph->legend->SetLayout(LEGEND_VERT); $graph->legend->Pos(0.03, 0.95, "left", "bottom"); $p1 = new PiePlot3D($datax); $p1->SetAngle(30); $p1->SetCenter(0.5, 0.3); $p1->SetSize(0.4); $p1->SetTheme("pastel"); $p1->SetLegends($datay); $p1->value->Show(); $p1->value->SetFormat("%2.2f%%"); $graph->Add($p1); break; } $graph->footer->right->Set("Provincia ART"); $graph->footer->right->SetColor("#0f539c"); $graph->footer->right->SetFont(FF_FONT1, FS_BOLD); $graph->title->Set($titulo); $graph->title->SetFont(FF_ARIAL, FS_BOLD, 10); $graph->Stroke();