本文整理汇总了PHP中PieGraph::SetFrame方法的典型用法代码示例。如果您正苦于以下问题:PHP PieGraph::SetFrame方法的具体用法?PHP PieGraph::SetFrame怎么用?PHP PieGraph::SetFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PieGraph
的用法示例。
在下文中一共展示了PieGraph::SetFrame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowPie
/**
* Show 3D Pie graph
*/
function ShowPie(&$legend, &$value)
{
$graph = new PieGraph(330, 200, "auto");
$graph->SetFrame(false);
//$graph->title->Set("A simple 3D Pie plot");
//$graph->title->SetFont(FF_FONT1,FS_BOLD);
$p1 = new PiePlot3D($value);
$p1->ExplodeSlice(1);
$p1->SetCenter(0.45);
$p1->SetLegends($legend);
$graph->legend->SetPos(0.01, 0.01, 'right', 'top');
$graph->Add($p1);
$graph->Stroke();
}
示例2: PieChart
function PieChart($w, $h, $title, $data, $dataL, $output)
{
$graph = new PieGraph($w, $h, "auto");
$graph->SetFrame(false);
$graph->SetShadow(false);
$graph->title->Set($title);
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$p1 = new PiePlot3D($data);
$p1->SetAngle(20);
$p1->SetSize(0.5);
$p1->SetCenter(0.45);
$p1->SetLegends($dataL);
$graph->Add($p1);
$graph->Stroke($output);
}
示例3: 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;
}
示例4: dansguardian_buildGraph_week
function dansguardian_buildGraph_week(){
include_once(dirname(__FILE__).'/listener.graphs.php');
$sql="SELECT COUNT( sitename ) AS tcount ,TYPE FROM `dansguardian_events` WHERE YEARWEEK( zDate ) = YEARWEEK( NOW( ) ) GROUP BY TYPE ORDER BY tcount DESC LIMIT 0 , 30";
if(isset($_GET["dansguardian-stats-query"])){return dansguardian_buildGraph_by_type();}
$md5=md5($sql);
$q=new mysql();
$results=$q->QUERY_SQL($sql,'artica_events');
$html="<table style='width:100%'>";
while ($ligne = mysql_fetch_array($results)) {
if($ligne["TYPE"]<>null){
$data[]=$ligne["tcount"];
$labels[]=$ligne["TYPE"];
$jsa="javascript:ShowGraphDansGuardianDetails('{$ligne["TYPE"]}','week');";
$html=$html . "<tr " . CellRollOver().">
<td width=1%><img src='img/fw_bold.gif'>
<td><strong style='font-size:11px'>{$ligne["tcount"]}</td>
<td><strong style='font-size:11px'><a href='#' OnClick=\"$jsa\">{$ligne["TYPE"]}</a></td>
</tr>
";
$js[]="$jsa";
}
}
$html=$html."</table>";
if (!is_array($data)){
die("<center>".ICON_DANSGUARDIAN_STATISTICS()."</center>");
}
$tpl=new templates();
$p1 = new PiePlot3D($data);
$p1->SetSize(.4);
$p1->SetAngle(75);
$p1->SetCSIMTargets($js,$labels);
$p1->SetCenter(0.3,0.5);
$p1->ExplodeAll(10);
$p1->SetLegends($labels);
//$p1->SetSliceColors(array('red','blue','green','navy','orange'));
$graph = new PieGraph(470,350,'auto');
$graph->Add($p1);
$graph->title->Set("Week");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->legend->Pos(0,0,'right','top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLineWeight(0);
//$graph->legend->SetLayout(LEGEND_HOR); //hori
$graph->legend->SetColor('black');
$graph->legend->SetShadow("white",0);
$graph->SetFrame(false);
if(function_exists("imageantialias")){$graph->img->SetAntiAliasing();}
$mapName = 'MapName';
$imgMap = $graph->GetHTMLImageMap($mapName);
$graph->Stroke("ressources/logs/$md5.png");
$html= "
<table style='width:100%'>
<tr>
<td valign='top'>
$imgMap
".RoundedLightWhite("
<img src='ressources/logs/$md5.png' alt='graph' ismap usemap='#$mapName' border='0'>")."
</td>
<td valign='top'>".RoundedLightWhite($html)."</td>
</tr>
</table>
";
return $html;
}
示例5: CanvasGraph
function PIE_graph($module, $method, $type, $start, $extra_fields)
{
global $C_translate, $C_auth;
include_once PATH_CORE . 'validate.inc.php';
$dt = new CORE_validate();
include PATH_GRAPH . "jpgraph.php";
####################################################################
### Check if 'search' is authorized for this account
####################################################################
# check the validation for this function
if ($C_auth->auth_method_by_name($module, 'search')) {
# validate this file exists, and include it.
if (file_exists(PATH_MODULES . '/' . $module . '/' . $module . '.inc.php')) {
include_once PATH_MODULES . '/' . $module . '/' . $module . '.inc.php';
} else {
### Not exist!
$error = $C_translate->translate('module_non_existant', '', '');
}
} else {
### Not auth
$error = $C_translate->translate('module_non_auth', '', '');
}
if (isset($error)) {
include PATH_GRAPH . "jpgraph_canvas.php";
// Create the graph.
$graph = new CanvasGraph(460, 55, "auto");
$t1 = new Text($error);
$t1->Pos(0.2, 0.5);
$t1->SetOrientation("h");
$t1->SetBox("white", "black", 'gray');
$t1->SetFont(FF_FONT1, FS_NORMAL);
$t1->SetColor("black");
$graph->AddText($t1);
$graph->Stroke();
exit;
}
# initialize the module, if it has not already been initialized
$eval = '$' . $module . ' = new ' . $module . '; ';
$eval .= '$this_Obj = $' . $module . ';';
eval($eval);
# run the function
$array = call_user_func(array($module, $method), $start_str, $end_str, $constraint_array, $default_array, $extra_fields);
include PATH_GRAPH . "jpgraph_pie.php";
include PATH_GRAPH . "jpgraph_pie3d.php";
$data = $array['data'];
$legends = $array['legends'];
// Create the Pie Graph.
$graph = new PieGraph(500, 250, "auto");
$graph->SetScale("textlin");
$graph->SetMarginColor('#F9F9F9');
$graph->SetFrame(true, '#FFFFFF', 0);
$graph->SetColor('#F9F9F9');
// Create pie plot
$p1 = new PiePlot3d($data);
$p1->SetTheme("water");
$p1->SetCenter(0.4);
$p1->SetAngle(30);
$p1->value->SetFont(FF_FONT1, FS_NORMAL, 8);
$p1->SetLegends($legends);
// Explode the larges slice:
$largest = 0;
for ($i = 0; $i < count($data); $i++) {
if ($data[$i] > $largest) {
$largest = $data[$i];
$explode = $i;
}
}
if ($explode) {
$p1->ExplodeSlice($explode);
}
$graph->Add($p1);
$graph->Stroke();
}
示例6: pie_chart
public function pie_chart($piedata, $legentdata, $title)
{
require_once 'Examples/jpgraph/jpgraph.php';
require_once 'Examples/jpgraph/jpgraph_pie.php';
require_once 'Examples/jpgraph/jpgraph_pie3d.php';
$graph = new PieGraph(800, 450);
$graph->SetShadow();
$graph->title->SetFont(FF_SIMSUN, FS_BOLD, 12);
// 设置中文字体
$graph->title->Set($title . "饼状图");
$graph->SetFrame(false);
$p1 = new PiePlot3D($piedata);
$p1->SetSize(0.4);
$p1->SetCenter(0.3);
$p1->SetLegends($legentdata);
$p1->SetLabelMargin(10);
$graph->legend->SetFont(FF_SIMSUN, FS_NORMAL);
$graph->legend->Pos(0.03, 0.18, 'right', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(2);
$graph->legend->SetVColMargin(0);
$graph->Add($p1);
$graph->SetImgFormat('png', 90);
$graph->Stroke();
}
示例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: createCookieGraph
private function createCookieGraph($xdata, $ytitle)
{
// Create the graph.
$graph = new PieGraph($this->width, $this->height, "auto");
$graph->title->SetFont(FF_FONT1, FS_NORMAL, 10);
$graph->SetFrame(false);
if ($this->shadow) {
$graph->SetShadow();
}
$p1 = new PiePlot($xdata);
// second group negative
$p1->SetLegends($this->ydata1);
$p1->SetCenter(0.3);
$p1->SetTheme("earth");
//color for negative prologiq "#cc00cc"
$p1->value->SetFont(FF_FONT1, FS_NORMAL, 10);
$graph->title->Set($ytitle);
// ... and add it to the graph
$graph->Add($p1);
return $graph;
}
示例9: array
<?php
// content="text/plain; charset=utf-8"
// Example of pie with center circle
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
// Some data
$data = array(50, 28, 25, 27, 31, 20);
// A new pie graph
$piegraph = new PieGraph(400, 320);
$n = count($data);
// Number of slices
// No border around graph
$piegraph->SetFrame(false);
// Setup title
$piegraph->title->Set("CSIM Center Pie plot");
$piegraph->title->SetFont(FF_ARIAL, FS_BOLD, 18);
$piegraph->title->SetMargin(8);
// Add a little bit more margin from the top
// Create the pie plot
$p1 = new PiePlotC($data);
// Set the radius of pie (as fraction of image size)
$p1->SetSize(0.32);
// Label font and color setup
$p1->value->SetFont(FF_ARIAL, FS_BOLD, 11);
$p1->value->SetColor('white');
// Setup the title on the center circle
$p1->midtitle->Set("Distribution\n2008 H1");
$p1->midtitle->SetFont(FF_ARIAL, FS_NORMAL, 12);
// Set color for mid circle
$p1->SetMidColor('yellow');
示例10: displayGraph
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
}
//*****************************************//
// ***** ***** ***** ***** * * //
// * * * * * * * * * //
// * *** ***** ***** ***** ***** //
// * * * * * * * * * //
// ***** * * * * * * * //
//*****************************************//
// L I N E P L O T
if (sizeof($G_YDATAS) >= 1) {
// true no funciona porque cada cadena u otro valor que se retorne es valor "valido o verdadero"
// y equivale a true, entonces para diferenciarlo verdaderamente se compara con 'true'
$str = checkAttributes($G_TITLE, $G_TYPE, $G_LABEL_Y, $_MSJ_ERROR, $_MSJ_NOTHING);
if ($str != 'true') {
showError($str, $G_SIZE);
return;
}
if ($G_TYPE == 'lineplot') {
$graph = new Graph($G_SIZE[0], $G_SIZE[1], "auto");
if ($G_SHADOW) {
$graph->SetShadow();
}
$graph->SetScale($G_SCALE);
$graph->SetMarginColor($G_COLOR);
$graph->title->Set($G_TITLE);
$graph->SetFrame(true, '#999999');
$graph->img->SetMargin($G_MARGIN[0], $G_MARGIN[1], $G_MARGIN[2], $G_MARGIN[3]);
$graph->img->SetAntiAliasing();
$graph->xaxis->SetLabelFormatCallback("CallBack");
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->title->Set($G_LABEL[0]);
$graph->yaxis->title->Set($G_LABEL[1]);
$graph->xgrid->Show();
$graph->legend->SetFillColor("#fafafa");
$graph->legend->Pos($G_LEYEND_POS[0], $G_LEYEND_POS[1], "right", "center");
$graph->legend->SetColumns($G_LEYEND_NUM_COLUMN);
$graph->legend->SetColor("#444444", "#999999");
$arr_lineplot = array();
foreach ($G_YDATAS as $num => $yDatas) {
$lineplot = new LinePlot($yDatas);
if ($G_ARR_STEP[$num] == true) {
$lineplot->SetStepStyle();
}
if ($G_ARR_FILL_COLOR[$num] == true) {
$lineplot->SetFillColor($G_ARR_COLOR[$num]);
}
$lineplot->SetColor($G_ARR_COLOR[$num]);
$lineplot->SetWeight($G_WEIGHT);
$lineplot->SetLegend($G_ARR_LEYEND[$num]);
$arr_lineplot[] = $lineplot;
}
foreach ($arr_lineplot as $num => $yDatas) {
$graph->Add($yDatas);
}
if (sizeof($xData) > 100) {
$graph->xaxis->SetTextTickInterval((int) (sizeof($xData) / 10));
}
$graph->Stroke();
示例11: graficar_pastel
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();
}
}
示例12:
$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);
$p1->SetAngle(50);
$p1->SetCenter(0.35);
$p1->SetLegends($legend);
//$colors=array("#C835ED", "red", "orange", "green", "#eeeeee");
//$colors=array("#C835ED", "red", "orange", "#FFD700", "#F0E68C");
$p1->SetSliceColors($colors);
$p1->ExplodeAll(8);
//$dplot[0]->SetFillColor("blue");
//$dplot[1]->SetFillColor("green");
//$dplot[2]->SetFillColor("navy");
//$dplot[3]->SetFillColor("orange");
//$dplot[4]->SetFillColor("magenta");
//$dplot[5]->SetFillColor("yellow");
示例13: 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();
*/
}
示例14: PiePlot
//$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);
$graph->Stroke();
示例15: 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;
//.........这里部分代码省略.........