本文整理汇总了PHP中PiePlot::SetLegends方法的典型用法代码示例。如果您正苦于以下问题:PHP PiePlot::SetLegends方法的具体用法?PHP PiePlot::SetLegends怎么用?PHP PiePlot::SetLegends使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PiePlot
的用法示例。
在下文中一共展示了PiePlot::SetLegends方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPlot
public function createPlot()
{
$size = '0.25';
$plot = new \PiePlot($this->data);
$plot->SetLegends($this->legends);
$plot->SetSize($size);
$plot->SetCenter(0.25, 0.32);
$plot->ShowBorder();
$plot->SetColor('black');
$this->grafico->add($plot);
}
示例2: graficarPDF
function graficarPDF()
{
$solo_registrados = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m01_registrada IS NOT NULL AND pasantia.m02_aceptada IS NULL AND periodo.activo = TRUE");
$solo_aceptadas = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m02_aceptada IS NOT NULL AND pasantia.m03_numero_asignado IS NULL AND periodo.activo = TRUE");
$solo_numero_asignado = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m03_numero_asignado IS NOT NULL AND pasantia.m04_sellada IS NULL AND periodo.activo = TRUE");
$solo_sellada = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m04_sellada IS NOT NULL AND pasantia.m05_entrego_copia IS NULL AND periodo.activo = TRUE");
$solo_entrego_copia = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m05_entrego_copia IS NOT NULL AND pasantia.m06_entrego_borrador IS NULL AND periodo.activo = TRUE");
$solo_entrego_borrador = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m06_entrego_borrador IS NOT NULL AND pasantia.m07_retiro_borrador IS NULL AND periodo.activo = TRUE");
$solo_retiro_borrador = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m07_retiro_borrador IS NOT NULL AND pasantia.m08_entrega_final IS NULL AND periodo.activo = TRUE");
$finalizaron = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m08_entrega_final IS NOT NULL AND periodo.activo = TRUE");
$this->MultiCell(200, 5, utf8_decode("\nRepública Bolivariana de Venezuela\nUniversidad del Zulia\nFacultad Experimental de Ciencias\nDivisión de Programas Especiales\nSistema de Pasantías\n\n\n\nEstadísticas de Hitos"), 0, "C", 0);
//GENERAR LA TABLA
$this->SetXY(5, 65);
$this->SetFont('Arial', 'B', 12);
$this->SetWidths(array(27, 25, 25, 25, 25, 25, 25, 25));
$this->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C'));
$this->Row(array("Registradas", "Aceptadas", "Numero Asignado", "Selladas", "Entrega Copia", "Entrega Borrador", "Retiro Borrador", "Finalizaron"));
$this->SetX(5);
$this->SetFont('Arial', '', 12);
$this->SetWidths(array(27, 25, 25, 25, 25, 25, 25, 25));
$this->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C'));
$this->Row(array("{$solo_registrados}", "{$solo_aceptadas}", "{$solo_numero_asignado}", "{$solo_sellada}", "{$solo_entrego_copia}", "{$solo_entrego_borrador}", "{$solo_retiro_borrador}", "{$finalizaron}"));
$data = array($solo_registrados, $solo_aceptadas, $solo_numero_asignado, $solo_sellada, $solo_entrego_copia, $solo_entrego_borrador, $solo_retiro_borrador, $finalizaron);
//aqui va la cantidad que llevará cada parte del grafico
$graph = new PieGraph(640, 480);
//tamaño de la letra del titulo y la leyenda
$graph->SetShadow();
$db = new PgDB();
//QUERY PARA EL PERIDO ACTIVO
$queryPer = "SELECT tipo, anio FROM periodo WHERE activo = TRUE";
$recoPer = pg_query($queryPer);
$rowPer = pg_fetch_array($recoPer);
$graph->title->Set(utf8_decode("REPORTE TOTAL\n{$rowPer['tipo']} - {$rowPer['anio']}"));
$graph->title->SetFont(FF_FONT2, FS_BOLD);
$p1 = new PiePlot($data);
$p1->value->Show(true);
$p1->SetLegends(array("Registradas", "Aceptadas", "Numeros Asignados", "Selladas", "Entrega de Copias", "Entrega de Borrador", "Retiro de Borrador", "Finalizaron"));
//la leyenda del gráfico
$p1->SetSize(0.3);
//el radio del gráfico
//$p1->SetAngle(45); //setear el angulo
$graph->Add($p1);
$graph->Stroke("asd.png");
$this->Image("asd.png", -15, 85, 240, 180);
// x, y, ancho, altura.
$this->Image("logotipo.jpg", 20, 12, -280);
unlink("asd.png");
}
示例3: plot
function plot()
{
$this->_setValues();
// Create the Pie Graph.
$graph = new PieGraph(500, 300);
$graph->SetShadow();
// Create
$p1 = new PiePlot($this->_data);
// Set A title for the plot
$p1->SetLegends($this->_legends);
$p1->SetSize(0.3);
$p1->SetCenter(0.28, 0.5);
$txt = new Text("Most Visited Titles", 0.15, 0.05);
$txt->SetFont(FONT1_BOLD);
$graph->Add($p1);
$graph->AddText($txt);
$graph->Stroke();
}
示例4: graph_pie_chart
function graph_pie_chart($graph_title, $graph_theme, $legend_array, $data_array, $xcoord, $ycoord)
{
//unlink("Images/piecharts2/pie_chart_image.png");
print "{$graph_title}";
print "{$graph_theme}";
print "{$legend_array}";
print "{$data_array}";
print "{$xcoord}";
print "{$ycoord}";
print "{$legend_array['2']}";
$graph = new PieGraph($xcoord, $ycoord);
$graph->title->Set($graph_title);
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$pie = new PiePlot($data_array);
$pie->SetLegends($legend_array);
$pie->SetTheme($graph_theme);
//Sets the colour scheme defined in jpgraph_pie.php
$graph->Add($pie);
$graph->Stroke("images/piecharts2/pie_chart_image.png");
}
示例5: buildGraph
/**
* Builds pie graph
*/
function buildGraph()
{
$this->graph = new Chart_Pie($this->width, $this->height);
// title setup
$this->graph->title->Set($this->title);
if (is_null($this->description)) {
$this->description = "";
}
$this->graph->subtitle->Set($this->description);
if (is_array($this->data) && array_sum($this->data) > 0) {
$p = new PiePlot($this->data);
$p->setSliceColors($this->graph->getThemedColors());
$p->SetCenter(0.4, 0.6);
$p->SetLegends($this->legend);
$p->value->HideZero();
$p->value->SetFont($this->graph->getFont(), FS_NORMAL, 8);
$p->value->SetColor($this->graph->getMainColor());
$p->value->SetMargin(0);
$this->graph->Add($p);
}
return $this->graph;
}
示例6: 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;
}
示例7: PieGraph
$graph = new PieGraph(350, 200);
$graph->SetShadow();
// Setup title
$graph->title->Set("Example of pie plot with absolute labels");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// The pie plot
$p1 = new PiePlot($data);
// Move center of pie to the left to make better room
// for the legend
$p1->SetCenter(0.35, 0.5);
// No border
$p1->ShowBorder(false);
// Label font and color setup
$p1->value->SetFont(FF_FONT1, FS_BOLD);
$p1->value->SetColor("darkred");
// Use absolute values (type==1)
$p1->SetLabelType(PIE_VALUE_ABS);
// Label format
$p1->value->SetFormat("\$%d");
$p1->value->Show();
// Size of pie in fraction of the width of the graph
$p1->SetSize(0.3);
// Legends
$p1->SetLegends(array("May (\$%d)", "June (\$%d)", "July (\$%d)", "Aug (\$%d)"));
$graph->legend->Pos(0.05, 0.15);
$graph->Add($p1);
$graph->Stroke();
?>
示例8: array
if (empty($limit)) {
$limit = 10;
}
$hids = new Host_ids("", "", "", "", "", "", "", "", "", "");
$list = $hids->Events($limit);
$data = $legend = array();
foreach ($list as $l) {
$legend[] = $l[0];
$data[] = $l[1];
}
$conf = $GLOBALS["CONF"];
$jpgraph = $conf->get_conf("jpgraph_path");
include "{$jpgraph}/jpgraph.php";
include "{$jpgraph}/jpgraph_pie.php";
// Setup graph
$graph = new PieGraph(400, 240, "auto");
$graph->SetShadow();
// Setup graph title
$graph->title->Set("HIDS Events");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create pie plot
$p1 = new PiePlot($data);
//$p1->SetFont(FF_VERDANA,FS_BOLD);
//$p1->SetFontColor("darkred");
$p1->SetSize(0.2);
$p1->SetCenter(0.35);
$p1->SetLegends($legend);
//$p1->SetStartAngle(M_PI/8);
//$p1->ExplodeSlice(0);
$graph->Add($p1);
$graph->Stroke();
示例9: print_graph
//.........这里部分代码省略.........
$yaxislblmargin = $pmb - 15;
if ($longestlabel && !$overlap) {
// if legend showing
$pmr = $longestlabel * 5 + 40;
}
$graph->legend->Pos(0.02, 0.1, 'right', 'top');
}
}
}
}
}
// DRAW THE GRAPHS
if ($type == 'pie') {
$p1 = new PiePlot($data[0]);
$p1->SetSliceColors($colours);
if ($show_values) {
$p1->value->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
if ($percent) {
$p1->SetLabelType(PIE_VALUE_PERADJ);
} else {
$p1->SetLabelType(PIE_VALUE_ABS);
}
if ($percent || $show_percent) {
$p1->value->SetFormat("%d%%");
} else {
$p1->value->SetFormat("%s");
}
// Enable and set policy for guide-lines. Make labels line up vertically
$p1->SetGuideLines(true);
$p1->SetGuideLinesAdjust(1.5);
} else {
$p1->value->Show(false);
}
$p1->SetLegends($legends);
$p1->SetSize($psize);
$p1->SetCenter($pposx, $pposy);
if ($labels[0]) {
$graph->subtitle->Set($labels[0]);
$graph->subtitle->SetMargin(10 * $k);
$graph->subtitle->SetFont(FF_USERFONT, FS_BOLD, 11 * $k);
$graph->subtitle->SetColor("black");
}
$graph->Add($p1);
} else {
if ($type == 'pie3d') {
$p1 = new PiePlot3d($data[0]);
$p1->SetSliceColors($colours);
if ($show_values) {
$p1->value->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
if ($percent) {
$p1->SetLabelType(PIE_VALUE_PERADJ);
} else {
$p1->SetLabelType(PIE_VALUE_ABS);
}
if ($percent || $show_percent) {
$p1->value->SetFormat("%d%%");
} else {
$p1->value->SetFormat("%s");
}
} else {
$p1->value->Show(false);
}
$p1->SetLegends($legends);
$p1->SetEdge();
$p1->SetSize($psize);
$p1->SetCenter($pposx, $pposy);
示例10: _renderPieChart
private function _renderPieChart($groupCount, $dimensions = '2d', $doughnut = False, $multiplePlots = False)
{
require_once 'jpgraph_pie.php';
if ($dimensions == '3d') {
require_once 'jpgraph_pie3d.php';
}
$this->_renderPiePlotArea($doughnut);
$iLimit = $multiplePlots ? $groupCount : 1;
for ($groupID = 0; $groupID < $iLimit; ++$groupID) {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
if ($groupID == 0) {
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
}
}
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
// For pie charts, we only display the first series: doughnut charts generally display all series
$jLimit = $multiplePlots ? $seriesCount : 1;
// Loop through each data series in turn
for ($j = 0; $j < $jLimit; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
// Fill in any missing values in the $dataValues array
$testCurrentIndex = 0;
foreach ($dataValues as $k => $dataValue) {
while ($k != $testCurrentIndex) {
$dataValues[$testCurrentIndex] = null;
++$testCurrentIndex;
}
++$testCurrentIndex;
}
if ($dimensions == '3d') {
$seriesPlot = new PiePlot3D($dataValues);
} else {
if ($doughnut) {
$seriesPlot = new PiePlotC($dataValues);
} else {
$seriesPlot = new PiePlot($dataValues);
}
}
if ($multiplePlots) {
$seriesPlot->SetSize(($jLimit - $j) / ($jLimit * 4));
}
if ($doughnut) {
$seriesPlot->SetMidColor('white');
}
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
if (count($datasetLabels) > 0) {
$seriesPlot->SetLabels(array_fill(0, count($datasetLabels), ''));
}
if ($dimensions != '3d') {
$seriesPlot->SetGuideLines(false);
}
if ($j == 0) {
if ($exploded) {
$seriesPlot->ExplodeAll();
}
$seriesPlot->SetLegends($datasetLabels);
}
$this->_graph->Add($seriesPlot);
}
}
}
示例11: main
//.........这里部分代码省略.........
# $graph->title->SetFont(FF_FONT1,FS_BOLD);
# $p1 = new PiePlot(array_values($data));
# $p1->SetLegends(array_keys($data));
# $p1->SetCenter(0.4);
# $graph->Add($p1);
# array_push($graphs, $graph);
/*
CAS distribution
*/
# $query = "SELECT SUM(bh) AS 'bh', SUM(si) AS 'si', SUM(ki) AS 'ki' FROM match_data";
# $result = mysql_query($query);
# $o = (object) mysql_fetch_assoc($result);
# $data = array("BH ($o->bh)" => $o->bh, "SI ($o->si)" => $o->si, "Ki ($o->ki)" => $o->ki);
# $graph = new PieGraph($opts['xdim'],$opts['ydim'],"auto");
# $graph->SetShadow();
# $graph->title->Set('Current CAS distribution');
# $graph->title->SetFont(FF_FONT1,FS_BOLD);
# $p1 = new PiePlot(array_values($data));
# $p1->SetLegends(array_keys($data));
# $p1->SetCenter(0.4);
# $graph->Add($p1);
# array_push($graphs, $graph);
} else {
/********************
* Current CAS
********************/
if (!$cmp_id && $o->mv_cas != 0) {
$data = array("BH ({$o->mv_bh})" => $o->mv_bh, "SI ({$o->mv_si})" => $o->mv_si, "Ki ({$o->mv_ki})" => $o->mv_ki);
$graph = new PieGraph($opts['xdim'], $opts['ydim'], "auto");
$graph->SetShadow();
$graph->title->Set('Current CAS distribution');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$p1 = new PiePlot(array_values($data));
$p1->SetLegends(array_keys($data));
$p1->SetCenter(0.4);
$graph->Add($p1);
array_push($graphs, $graph);
}
/********************
* BH, SI and Ki
********************/
$queries = array();
foreach (range(0, SG_MULTIBAR_HIST_LENGTH) as $i) {
$range = "(\n (YEAR(date_played) = YEAR(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)))\n AND\n (MONTH(date_played) = MONTH(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)))\n )";
# m$i = minus/negative $i months from present month.
array_push($queries, "SUM(IF({$range}, bh, 0)) AS 'BH_m{$i}'");
array_push($queries, "SUM(IF({$range}, si, 0)) AS 'SI_m{$i}'");
array_push($queries, "SUM(IF({$range}, ki, 0)) AS 'Ki_m{$i}'");
array_push($queries, "YEAR(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)) AS 'yr_m{$i}'");
array_push($queries, "MONTH(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)) AS 'mn_m{$i}'");
}
$query = "SELECT " . implode(', ', $queries) . " FROM matches, match_data WHERE f_match_id = match_id AND {$where}";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$lengends = array('BH' => 'forestgreen', 'SI' => 'firebrick', 'Ki' => 'blue');
list($datasets, $labels) = SGraph::mbarsInputFormatter($lengends, $row);
array_push($graphs, SGraph::mbars($datasets, $labels, $lengends, "BH, SI and Ki distribution history", "Months", "Amount", $opts));
/********************
* CP & TD
********************/
$queries = array();
foreach (range(0, SG_MULTIBAR_HIST_LENGTH) as $i) {
$range = "(\n (YEAR(date_played) = YEAR(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)))\n AND\n (MONTH(date_played) = MONTH(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)))\n )";
# m$i = minus/negative $i months from present month.
array_push($queries, "SUM(IF({$range}, cp, 0)) AS 'CP_m{$i}'");
array_push($queries, "SUM(IF({$range}, td, 0)) AS 'TD_m{$i}'");
示例12: array
<?php
include "jpgraph.php";
include "jpgraph_pie.php";
// Some data
$data = array(38, 62);
// Create the Pie Graph. Note you may cach this by adding the
// ache file name as PieGraph(300,300,"SomCacheFileName")
$graph = new PieGraph(300, 200);
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("Example 1 Pie plot");
$graph->title->SetFont(FONT1_BOLD);
// Create graph
$p1 = new PiePlot($data);
$p1->SetLegends(array("Jan", "Feb"));
$graph->Add($p1);
// .. and finally stroke it
$graph->Stroke();
示例13: PiePlot
// Title setup
$graph->title->Set($logtype);
$graph->title->SetFont(FF_ARIAL, FS_NORMAL);
//$graph ->legend->Pos( 0.25,0.8,"right" ,"bottom");
// Setup the pie plot
$p1 = new PiePlot($y);
$p1->SetTheme("earth");
$p1->value->SetFormat("%d");
$p1->SetLabelType(PIE_VALUE_ABS);
$p1->SetSliceColors(array('chartreuse3', 'chocolate2', 'wheat1'));
// Adjust size and position of plot
$p1->SetSize(0.35);
$p1->SetCenter(0.25, 0.52);
$f = tr("found");
$dnf = tr("not_found");
$com = tr("comment");
// Setup slice labels and move them into the plot
$xx = array($f, $dnf, $com);
$p1->value->SetFont(FF_COURIER, FS_NORMAL);
$p1->value->SetColor("black");
$p1->SetLabelPos(0.65);
$p1->SetLegends($xx);
$graph->legend->SetFont(FF_ARIAL, FS_NORMAL);
// Explode all slices
//$p1->ExplodeAll(10);
// Finally add the plot
$graph->Add($p1);
$graph->SetShadow();
// ... and stroke it
$graph->Stroke();
}
示例14: stripslashes
<?php
date_default_timezone_set('America/Bogota');
require_once "lib/jpgraph/src/jpgraph.php";
require_once "lib/jpgraph/src/jpgraph_pie.php";
// Se define el array de valores y el array de la leyenda
if (isset($_GET['datos']) && isset($_GET['textos'])) {
$d = stripslashes($_GET['datos']);
$datos = unserialize($d);
$t = stripslashes($_GET['textos']);
$textos = unserialize($t);
//$titulo = $_GET['titulo'];
//Se define el grafico
$grafico = new PieGraph(380, 200);
//Definimos el titulo
$grafico->title->Set("Grafica");
$grafico->title->SetFont(FF_FONT1, FS_BOLD);
//Aâ±adimos el titulo y la leyenda
$p1 = new PiePlot($datos);
$p1->SetLegends($textos);
$p1->SetCenter(0.2);
//Se muestra el grafico
$grafico->Add($p1);
$grafico->Stroke();
}
示例15: displayProjectProportionUsage
/**
*
* @param Integer $used
* @param Integer $total
*/
function displayProjectProportionUsage($used, $total)
{
$graph = new Chart_Pie(350, 250, "auto");
$data = array($used, $total - $used);
$usage = new PiePlot($data);
$usage->SetSliceColors(array('#44697D', '#ACBBA4'));
$usage->SetLegends(array("Used proportion", "Allowed quota"));
$graph->legend->SetPos(0.01, 0, 'right', 'top');
$graph->add($usage);
//graph display
$graph->stroke();
}