本文整理汇总了PHP中PieGraph::SetMarginColor方法的典型用法代码示例。如果您正苦于以下问题:PHP PieGraph::SetMarginColor方法的具体用法?PHP PieGraph::SetMarginColor怎么用?PHP PieGraph::SetMarginColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PieGraph
的用法示例。
在下文中一共展示了PieGraph::SetMarginColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executePieGraph
public function executePieGraph()
{
//Set the response header to a image JPEG datastream
$this->getResponse()->setContent('image/jpeg');
$util = new util();
//echo $duales;
$data1 = $util->getDualMedia('movies');
$data2 = $util->getTotalMedia('movies') - $data1;
$data = array($data2, $data1);
$graph = new PieGraph(199, 120);
$graph->SetMarginColor('#393939');
$graph->SetFrame(true, '#393939');
$graph->legend->SetPos(0.8, 0.9, 'center', 'bottom');
$p1 = new PiePlot($data);
$p1->SetSize(0.4);
$p1->SetCenter(0.45);
$p1->SetSliceColors(array('white', 'red'));
$p1->value->SetColor('black');
$p1->SetLegends(array("Spa", "Dual"));
$p1->SetLabelPos(0.6);
$graph->Add($p1);
$graph->Stroke();
return sfView::NONE;
}
示例2: executePieGraphSingers
public function executePieGraphSingers(sfWebRequest $request)
{
$util = new util();
$loko = $util->singersData();
//Set the response header to a image JPEG datastream
$this->getResponse()->setContent('image/jpeg');
//echo $duales;
$data1 = 300;
$data2 = 200;
// $data_results = $util->singersData();
$data = array($data2, $data1);
$graph = new PieGraph(200, 174);
$graph->SetMarginColor('#393939');
$graph->SetFrame(true, '#393939');
$graph->legend->SetPos(0.8, 0.9, 'center', 'bottom');
$p1 = new PiePlot($data);
$p1->SetSize(0.4);
$p1->SetCenter(0.45);
$p1->SetSliceColors(array('white', 'red'));
$p1->value->SetColor('black');
$p1->SetLegends(array("Spa", "Dual"));
$p1->SetLabelPos(0.6);
$graph->Add($p1);
$graph->Stroke();
return sfView::NONE;
}
示例3: graph_pie
function graph_pie($p_metrics, $p_title = '', $p_graph_width = 500, $p_graph_height = 350, $p_center = 0.4, $p_poshorizontal = 0.1, $p_posvertical = 0.09)
{
$t_graph_font = graph_get_font();
error_check(is_array($p_metrics) ? array_sum($p_metrics) : 0, $p_title);
$graph = new PieGraph($p_graph_width, $p_graph_height);
$graph->img->SetMargin(40, 40, 40, 100);
$graph->title->Set($p_title);
$graph->title->SetFont($t_graph_font, FS_BOLD);
$graph->SetMarginColor('white');
$graph->SetFrame(false);
$graph->legend->Pos($p_poshorizontal, $p_posvertical);
$graph->legend->SetFont($t_graph_font);
$p1 = new PiePlot3d(array_values($p_metrics));
// should be reversed?
$p1->SetTheme('earth');
#$p1->SetTheme("sand");
$p1->SetCenter($p_center);
$p1->SetAngle(60);
$p1->SetLegends(array_keys($p_metrics));
# Label format
$p1->value->SetFormat('%2.0f');
$p1->value->Show();
$p1->value->SetFont($t_graph_font);
$graph->Add($p1);
if (helper_show_queries()) {
$graph->subtitle->Set(db_count_queries() . ' queries (' . db_count_unique_queries() . ' unique) (' . db_time_queries() . 'sec)');
$graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
}
$graph->Stroke();
}
示例4: array
<?php
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
require_once 'jpgraph/jpgraph_pie3d.php';
// Some data
$data = array(array(80, 18, 15, 17), array(35, 28, 6, 34), array(10, 28, 10, 5), array(22, 22, 10, 17));
$piepos = array(0.2, 0.4, 0.65, 0.28, 0.25, 0.75, 0.8, 0.75);
$titles = array('USA', 'Sweden', 'South America', 'Australia');
$n = count($piepos) / 2;
// A new graph
$graph = new PieGraph(550, 400, 'auto');
// Specify margins since we put the image in the plot area
$graph->SetMargin(1, 1, 40, 1);
$graph->SetMarginColor('navy');
$graph->SetShadow(false);
// Setup background
$graph->SetBackgroundImage('worldmap1.jpg', BGIMG_FILLPLOT);
// Setup title
$graph->title->Set("Pie plots with background image");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 20);
$graph->title->SetColor('white');
$p = array();
// Create the plots
for ($i = 0; $i < $n; ++$i) {
$d = "data{$i}";
$p[] = new PiePlot3D($data[$i]);
}
// Position the four pies
for ($i = 0; $i < $n; ++$i) {
示例5: array
}
}
}
$conf = $GLOBALS["CONF"];
if ($multiple_colors) {
$colors = Util::get_chart_colors();
} else {
$colors = array('#ADD8E6', '#00BFFF', '#4169E1', '#4682B4', '#0000CD', '#483D8B', '#00008B', '#3636db', '#1390fa', '#6aafea');
}
$jpgraph = $conf->get_conf("jpgraph_path");
require_once "{$jpgraph}/jpgraph.php";
require_once "{$jpgraph}/jpgraph_pie.php";
// Setup graph
$graph = new PieGraph(400, 400, "auto");
$graph->SetAntiAliasing();
$graph->SetMarginColor('#fafafa');
//$graph->SetShadow();
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create pie plot
$p1 = new PiePlot($data);
//$p1->SetHeight(12);
$p1->SetSize(0.3);
if (count($labels) > 1) {
$p1->SetCenter(0.5, 0.5);
} else {
$p1->SetCenter(0.57, 0.3);
}
$p1->SetLabels($labels);
$p1->SetLabelPos(1);
if ($multiple_colors) {
$p1->SetLegends($legend);
示例6: explode
$plotfcolor = derive_request_item("plotfillcolor" . $v, "");
$plotlegend = derive_request_item("plotlegend" . $v, "");
if (array_key_exists("{$vval}", $_REQUEST)) {
$vals = explode(",", $_REQUEST["{$vval}"]);
$plot[$v] = array("type" => $plottype, "fillcolor" => $plotfcolor, "linecolor" => $plotlcolor, "legend" => $plotlegend, "data" => $vals);
} else {
break;
}
$v++;
}
// Create the correct type of graph.
if ($plot[0]["type"] == "PIE" || $plot[0]["type"] == "PIE3D") {
$graph = new PieGraph($width, $height, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin($marginleft, $marginright, $margintop, $marginbottom);
$graph->SetMarginColor($margincolor);
$graph->img->SetAntiAliasing();
$graph->SetColor($color);
$graph->SetShadow();
$graph->xaxis->SetTitleMargin($marginbottom - 35);
$graph->yaxis->SetTitleMargin(50);
$graph->yaxis->SetTitleMargin($marginleft - 15);
$graph->title->Set($title);
} else {
$graph = new Graph($width, $height, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin($marginleft, $marginright, $margintop, $marginbottom);
$graph->SetMarginColor($margincolor);
$graph->img->SetAntiAliasing();
$graph->SetColor($color);
$graph->SetShadow();
示例7: grafic_trunk2
function grafic_trunk2(&$pDB_ast_cdr, &$pDB_ast, $module_name, $trunk, $dti, $dtf)
{
//
require_once "modules/{$module_name}/libs/paloSantoExtention.class.php";
$objPalo_AST_CDR = new paloSantoExtention($pDB_ast_cdr);
/* Si la troncal pedida es un grupo, se expande el grupo para averiguar las
troncales individuales. */
$regs = NULL;
if (preg_match('!^DAHDI/(g|r)(\\d+)$!i', $trunk, $regs)) {
$iGrupoTrunk = (int) $regs[2];
$gruposTrunk = getTrunkGroupsDAHDI();
if (is_array($gruposTrunk) && isset($gruposTrunk[$iGrupoTrunk])) {
$trunk = $gruposTrunk[$iGrupoTrunk];
}
}
//total minutos de llamadas in y out
$arrayTemp = $objPalo_AST_CDR->loadTrunks($trunk, "numcall", $dti, $dtf);
$arrResult = $arrayTemp[0];
//$arrResult[0] => "IN"
//$arrResult[1] => "OUT"
$tot = $arrResult[0] + $arrResult[1];
$usoDisco = $tot != 0 ? 100 * ($arrResult[0] / $tot) : 0;
if ($tot != 0) {
$freeDisco = 100 - $usoDisco;
// Some data
$data = array($usoDisco, $freeDisco);
// Create the Pie Graph.
$graph = new PieGraph(400, 170, "auto");
//$graph->SetShadow();
$graph->SetMarginColor('#fafafa');
$graph->SetFrame(true, '#999999');
$graph->legend->SetFillColor("#fafafa");
//$graph->legend->Pos(0.012, 0.5, "right","center");
$graph->legend->SetColor("#444444", "#999999");
$graph->legend->SetShadow('gray@0.6', 4);
//$graph->title->SetColor("#444444");
// Set A title for the plot
$graph->title->Set(utf8_decode(_tr("Number of Calls")));
//$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
$graph->title->SetColor("#444444");
$graph->legend->Pos(0.04, 0.2);
// Create 3D pie plot
$p1 = new PiePlot3d($data);
//$p1->SetTheme("water");
$p1->SetSliceColors(array("#3333cc", "#9999cc", "#CC3333", "#72394a", "#aa3424"));
$p1->SetCenter(0.3);
$p1->SetSize(80);
// Adjust projection angle
$p1->SetAngle(45);
// Adjsut angle for first slice
$p1->SetStartAngle(45);
// Display the slice values
//$p1->value->SetFont(FF_ARIAL,FS_BOLD,11);
//$p1->value->SetColor("navy");
$p1->value->SetColor("black");
// Add colored edges to the 3D pies
// NOTE: You can't have exploded slices with edges!
$p1->SetEdge("black");
$p1->SetLegends(array(utf8_decode(_tr("Incoming Calls") . ": ") . $arrResult[0], utf8_decode(_tr("Outcoming Calls") . ": ") . $arrResult[1]));
$graph->Add($p1);
$graph->Stroke();
} else {
$graph = new CanvasGraph(400, 140, "auto");
$title = new Text(utf8_decode(_tr("Number of Calls")));
$title->ParagraphAlign('center');
$title->SetFont(FF_FONT2, FS_BOLD);
$title->SetMargin(3);
$title->SetAlign('center');
$title->Center(0, 400, 70);
$graph->AddText($title);
$t1 = new Text(utf8_decode(_tr("There are no data to present")));
$t1->SetBox("white", "black", true);
$t1->ParagraphAlign("center");
$t1->SetColor("black");
$graph->AddText($t1);
$graph->img->SetColor('navy');
$graph->img->SetTextAlign('center', 'bottom');
$graph->img->Rectangle(0, 0, 399, 139);
$graph->Stroke();
}
}
示例8: array
function generate_graph_image()
{
// Create the graph.
// Set up Font Mapping Arrays
$fontfamilies = array("Font 0" => FF_FONT0, "Font 1" => FF_FONT1, "Font 2" => FF_FONT2, "Font0" => FF_FONT0, "Font1" => FF_FONT1, "Font2" => FF_FONT2, "Arial" => FF_ARIAL, "Verdana" => FF_VERDANA, "Courier" => FF_COURIER, "Comic" => FF_COMIC, "Times" => FF_TIMES, "Georgia" => FF_GEORGIA, "Trebuchet" => FF_TREBUCHE, "advent_light" => advent_light, "Bedizen" => Bedizen, "Mukti_Narrow" => Mukti_Narrow, "calibri" => calibri, "Forgotte" => Forgotte, "GeosansLight" => GeosansLight, "MankSans" => MankSans, "pf_arma_five" => pf_arma_five, "Silkscreen" => Silkscreen, "verdana" => verdana, "Vera" => FF_VERA);
$fontstyles = array("Normal" => FS_NORMAL, "Bold" => FS_BOLD, "Italic" => FS_ITALIC, "Bold+Italic" => FS_BOLDITALIC);
$this->apply_defaults();
if (!function_exists("imagecreatefromstring")) {
handle_error("Graph Option Not Available. Requires GD2");
return;
}
if ($this->plot[0]["type"] == "PIE" || $this->plot[0]["type"] == "PIE3D") {
$graph = new PieGraph($this->width_actual, $this->height_actual, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin($this->marginleft_actual, $this->marginright_actual, $this->margintop_actual, $this->marginbottom_actual);
$graph->SetMarginColor($this->margincolor_actual);
$graph->img->SetAntiAliasing();
$graph->SetColor($this->graphcolor_actual);
$graph->SetShadow();
$graph->xaxis->SetTitleMargin($this->marginbottom_actual - 45);
$graph->yaxis->SetTitleMargin($this->marginleft_actual - 25);
} else {
$graph = new Graph($this->width_actual, $this->height_actual, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin($this->marginleft_actual, $this->marginright_actual, $this->margintop_actual, $this->marginbottom_actual);
$graph->SetMarginColor($this->margincolor_actual);
$graph->img->SetAntiAliasing();
$graph->SetColor($this->graphcolor_actual);
$graph->SetShadow();
$graph->xaxis->SetTitleMargin($this->marginbottom_actual - 45);
$graph->yaxis->SetTitleMargin($this->marginleft_actual - 25);
}
$lplot = array();
$lplotct = 0;
foreach ($this->plot as $k => $v) {
switch ($v["type"]) {
case "PIE":
$lplot[$lplotct] = new PiePlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
foreach ($xlabels as $k => $v) {
$xlabels[$k] = $v . "\n %.1f%%";
}
$lplot[$lplotct]->SetLabels($xlabels, 1.0);
$graph->Add($lplot[$lplotct]);
break;
case "PIE3D":
$lplot[$lplotct] = new PiePlot3D($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
foreach ($xlabels as $k => $v) {
$xlabels[$k] = $v . "\n %.1f%%";
}
$lplot[$lplotct]->SetLabels($xlabels, 1.0);
$graph->Add($lplot[$lplotct]);
break;
case "STACKEDBAR":
case "BAR":
$lplot[$lplotct] = new BarPlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
$lplot[$lplotct]->SetWidth(0.8);
//$lplot[$lplotct]->SetWeight(5);
if ($v["fillcolor"]) {
$lplot[$lplotct]->SetFillColor($v["fillcolor"]);
}
if ($v["legend"]) {
$lplot[$lplotct]->SetLegend($v["legend"]);
}
$graph->Add($lplot[$lplotct]);
break;
case "LINE":
default:
if (count($v["data"]) == 1) {
$v["data"][] = 0;
}
$lplot[$lplotct] = new LinePlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
//$lplot[$lplotct]->SetWeight(5);
if ($v["fillcolor"]) {
$lplot[$lplotct]->SetFillColor($v["fillcolor"]);
}
if ($v["legend"]) {
$lplot[$lplotct]->SetLegend($v["legend"]);
}
$graph->Add($lplot[$lplotct]);
break;
}
$lplotct++;
}
$graph->title->Set($this->title_actual);
$graph->xaxis->title->Set($this->xtitle_actual);
$graph->yaxis->title->Set($this->ytitle_actual);
$graph->xgrid->SetColor($this->xgridcolor_actual);
$graph->ygrid->SetColor($this->ygridcolor_actual);
switch ($this->xgriddisplay_actual) {
case "all":
$graph->xgrid->Show(true, true);
break;
case "major":
$graph->xgrid->Show(true, false);
break;
case "minor":
//.........这里部分代码省略.........
示例9: ejecutarGrafico
function ejecutarGrafico($value_criteria, $date_start, $date_end)
{
global $arrLang;
$data_graph = leerDatosGrafico($value_criteria, $date_start, $date_end);
if (count($data_graph["values"]) > 0) {
// Create the Pie Graph.
$graph = new PieGraph(630, 220, "auto");
$graph->SetMarginColor('#fafafa');
$graph->SetFrame(true, '#999999');
$graph->legend->SetFillColor("#fafafa");
$graph->legend->SetColor("#444444", "#999999");
$graph->legend->SetShadow('gray@0.6', 4);
// Set A title for the plot
$graph->title->Set(utf8_decode($data_graph["title"]));
$graph->title->SetColor("#444444");
$graph->legend->Pos(0.1, 0.2);
// Create 3D pie plot
$p1 = new PiePlot3d($data_graph["values"]);
$p1->SetCenter(0.4);
$p1->SetSize(100);
// Adjust projection angle
$p1->SetAngle(60);
// Adjsut angle for first slice
$p1->SetStartAngle(45);
// Display the slice values
$p1->value->SetColor("black");
// Add colored edges to the 3D pie
// NOTE: You can't have exploded slices with edges!
$p1->SetEdge("black");
$p1->SetLegends($data_graph["legend"]);
$graph->Add($p1);
$graph->Stroke();
} else {
$graph = new CanvasGraph(630, 220, "auto");
$title = new Text(utf8_decode($data_graph["title"]));
$title->ParagraphAlign('center');
$title->SetFont(FF_FONT2, FS_BOLD);
$title->SetMargin(3);
$title->SetAlign('center');
$title->Center(0, 630, 110);
$graph->AddText($title);
$t1 = new Text(utf8_decode($arrLang["No records found"]));
$t1->SetBox("white", "black", true);
$t1->ParagraphAlign("center");
$t1->SetColor("black");
$graph->AddText($t1);
$graph->img->SetColor('navy');
$graph->img->SetTextAlign('center', 'bottom');
$graph->img->Rectangle(0, 0, 629, 219);
$graph->Stroke();
/*
//no hay datos - por ahora muestro una imagen en blanco con mensaje no records found
header('Content-type: image/png');
$titulo=utf8_decode($data_graph["title"]);
$im = imagecreate(630, 220);
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 10, 5, 5, $titulo. " - No records found", $text_color);
imagepng($im);
imagedestroy($im);*/
}
}
示例10: PiePlot
//$graph->subtitle->Set("(Excludes unknown)");
//$graph->subtitle->SetFont(FF_FONT0,FS_NORMAL);
$p1 = new PiePlot($data);
$p1->ExplodeSlice(0);
// make the largest slice explode out from the rest
#$p1->ExplodeAll();
//$p1->SetStartAngle(45);
if (imgdef($q['slices']['border'], 0) == 0) {
$p1->ShowBorder(false, false);
}
$p1->SetGuideLines();
$p1->SetCenter(0.35);
$p1->SetTheme(imgdef($q['slices']['theme'], 'earth'));
$p1->SetLegends($labels);
$p1->SetGuideLinesAdjust(1.1);
$graph->SetMarginColor(imgdef($q['frame']['margin'], '#d7d7d7'));
$graph->SetFrame(true, imgdef($q['frame']['color'], 'gray'), imgdef($q['frame']['width'], 1));
$graph->Add($p1);
/*
if (count($data)) {
$t = new Text("Not enough history\navailable\nto display piechart");
$t->SetPos(0.5,0.5,'center','center');
$t->SetFont(FF_FONT2, FS_BOLD);
$t->ParagraphAlign('centered');
$t->SetBox('lightyellow','black','gray');
$t->SetColor('orangered4');
// $graph->legend->Hide();
$graph->AddText($t);
}
*/
stdImgFooter($graph);
示例11: PieGraph
$data[] = $risk7;
$legend[] = _("Info") . " - {$risk7}";
$totalvulns += $risk7;
$colors[] = "#F0E68C";
}
//$data = array($risk1,$risk2,$risk3,$risk6,$risk7);
//$legend=array("Serious - $risk1","High - $risk2","Medium - $risk3","Low - $risk6","Info - $risk7");
//$totalvulns=$risk1+$risk2+$risk3+$risk6+$risk7;
if ($totalvulns > 0) {
$graph = new PieGraph(450, 200, "auto");
$graph->SetAntiAliasing();
//$graph->SetShadow();
$graph->title->Set(gettext("Vulnerabilities Found") . " - {$totalvulns}");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
if (intval($w) == 1) {
$graph->SetMarginColor('#FAFAFA');
$graph->legend->SetShadow('#fafafa', 0);
//$graph->legend->SetFillColor('#fafafa');
$graph->legend->SetFrameWeight(0);
} else {
if (intval($w) == 2) {
$graph->SetMarginColor('#FFFFFF');
$graph->legend->SetShadow('#FFFFFF', 0);
$graph->legend->SetFillColor('#FFFFFF');
$graph->legend->SetFrameWeight(0);
}
}
$p1 = new PiePlot3D($data);
$graph->SetFrame(false, '#ffffff');
$p1->SetSize(0.5);
$p1->SetStartAngle(290);
示例12: grafico_distribucion_tipo_resp
public function grafico_distribucion_tipo_resp($id_asignacionprueba)
{
require_once APPPATH . '/libraries/JpGraph/jpgraph_pie.php';
$this->rendimiento_global($id_asignacionprueba);
$data_circ = array($this->totalcorrectas, $this->totalincorrectas, $this->totalomitidas);
$columnas_circ = array('Correctas', 'Incorrectas', 'Omitidas');
$graph_circ = new PieGraph(400, 320);
$graph_circ->title->Set("Distribución por Tipo de Respuesta");
$graph_circ->SetMarginColor("#fff");
$graph_circ->SetFrame(true, '#fff', 1);
$graph_circ->SetBox(false);
$p1 = new PiePlot($data_circ);
$p1->ExplodeSlice(0);
$p1->SetCenter(0.5);
//$p1->SetLegends('Correctas','Incorrectas','Omitidas');
$p1->SetLegends($columnas_circ);
// No border
$p1->ShowBorder(false);
$graph_circ->legend->SetPos(0.1, 0.996, 'left', 'bottom');
$graph_circ->legend->SetFrameWeight(1);
$p1->SetGuideLines(true, false);
$p1->SetGuideLinesAdjust(1.5);
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->SetSliceColors(array('#1d71b8', '#ea1d25', 'orange'));
$graph_circ->Add($p1);
$graph_circ->Stroke(_IMG_HANDLER);
global $img_graf_dist_resp;
$this->img_graf_dist_resp = "assets/images/graf_dist_resp.jpg";
$graph_circ->img->Stream($this->img_graf_dist_resp);
/*
$graph_circ->img->Headers();
$graph_circ->img->Stream();
*/
}
示例13: create_graph
public function create_graph($width = 600, $height = 200, $data, $title, $xaxis, $yaxis, $type = "bar")
{
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
require_once 'jpgraph/jpgraph_bar.php';
require_once 'jpgraph/jpgraph_pie.php';
// Create a graph instance
if ($type == "bar" || $type == "line") {
$graph = new Graph($width, $height);
} else {
if ($type == "pie") {
$graph = new PieGraph($width, $height);
}
}
// Specify what scale we want to use,
// int = integer scale for the X-axis
// int = integer scale for the Y-axis
$graph->SetScale('intint');
$graph->SetMarginColor("lightblue:1.1");
$graph->SetShadow();
$graph->SetMargin(60, 20, 10, 40);
// Box around plotarea
$graph->SetBox();
// No frame around the image
$graph->SetFrame(false);
// Setup a title for the graph
$graph->title->Set($title);
$graph->title->SetMargin(8);
$graph->title->SetColor("darkred");
// Setup the X and Y grid
$graph->ygrid->SetFill(true, '#DDDDDD@0.5', '#BBBBBB@0.5');
$graph->ygrid->SetLineStyle('dashed');
$graph->ygrid->SetColor('gray');
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle('dashed');
$graph->xgrid->SetColor('gray');
// Setup titles and X-axis labels, if it's array, first row is title
if (is_array($xaxis)) {
$graph->xaxis->title->Set($xaxis[0]);
$xaxis = array_slice($xaxis, 1, count($xaxis) - 1);
$graph->xaxis->SetTickLabels($xaxis);
} else {
$graph->xaxis->title->Set($xaxis);
}
// no array, just show name
// Setup Y-axis title
$graph->yaxis->title->SetMargin(10);
$graph->yaxis->title->Set($yaxis);
if ($type == "bar") {
$plot = new BarPlot($data);
$plot->SetWidth(0.6);
$fcol = '#440000';
$tcol = '#FF9090';
$plot->SetFillGradient("navy:0.9", "navy:1.85", GRAD_LEFT_REFLECTION);
//$plot->SetColor("black");
// Set line weigth to 0 so that there are no border
// around each bar
$plot->SetWeight(0);
// Add the plot to the graph
$graph->Add($plot);
} else {
if ($type == "line") {
$plot = new LinePlot($data);
$plot->SetFillColor('skyblue@0.5');
$plot->SetColor('navy@0.7');
$plot->mark->SetType(MARK_SQUARE);
$plot->mark->SetColor('blue@0.5');
$plot->mark->SetFillColor('lightblue');
$plot->mark->SetSize(5);
// Add the plot to the graph
$graph->Add($plot);
} else {
if ($type == "pie") {
$plot = new PiePlot($data);
$plot->SetCenter(0.5, 0.55);
$plot->SetSize(0.2);
// Enable and set policy for guide-lines
$plot->SetGuideLines();
$plot->SetGuideLinesAdjust(1.4);
// Setup the labels
$plot->SetLabelType(PIE_VALUE_PER);
$plot->value->Show();
//$plot->value->SetFont(FF_ARIAL,FS_NORMAL,9);
$plot->value->SetFormat('%2.1f%%');
$plot->ExplodeSlice(1);
$plot->SetGuideLines(true);
$graph->SetMarginColor("white");
$plot->SetLegends($xaxis);
// Add the plot to the graph
$graph->Add($plot);
} else {
die($type . " is not known graph type");
}
}
}
// Display the graph
$fn = strtolower($title);
$fn = str_replace(" ", "", $fn);
$filename_relative = "site/web_app/images/dynamic/{$fn}.jpg";
$filename_full = __DIR__ . "/" . $filename_relative;
//.........这里部分代码省略.........
示例14: die
case 'wins_in_game':
if (!isset($_GET['map_id'])) {
die('No map id given');
}
require_once 'core/jpgraph/jpgraph_pie.php';
// Get data
$wins = $db->GetRow("SELECT mapstat_alien_wins,\n mapstat_human_wins,\n mapstat_ties + mapstat_draws AS ties\n FROM map_stats WHERE mapstat_id = ?", array($_GET['map_id']));
if ($wins['mapstat_alien_wins'] + $wins['mapstat_human_wins'] + $wins['ties'] > 0) {
$data = array($wins['mapstat_alien_wins'], $wins['mapstat_human_wins'], $wins['ties']);
} else {
$data = array(0, 0, 1);
}
// Build graph
$g = new PieGraph(200, 120);
$g->SetMargin(30, 30, 10, 25);
$g->SetMarginColor('#22262a');
$g->SetColor('#22262a');
$g->SetFrame(true, array(0, 0, 0), 0);
$g->SetBox(false);
// Build plot
$p1 = new PiePlot($data);
$p1->SetCenter(40, 60);
$p1->SetSliceColors(array('#CC0000', '#0055FF', '#888888'));
$p1->value->show(false);
$legends = array('Aliens (%d%%)', 'Humans (%d%%)', 'Tied (%d%%)');
$p1->SetLegends($legends);
$g->legend->SetShadow(false);
$g->legend->SetAbsPos(10, 60, 'right', 'center');
// Stroke
$g->Add($p1);
$g->Stroke();
示例15: array
require "../../constantes.php";
require "../../conexion.php";
$datos_genero = array();
$datos_puntaje = array();
$generos = "SELECT SUM(visitas),genero FROM juegos RIGHT JOIN genero_juego ON(juegos.id_genero=genero_juego.id_genero) GROUP BY genero\n";
$resultado_genero = mysql_query($generos) or die("Error" . $generos);
while ($array_generos = mysql_fetch_array($resultado_genero)) {
array_push($datos_genero, $array_generos['genero']);
array_push($datos_puntaje, $array_generos['0']);
}
//print_r($datos_genero);
//print_r($datos_puntaje);
//$data = array(40,60,21,33);
$graph = new PieGraph(450, 200, "auto");
$graph->img->SetAntiAliasing();
$graph->SetMarginColor('gray');
//$graph->SetShadow();
// Setup margin and titles
$graph->title->Set("Cantidad de visitas según género");
$p1 = new PiePlot3D($datos_puntaje);
$p1->SetSize(0.35);
$p1->SetCenter(0.5);
// Setup slice labels and move them into the plot
$p1->value->SetFont(FF_FONT1, FS_BOLD);
$p1->value->SetColor("black");
$p1->SetLabelPos(0.2);
//$nombres=array("pepe","luis","miguel","alberto");
$p1->SetLegends($datos_genero);
// Explode all slices
$p1->ExplodeAll();
$graph->Add($p1);