本文整理汇总了PHP中Graph::SetMargin方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::SetMargin方法的具体用法?PHP Graph::SetMargin怎么用?PHP Graph::SetMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::SetMargin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function conf__grafico(toba_ei_grafico $grafico)
{
if (isset($this->datos)) {
$datos = array();
$leyendas = array();
foreach ($this->datos as $value) {
$datos[] = $value['resultado'];
$leyendas[] = $value['codc_uacad'];
}
}
require_once toba_dir() . '/php/3ros/jpgraph/jpgraph.php';
require_once toba_dir() . '/php/3ros/jpgraph/jpgraph_bar.php';
// Setup a basic graph context with some generous margins to be able
// to fit the legend
$canvas = new Graph(900, 300);
$canvas->SetMargin(100, 140, 60, 40);
$canvas->title->Set('Cr�dito Disponible');
//$canvas->title->SetFont(FF_ARIAL,FS_BOLD,14);
// For contour plots it is custom to use a box style ofr the axis
$canvas->legend->SetPos(0.05, 0.5, 'right', 'center');
$canvas->SetScale('intint');
//$canvas->SetAxisStyle(AXSTYLE_BOXOUT);
//$canvas->xgrid->Show();
$canvas->ygrid->Show();
$canvas->xaxis->SetTickLabels($leyendas);
// A simple contour plot with default arguments (e.g. 10 isobar lines)
$cp = new BarPlot($datos);
$cp->SetColor("#B0C4DE");
$cp->SetFillColor("#B0C4DE");
$cp->SetLegend("Resultado");
$canvas->Add($cp);
// Con esta llamada informamos al gr�fico cu�l es el gr�fico que se tiene
// que dibujar
$grafico->conf()->canvas__set($canvas);
}
示例2: array
/**
* Para el tipo de gráfico 'otro' hay que especificar todo lo referente a
* jpgraph. Desde la inclusión de los archivos necesarios hasta la instanciación
* de todas las componentes que esta necesita para generar un gráfico.
* Lo único que hay que hacer es 'avisarle' al gráfico de toba cuál es el
* canvas que se tiene que dibujar. Todo el resto es legal y bonito
*
* @param toba_ei_grafico $grafico
*/
function conf__grafico(toba_ei_grafico $grafico)
{
require_once toba_dir() . '/php/3ros/jpgraph/jpgraph.php';
require_once toba_dir() . '/php/3ros/jpgraph/jpgraph_contour.php';
$data = array(array(0.5, 1.1, 1.5, 1, 2.0, 3, 3, 2, 1, 0.1), array(1.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 1, 4), array(0.9, 2.0, 2.1, 3, 6.0, 7, 3, 2, 1, 1.4), array(1.0, 1.5, 3.0, 4, 6.0, 5, 2, 1.5, 1, 2), array(0.8, 2.0, 3.0, 3, 4.0, 4, 3, 2.4, 2, 3), array(0.6, 1.1, 1.5, 1, 4.0, 3.5, 3, 2, 3, 4), array(9.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 2.7, 4), array(9.800000000000001, 9.0, 3.0, 3, 5.5, 6, 3, 2, 1, 1.4), array(9.0, 1.5, 3.0, 4, 6.0, 5, 2, 1, 0.5, 0.2));
// Setup a basic graph context with some generous margins to be able
// to fit the legend
$canvas = new Graph(650, 300);
$canvas->SetMargin(40, 140, 60, 40);
$canvas->title->Set('Uso avanzado de la librería');
$canvas->title->SetFont(FF_ARIAL, FS_BOLD, 14);
// For contour plots it is custom to use a box style ofr the axis
$canvas->legend->SetPos(0.05, 0.5, 'right', 'center');
$canvas->SetScale('intint');
$canvas->SetAxisStyle(AXSTYLE_BOXOUT);
$canvas->xgrid->Show();
$canvas->ygrid->Show();
// A simple contour plot with default arguments (e.g. 10 isobar lines)
$cp = new ContourPlot($data);
// Display the legend
$cp->ShowLegend();
// Make the isobar lines slightly thicker
$cp->SetLineWeight(2);
$canvas->Add($cp);
// Con esta llamada informamos al gráfico cuál es el gráfico que se tiene
// que dibujar
$grafico->conf()->canvas__set($canvas);
}
示例3: lineChart
public static function lineChart($data1, $data2, $legends)
{
$graph = new Graph(600, 400);
$graph->SetScale('intlin');
$graph->SetShadow();
$graph->SetMargin(40, 20, 20, 40);
// $graph->title->Set('Calls per operator (June,July)');
// $graph->subtitle->Set('(March 12, 2008)');
// $graph->xaxis->title->Set('Operator');
// $graph->yaxis->title->Set('# of calls');
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetTickLabels($legends);
$lineplot = new LinePlot($data1);
$lineplot->SetWeight(4);
// Two pixel wide
// Add the plot to the graph
$graph->Add($lineplot);
// Create the second data series
$lineplot2 = new LinePlot($data2);
$lineplot2->SetWeight(4);
// Two pixel wide
$graph->Add($lineplot2);
$lineplot->SetLegend("This Year");
$lineplot2->SetLegend("Last Year");
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.4, 0.95, "center", "bottom");
return $graph->Stroke('../graph/compareLineChart.png');
}
示例4: barcart
function barcart($datay)
{
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_bar.php";
// Setup the graph.
$graph = new Graph(660, 250);
$graph->SetScale("textlin");
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->SetMargin(40, 30, 20, 40);
// Setup the titles
$graph->title->Set('NHR Registry');
$graph->xaxis->title->Set('X-title');
$graph->yaxis->title->Set('Y-title');
// Create the bar pot
$bplot = new BarPlot($datay);
// Adjust fill color
$bplot->SetFillColor('orange');
$graph->Add($bplot);
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
return $graph;
}
示例5: bar_task
public function bar_task($id)
{
$help = new Helper();
$issues = $help->searchIssues($id);
//foreach ($issues as $issue) {
# code...
// $issue->id
//}
//$iteration = Iterations::findOrFail($id);
//$idTmp = $iteration->id;
// $issues = Issue::where('iterationid','=', $idTmp)->get();
//$issues = $iteration->issues;
//$countIssues = sizeof($issues);
$countIssues = 0;
$dataEstimatedTime = array();
$dataRealTime = array();
$dataIterationName = array();
$countTODO = 0;
$countDOING = 0;
$countDONE = 0;
//$string_iterations = implode(";", $iterations);
JpGraph\JpGraph::load();
JpGraph\JpGraph::module('bar');
JpGraph\JpGraph::module('line');
$datay = array(12, 8, 19, 3, 10, 5);
// Create the graph. These two calls are always required
$graph = new Graph(300, 200);
$graph->SetScale('textlin');
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->SetMargin(40, 30, 20, 40);
// Create a bar pot
$bplot = new BarPlot($datay);
// Adjust fill color
$bplot->SetFillColor('orange');
$graph->Add($bplot);
// Setup the titles
$graph->title->Set('A basic bar graph ');
$graph->xaxis->title->Set('X-title');
$graph->yaxis->title->Set('Y-title');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
//$graph->Stroke();
//$response = Response::make(
// $graph->Stroke()
//);
// $response->header('content-type', 'image/png');
// return $response;
}
示例6: toPdf
public function toPdf($titulo, $consulta, $encabezado)
{
//$data1y = array(4,8,6);
$this->pdf->FPDF('P', 'mm', 'Letter');
$this->pdf->SetTopMargin(20);
$this->pdf->SetLeftMargin(20);
$this->pdf->AddPage();
$this->pdf->SetFillColor(255);
$this->pdf->SetFont('Arial', 'B', 16);
$this->pdf->Cell(180, 32, $titulo, 0, 0, 'C');
$this->pdf->SetFont('Arial', 'B', 13);
$this->pdf->Ln(26);
$this->pdf->Ln(15);
//$graph = new \Graph(270, 200, 'auto');
// Se define el array de datos
$datosy = array(25, 16, 24, 5, 8, 31);
// Creamos el grafico
$grafico = new \Graph(500, 250);
$grafico->SetScale('textlin');
// Ajustamos los margenes del grafico----- (left,right,top,bottom)
$grafico->SetMargin(40, 30, 30, 40);
// Creamos barras de datos a partir del array de datos
$bplot = new \BarPlot($datosy);
// Configuramos color de las barras
$bplot->SetFillColor('#479CC9');
//Añadimos barra de datos al grafico
$grafico->Add($bplot);
// Queremos mostrar el valor numerico de la barra
$bplot->value->Show();
// Configuracion de los titulos
$grafico->title->Set('Ingreso de paquetes');
$grafico->xaxis->title->Set('Meses');
$grafico->yaxis->title->Set('Ingresos ($)');
$grafico->title->SetFont(FF_FONT1, FS_BOLD);
$grafico->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$grafico->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$nombreGrafico = "Barras";
@unlink("{$nombreGrafico}.png");
// Se muestra el grafico
$grafico->Stroke("{$nombreGrafico}.png");
//img = $grafico->Stroke(_IMG_HANDLER);
//Aqui agrego la imagen que acabo de crear con jpgraph
$this->pdf->Image("{$nombreGrafico}.png", $this->pdf->GetX() + 20, $this->pdf->GetY(), 120, 90);
//$this->pdf->GDImage($img,50,50,110,70);
$this->pdf->Output();
return $this->pdf;
}
示例7: createSpline
function createSpline($ydata = "")
{
$xdata = array(2, 4, 6, 8, 10, 12, 14, 16);
if (!$ydata) {
$ydata = array(5, 1, 9, 6, 4, 3, 4, 2);
}
// Get the interpolated values by creating
// a new Spline object.
$spline = new Spline($xdata, $ydata);
// For the new data set we want 40 points to
// get a smooth curve.
list($newx, $newy) = $spline->Get(50);
// Create the graph
$g = new Graph(380, 300);
$g->SetMargin(30, 20, 40, 30);
//$g->title->Set("Natural cubic splines");
//$g->title->SetFont(FF_ARIAL,FS_NORMAL,12);
//$g->subtitle->Set('(Control points shown in red)');
//$g->subtitle->SetColor('darkred');
$g->SetMarginColor('lightblue');
//$g->img->SetAntiAliasing();
// We need a linlin scale since we provide both
// x and y coordinates for the data points.
$g->SetScale('linlin');
$xlable = array('', 'AA', 'AA', 'AB', 'AB', 'BB', 'BB', 'BC', 'BC', 'CC', 'CC', 'CD', 'CD', 'DD', 'DD', 'FF', 'FF', '');
// We want 1 decimal for the X-label
//$g -> xaxis -> SetLabelFormat('%d');
$g->xaxis->SetTickLabels($xlable);
// We use a scatterplot to illustrate the original
// contro points.
$splot = new ScatterPlot($ydata, $xdata);
//
$splot->mark->SetFillColor('red@0.3');
$splot->mark->SetColor('red@0.5');
// And a line plot to stroke the smooth curve we got
// from the original control points
$lplot = new LinePlot($newy, $newx);
$lplot->SetColor('navy');
// Add the plots to the graph and stroke
$g->Add($lplot);
$g->Add($splot);
$g->Stroke();
}
示例8: getGrafico
public function getGrafico()
{
$em = new EntityManager($_SESSION['project']['conection']);
$em->query($this->query);
$rows = $em->fetchResult();
$nRegistros = $em->numRows();
$em->desConecta();
unset($em);
foreach ($rows as $value) {
$this->datosY[] = $value[$this->columnaY];
$this->titulosX[] = $value[$this->columnaX];
}
$grafico = new Graph($this->ancho, $this->alto);
$grafico->SetScale('textlin');
// Ajustamos los margenes del grafico----- (left,right,top,bottom)
$grafico->SetMargin(40, 30, 30, 40);
// Creamos barras de datos a partir del array de datos
$bplot = new BarPlot($this->datosY);
// Configuramos color de las barras
$bplot->SetFillColor('#479CC9');
//Añadimos barra de datos al grafico
$grafico->Add($bplot);
// Queremos mostrar el valor numerico de la barra
$bplot->value->Show();
// Configuracion de los titulos
$grafico->title->Set($this->titulo);
$grafico->xaxis->title->Set($this->tituloX);
$grafico->yaxis->title->Set($this->tituloY);
$grafico->title->SetFont(FF_FONT1, FS_BOLD);
$grafico->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$grafico->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$grafico->xaxis->SetTickLabels($this->titulosX);
// Se generada el archivo con el gráfico
$archivo = "docs/docs" . $_SESSION['emp'] . "/tmp/" . md5(date('d-m-Y H:i:s')) . ".png";
$grafico->Stroke($archivo);
return $archivo;
}
示例9: Graph
$graph3->title->SetFont(FF_FONT1, FS_BOLD);
$graph3->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph3->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
// Setup the values that are displayed on top of each bar
$bplot3->value->Show();
// Must use TTF fonts if we want text at an arbitrary angle
$bplot3->value->SetFont(FF_FONT1, FS_BOLD);
$bplot3->value->SetAngle(0);
$bplot3->value->SetFormat('%d');
// Create the graph. These two calls are always required
$graph4 = new Graph(740, 200, 'auto');
$graph4->SetScale('textint', 0, max($y4) + max($y4) * 0.2, 0, 0);
// Add a drop shadow
$graph4->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph4->SetMargin(50, 30, 30, 40);
// Create a bar pot
$bplot4 = new BarPlot($y4);
// Adjust fill color
$bplot4->SetFillColor('purple1');
$graph4->Add($bplot4);
// Setup the titles
$descibe4 = iconv('UTF-8', 'ASCII//TRANSLIT', tr("octeam_stat_m_caches"));
$graph4->title->Set($descibe4);
$graph4->xaxis->title->Set(iconv('UTF-8', 'ASCII//TRANSLIT', tr('number_month')) . '2014/2015');
$graph4->xaxis->SetTickLabels($x4);
$graph4->yaxis->title->Set($ncaches);
$graph4->title->SetFont(FF_FONT1, FS_BOLD);
$graph4->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph4->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
// Setup the values that are displayed on top of each bar
示例10: elseif
} elseif ($value['var1'] == 'Enterprise-Image-Impact') {
$data4['value'][$value['var3'] - 1] = $value['var2'];
} elseif ($value['var1'] == 'Financial-Impact') {
$data5['value'][$value['var3'] - 1] = $value['var2'];
}
}
//
require_once 'ossim_conf.inc';
$conf = $GLOBALS["CONF"];
$jpgraph = $conf->get_conf("jpgraph_path");
require_once "{$jpgraph}/jpgraph.php";
require_once "{$jpgraph}/jpgraph_line.php";
// Setup the graph.
$graph = new Graph(600, 300, "auto");
$graph->SetScale("textlin");
$graph->SetMargin(100, 10, 20, 86);
$graph->SetMarginColor("#fafafa");
$graph->xaxis->SetTickLabels(array(_("Ene"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"), _("Jul"), _("Ago"), _("Sep"), _("Oct"), _("Nov"), _("Dic")));
$graph->SetColor("#fafafa");
$graph->SetFrame(true, '#fafafa', 0);
$dplot[0] = new LinePLot($data1['value']);
$dplot[1] = new LinePLot($data2['value']);
$dplot[2] = new LinePLot($data3['value']);
$dplot[3] = new LinePLot($data4['value']);
$dplot[4] = new LinePLot($data5['value']);
$dplot[0]->SetColor(COLOR1);
$dplot[0]->SetLegend('QoS-Impact');
$dplot[0]->mark->SetType(MARK_SQUARE);
$dplot[0]->mark->SetColor(COLOR1);
$dplot[0]->mark->SetFillColor(COLOR1);
//
示例11: array
<?php
include "../jpgraph.php";
include "../jpgraph_line.php";
$ydata = array(12, 17, 22, 19, 5, 15);
$graph = new Graph(270, 170);
$graph->SetMargin(30, 90, 30, 30);
$graph->SetScale("textlin");
$graph->img->SetAngle(90);
$graph->img->SetCenter(floor(270 / 2), floor(170 / 2));
$line = new LinePlot($ydata);
$line->SetLegend('2002');
$line->SetColor('darkred');
$line->SetWeight(2);
$graph->Add($line);
// Output graph
$graph->Stroke();
?>
示例12: array
<?php
// content="text/plain; charset=utf-8"
// Basic contour plot example
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_contour.php';
$data = array(array(12, 7, 3, 15), array(18, 5, 1, 9), array(13, 9, 5, 12), array(5, 3, 8, 9), array(1, 8, 5, 7));
// Basic contour graph
$graph = new Graph(350, 250);
$graph->SetScale('intint');
// Show axis on all sides
$graph->SetAxisStyle(AXSTYLE_BOXOUT);
// Adjust the margins to fit the margin
$graph->SetMargin(30, 100, 40, 30);
// Setup
$graph->title->Set('Basic contour plot with multiple axis');
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
// A simple contour plot with default arguments (e.g. 10 isobar lines)
$cp = new ContourPlot($data, 10, 1);
// Display the legend
$cp->ShowLegend();
$graph->Add($cp);
// ... and send the graph back to the browser
$graph->Stroke();
示例13: array
<?php
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
$datay = array(20, 10, 35, 5, 17, 35, 22);
// Setup the graph
$graph = new Graph(400, 200);
$graph->SetMargin(40, 40, 20, 30);
$graph->SetScale("intlin");
$graph->SetBox();
$graph->SetMarginColor('darkgreen@0.8');
// Setup a background gradient image
$graph->SetBackgroundGradient('darkred', 'yellow', GRAD_HOR, BGRAD_PLOT);
$graph->title->Set('Gradient filled line plot ex2');
$graph->yscale->SetAutoMin(0);
// Create the line
$p1 = new LinePlot($datay);
$p1->SetFillGradient('white', 'darkgreen');
$p1->SetStepStyle();
$graph->Add($p1);
// Output line
$graph->Stroke();
?>
示例14: array
}
include $jploc . "jpgraph.php";
include $jploc . "jpgraph_bar.php";
$clientrawextra = get_raw("{$hostloc}clientrawextra.txt");
$y = $clientrawextra['484'] + $clientrawextra['485'] + $clientrawextra['486'] + $clientrawextra['487'] + $clientrawextra['488'] + $clientrawextra['489'] + $clientrawextra['490'];
$y = $y / 10;
$y = array($y);
$datay = $y;
if ($rain_conv != 1) {
array_walk($datay, "MtoI");
}
// Setup the graph.
$graph = new Graph($xsize1, $ysize, "auto");
$graph->SetScale("textlin");
$graph->yscale->SetGrace(10);
$graph->SetMargin($lm1, $rm1, $tm1, $bm1);
$graph->SetShadow();
$graph->SetMarginColor("{$margincolour}");
//Setup Mian Title
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->title->Set("{$txt_7day}");
$graph->title->SetColor("{$textcolour}");
//Setup x axis
$graph->xaxis->SetColor("{$xtextcolour}");
$graph->xaxis->HideLabels(true);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->title->Set("{$txt_rain} ({$rain_unit})");
$graph->xaxis->title->SetColor("{$xtextcolour}");
// Setup y axis
$graph->yaxis->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->yaxis->SetColor("{$ytextcolour}");
示例15: LinePlot
$graph->SetMarginColor('white');
$graph->SetFrame(false);
$graph->SetBox(true);
$graph->title->Set('Example of combined graph');
$graph->title->SetFont(FF_ARIAL, FS_NORMAL, 14);
$graph->xaxis->SetTickPositions($tickPositions, $minTickPositions);
$graph->xaxis->SetLabelFormatString('My', true);
$graph->xgrid->Show();
$p1 = new LinePlot($datay, $datax);
$graph->Add($p1);
//----------------------
// Setup the bar graph
//----------------------
$graph2 = new Graph($w, 110);
$graph2->SetScale('linlin', 0, 0, $xmin, $xmax);
$graph2->SetMargin($lm, $rm, 5, 10);
$graph2->SetMarginColor('white');
$graph2->SetFrame(false);
$graph2->SetBox(true);
$graph2->xgrid->Show();
$graph2->xaxis->SetTickPositions($tickPositions, $minTickPositions);
$graph2->xaxis->SetLabelFormatString('My', true);
$graph2->xaxis->SetPos('max');
$graph2->xaxis->HideLabels();
$graph2->xaxis->SetTickSide(SIDE_DOWN);
$b1 = new BarPlot($datay2, $datax);
$b1->SetFillColor('teal');
$b1->SetColor('teal:1.2');
$graph2->Add($b1);
//-----------------------
// Create a multigraph