本文整理汇总了PHP中PiePlot::SetSize方法的典型用法代码示例。如果您正苦于以下问题:PHP PiePlot::SetSize方法的具体用法?PHP PiePlot::SetSize怎么用?PHP PiePlot::SetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PiePlot
的用法示例。
在下文中一共展示了PiePlot::SetSize方法的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: addSinglePlot
public function addSinglePlot($data, $x = 0.5, $y = 0.5, $title = null)
{
$plot = new PiePlot(array_values($data));
$plot->SetSize($this->plot_size);
$plot->SetCenter($x, $y);
$plot->setLabelPos(0.6);
//$plot->setLegends(array_keys($data));
if ($title != null) {
$plot->title->set($title);
}
$this->grapher->Add($plot);
}
示例3: 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");
}
示例4: 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();
}
示例5: 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;
}
示例6: getColors
if (strlen($lastTLD)) {
getColors($colors, $count, $index);
}
// reset the counter
$count = 0;
$lastTLD = $tld;
}
$count++;
}
if (strlen($lastTLD)) {
getColors($colors, $count, $index);
}
$graph = new PieGraph($width, $height);
$graph->SetFrame(false);
$graph->SetAntiAliasing();
$pie = new PiePlot($values);
// set the actual labels for the wedges
$pie->SetLabels($labels, 1.1);
if (count($colors)) {
$pie->SetSliceColors($colors);
}
// set other options
$pie->SetGuideLines(true, true, true);
$graph->title->SetFont(FF_FONT2, FS_BOLD);
$graph->title->Set($chartType);
$pie->ShowBorder(true, true);
$pie->SetSize(0.25);
$graph->Add($pie);
$graph->img->SetExpired(false);
$graph->Stroke();
}
示例7: print_graph
//.........这里部分代码省略.........
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);
if ($labels[0]) {
示例8: PieGraph
if (@$_REQUEST["type"] == "pie") {
// A new graph
$graph = new PieGraph(500, 300, "auto");
// The pie plot
$plot = new PiePlot($plots);
$plot->SetTheme('pastel');
// Move center of pie to the left to make better room
// for the legend
$plot->SetCenter(0.26, 0.55);
// Label font and color setup
$plot->SetFont(FF_FONT1, FS_BOLD);
$plot->SetFontColor("black");
// Use percentages
$plot->SetLabelType(0);
// Size of pie in fraction of the width of the graph
$plot->SetSize(0.3);
// Legends
$plot->SetLegends($labels);
$graph->legend->SetFont(FF_FONT1);
$graph->legend->Pos(0.06, 0.27);
} else {
// bar chart
$plot = new BarPlot($plots);
$plot->showValue(true);
$plot->SetValueFont(FF_FONT2, FS_NORMAL, 9);
//$plot->setLegend("Issues");
// figure out the best size for this graph.
$width = 75;
if (count($labels) > 3) {
foreach ($labels as $label) {
$label_width = imagefontwidth(FF_FONT1) * strlen($label) + 15;
示例9: _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);
}
}
}
示例10: PieGraph
/// A new pie graph
$graph = new PieGraph(400, 200, "auto");
$graph->SetScale('textint');
$logtype = tr("by_logtype");
// 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);
示例11: PiePlot
$p1 = new PiePlot($data);
$p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May"));
$p1->SetSize($size);
$p1->SetCenter(0.25, 0.32);
$p1->value->SetFont(FF_FONT0);
$p1->title->Set("2001");
$p2 = new PiePlot($data);
$p2->SetSize($size);
$p2->SetCenter(0.65, 0.32);
$p2->value->SetFont(FF_FONT0);
$p2->title->Set("2002");
$p3 = new PiePlot($data);
$p3->SetSize($size);
$p3->SetCenter(0.25, 0.75);
$p3->value->SetFont(FF_FONT0);
$p3->title->Set("2003");
$p4 = new PiePlot($data);
$p4->SetSize($size);
$p4->SetCenter(0.65, 0.75);
$p4->value->SetFont(FF_FONT0);
$p4->title->Set("2004");
$graph->Add($p1);
$graph->Add($p2);
$graph->Add($p3);
$graph->Add($p4);
$graph->Stroke();
?>
示例12: generateLog
public function generateLog($winner = false)
{
$gameid = strtotime('now');
$template = file_get_contents('data/log.html');
$fp = fopen(sprintf('logs/log_%d.html', $gameid), 'a');
$htplayers = array();
foreach ($this->players as $pl) {
$htplayers[] = sprintf('<li>%s</li>', htmlspecialchars(parent::playerName($pl)));
}
$players = implode("\n", $htplayers);
if ($winner) {
$data = sprintf("After %d hands played, the player <strong>%s</strong> won the total pot of <strong>\$%0.2f</strong>", $this->game, parent::playerName($winner), $winner->money);
} else {
$htplayers = array();
foreach ($this->players as $pl) {
$htplayers[] = sprintf('<li>%s ($%0.2f)</li>', htmlspecialchars(parent::playerName($pl)), $pl->money);
}
$htplayers = implode("\n", $htplayers);
$data = sprintf("After %d hands no winner was determined a summary of each individual player's money follows:<ol>%s</ol>", $this->game, $htplayers);
}
$template = str_replace("{players}", $players, $template);
$template = str_replace("{gameid}", $gameid, $template);
$template = str_replace("{winner}", $data, $template);
$template = str_replace("{version}", parent::$version, $template);
$template = str_replace("{date}", date('d-m-Y h:i', $gameid), $template);
$template = str_replace("{startmoney}", sprintf('%0.2f', $this->playermoney), $template);
$template = str_replace("{bigblind}", sprintf('%0.2f', $this->bigblind), $template);
$template = str_replace("{smallblind}", sprintf('%0.2f', $this->smallblind), $template);
$template = str_replace("{maxgames}", $this->totalgames, $template);
$template = str_replace("{winner}", $data, $template, $template);
fputs($fp, $template);
fclose($fp);
require_once 'data/jpgraph.php';
require_once 'data/jpgraph_line.php';
$width = 900;
$height = 300;
$graph = new Graph($width, $height);
$graph->img->SetMargin(40, 40, 40, 40);
$graph->SetShadow();
$graph->setScale('intlin');
$graph->title->Set('Amount of money per player, per hand');
$graph->xaxis->title->Set('Hand');
$graph->yaxis->title->Set('Money');
foreach ($this->moneylog as $id => $data) {
$p = $this->players[$id];
$lineplot = new LinePlot($data);
$lineplot->setweight($id);
$lineplot->SetLegend(parent::playerName($p));
$graph->add($lineplot);
}
$graph->stroke(sprintf('logs/playermoney_%d.jpg', $gameid));
// Pie graph, showing checks, folds, bets, wins, calls and raises
require_once "data/jpgraph_pie.php";
// Create the Pie Graph.
$height = ceil(count($this->players) / 2) * 440;
$graph = new PieGraph($width, $height);
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("Moves per user");
// Create plots
$size = 0.2;
$x = array(0.25, 0.75);
$y = 220;
$i = 1;
$legend = array("Check", "Call", "Bet", "Raise", "Fold");
foreach ($this->players as $id => $player) {
$plot = new PiePlot(array($player->checks, $player->calls, $player->bets, $player->raises, $player->folds));
if ($player->id == 1) {
$plot->SetLegends($legend);
}
$plot->SetLabelType(PIE_VALUE_ADJPERCENTAGE);
$plot->SetSize($size);
$plot->SetCenter($x[$i - 1], $y);
if ($i == 2) {
$i = 0;
$y += 420;
}
$i++;
$plot->title->Set(parent::playerName($player));
$graph->add($plot);
}
$graph->stroke(sprintf('logs/playermoves_%d.jpg', $gameid));
// Bargraph containing each player's wins
$height = 70 * count($this->players);
require_once "data/jpgraph_bar.php";
$graph = new Graph($width, $height);
$graph->SetScale('textlin');
$graph->SetShadow();
$lbl = array();
$data = array();
foreach ($this->players as $pl) {
$lbl[] = parent::PlayerName($pl);
$data[] = $pl->wins;
}
$top = 60;
$bottom = 30;
$left = 80;
$right = 30;
$graph->Set90AndMargin($left, $right, $top, $bottom);
$graph->xaxis->SetTickLabels($lbl);
//.........这里部分代码省略.........
示例13: eval
$p2_data = eval("return Array(" . stripslashes($_GET['p2_data']) . ");");
# Create the Pie Graph.
$graph = new PieGraph(700, 250);
# Set A title for the plot
$graph->title->Set($graph_title);
$graph->title->SetFont(FF_FONT2, FS_BOLD);
# Create
$size = 0.25;
$p1 = new PiePlot($p1_data);
$p1->SetTheme($p1_theme);
$p1->SetSize($size);
$p1->SetCenter(0.2, 0.6);
$p1->SetLegends($legend);
$p1->title->Set($p1_title);
$p2 = new PiePlot($p2_data);
$p2->SetTheme($p2_theme);
//Sets the colour scheme defined in jpgraph_pie.php
#$p2->SetTheme("pca"); //Sets the colour scheme defined in jpgraph_pie.php
$p2->SetSize($size);
$p2->SetCenter(0.6, 0.6);
$p2->title->Set($p2_title);
$graph->legend->Pos(0.01, 0.25, "right", "center");
$graph->Add($p1);
$graph->Add($p2);
$graph->Stroke();
# ------------------------------------
# $Log: pie_chart_2_image.php,v $
# Revision 1.1.1.1 2005/11/30 23:01:26 gth2
# importing initial version - gth
#
# ------------------------------------
示例14: 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;
//.........这里部分代码省略.........
示例15: 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();