本文整理汇总了PHP中Graph::SetBox方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::SetBox方法的具体用法?PHP Graph::SetBox怎么用?PHP Graph::SetBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::SetBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGrafmayorcosto
public function getGrafmayorcosto()
{
JpGraph::module('bar');
$graph = new Graph(680, 300);
$graph->SetScale("textlin");
$graph->yscale->SetGrace(5);
$graph->SetBox(true);
$labels = array();
$valores = array();
foreach (Activo::where('id', '>', '0')->orderBy('costo', 'desc')->take(10)->get() as $activo) {
$labels[] = $activo->num_activo;
$valores[] = $activo->costo;
}
//titulo de la grafica
$graph->title->SetColor('black');
$graph->title->Set('Gráfica: Activos con Mayor Costo');
//valores de los labels en ambas axis y como se ubicaran
$graph->xaxis->SetTickLabels($labels);
$graph->xaxis->SetLabelAlign('center', 'top', 'center');
$graph->ygrid->SetFill(false);
$graph->yaxis->HideLabels(false);
$graph->yaxis->HideTicks(false, false);
//Fonts para las axis
$graph->xaxis->SetColor('black');
$graph->yaxis->SetColor('black');
//grafica de activos con mayor costo
$mayorCosto = new BarPlot($valores);
$mayorCosto->SetColor('white');
$mayorCosto->SetWidth(0.6);
//agrega la grafica generada a la instancia de la grafica
$graph->Add($mayorCosto);
//Despliega la grafica
$graph->Stroke();
}
示例2: build
public function build()
{
$path = APPPATH;
require_once $path . 'libraries/jpgraph/src/jpgraph.php';
require_once $path . 'libraries/jpgraph/src/jpgraph_bar.php';
// $datay = array(62, 105, 85, 50);
$datay = $this->parameters;
// Create the graph. These two calls are always required
// $graph = new Graph(350, 220, 'auto');
$graph = new Graph(350, 220, 'auto');
$graph->SetScale("textlin");
//$theme_class="DefaultTheme";
//$graph->SetTheme(new $theme_class());
// set major and minor tick positions manually
$graph->yaxis->SetTickPositions(array(0, 30, 60, 90, 120, 150), array(15, 45, 75, 105, 135));
$graph->SetBox(false);
//$graph->ygrid->SetColor('gray');
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('A', 'B', 'C', 'D'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
// Create the bar plots
// $b1plot = new BarPlot($datay);
$b1plot = new BarPlot($datay);
// ...and add it to the graPH
$graph->Add($b1plot);
$b1plot->SetColor("white");
$b1plot->SetFillGradient("#4B0082", "white", GRAD_LEFT_REFLECTION);
$b1plot->SetWidth(45);
$graph->title->Set("Bar Gradient(Left reflection)");
// Display the graph
$d['grafica'] = $graph->Stroke("jacobo.png");
$d['path'] = $path;
return $d;
}
示例3: graficarBarras
function graficarBarras()
{
require_once "jpgraph/src/jpgraph.php";
require_once "jpgraph/src/jpgraph_bar.php";
$datos = array($_GET['pos'], $_GET['neg']);
//Instancia del objeto del tipo Graph en donde como parametro
// se le pasan los valore de ancho y altura
$grafica = new Graph(400, 300);
$grafica->SetScale("textlin");
$grafica->SetBox(false);
//Nombre de las columnas
$columnas = array($_GET['lab1'], $_GET['lab2']);
$grafica->xaxis->SetTickLabels($columnas);
//Objeto del tipo BarPlot que se le enviara a la grafica y el cual
//recibe como parametros los datos a graficar
$barras = new BarPlot($datos);
$grafica->Add($barras);
//Color de los bordes
//Color de borde de las barras
$barras->SetColor("white");
//Color de relleno de las barras
$barras->SetFillColor("#4B0082");
//Ancho de las barras
$barras->SetWidth(45);
// $grafica->title->Set("Gráfica de Barras");
$grafica->title->SetFont(FF_TIMES, FS_ITALIC, 18);
$grafica->Stroke();
}
示例4: graphs
static function graphs($name, $close)
{
// Setup the graph
$graph = new Graph(1000, 653, 'auto');
$graph->SetScale("textlin");
$theme_class = new UniversalTheme();
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->SetFont(FF_FONT2, FS_BOLD, 20);
$graph->title->Set("Stock Performance History for " . $name);
$graph->SetBox(false);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
$graph->yaxis->title->SetFont(FF_FONT2, FS_BOLD, 20);
$graph->yaxis->title->Set('Close Price');
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickPositions(array(0, 20, 40, 61, 82, 103, 124, 143));
$graph->xaxis->SetTickLabels(array('Nov 2014', 'Dec 2014', 'Jan 2015', 'Feb 2015', 'March 2015', 'April 2015', 'May 2015', 'June 2015'));
$graph->xaxis->title->SetFont(FF_FONT2, FS_BOLD, 20);
$graph->xaxis->title->Set('Dates');
$graph->xgrid->SetColor('#E3E3E3');
// Create the first line
$p1 = new LinePlot($close);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$graph->legend->SetFrameWeight(2);
// Output line
$graph->Stroke();
}
示例5: HistogramShow
public static function HistogramShow($data_x, $data_y, $max_y, $graph_title = "", $x_title = "", $y_title = "")
{
//柱状图生成函数
$graph = new Graph(LENHSIZE, HEISIZE, "auto");
//创建画布
// $graph->SetScale('textlin'); // 设置y轴的值 这里是0到60
$graph->SetScale("textlin");
$graph->yscale->ticks->Set($max_y / 2, 1);
$graph->yaxis->HideTicks(true, true);
$graph->yaxis->scale->SetGrace(20);
$graph->SetBox(false);
//创建画布阴影
$graph->SetShadow();
$graph->img->SetMargin(LEFT, RIGHT, UP, DOWN);
// $graph->img->SetMargin(40,30,30,50);//设置显示区左、右、上、下距边线的距离,单位为像素
$bplot = new BarPlot($data_y);
//创建一个矩形的对象
$graph->InitializeFrameAndMargin();
$graph->Add($bplot);
//将柱形图添加到图像中
$bplot->SetColor(BAR_COLOR);
$bplot->SetFillColor(BAR_COLOR);
$bplot->SetWidth(25);
$graph->title->Set($graph_title);
//创建标题"借出次数统计结果(按借出次数由由低到高排列)"
$graph->xaxis->SetTickLabels($data_x);
//设置X坐标轴文字
$bplot->SetShadow(SHADOW);
//设置阴影效果
$bplot->value->Show();
if ($max_y <= 1) {
$bplot->value->SetFormat('%0.4f');
} else {
$bplot->value->SetFormat('%d');
//在柱形图中显示格式化的评选结果
}
$graph->xaxis->title->Set($x_title);
$graph->yaxis->title->Set($y_title);
// $graph->xaxis->SetTextTickInterval($y_title,0.2);
$graph->xaxis->title->setFont(FF_SIMSUN);
$graph->yaxis->title->setFont(FF_SIMSUN);
$graph->title->setFont(FF_SIMSUN, FS_BOLD, GRAGHSIZE);
//设置字体
$graph->xaxis->setFont(FF_SIMSUN, FS_BOLD, X_FONT);
//设置字体
$graph->xaxis->SetLabelAngle(45);
$num = rand(0, RAND);
$name = "Histogrm" . $num . ".png";
session_start();
$_SESSION["name"] = $name;
$graph->Stroke($name);
return $name;
}
示例6: array
function grafico_barra()
{
$data1y = array(47, 80, 40, 116);
$data2y = array(61, 30, 82, 105);
$data3y = array(115, 50, 70, 93);
// Create the graph. These two calls are always required
$graph = new Graph(350, 200, 'auto');
$graph->SetScale("textlin");
$theme_class = new UniversalTheme();
$graph->SetTheme($theme_class);
$graph->yaxis->SetTickPositions(array(0, 30, 60, 90, 120, 150), array(15, 45, 75, 105, 135));
$graph->SetBox(false);
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('A', 'B', 'C', 'D'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b2plot = new BarPlot($data2y);
$b3plot = new BarPlot($data3y);
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot, $b2plot, $b3plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$b1plot->SetColor("white");
$b1plot->SetFillColor("#cc1111");
$b2plot->SetColor("white");
$b2plot->SetFillColor("#11cccc");
$b3plot->SetColor("white");
$b3plot->SetFillColor("#1111cc");
$graph->title->Set("Bar Plots");
// Display the graph
$graph_temp_directory = 'temp';
// in the webroot (add directory to .htaccess exclude)
$graph_file_name = 'test.png';
$graph_file_location = $graph_temp_directory . '/' . $graph_file_name;
$graph->Stroke($graph_file_location);
// create the graph and write to file
$data['graph'] = $graph_file_location;
$this->load->view('supervisor/prueba', $data);
}
示例7: generateGraphbarrev
public function generateGraphbarrev($type)
{
// $type= "year";
if ($type == "year") {
$start = date("Y-");
$start .= "01-01 00-00-00";
$end = date("Y-");
$end .= "12-31 23-59-59";
} elseif ($type == "month") {
$start = date("Y-m-");
$start .= "01 00-00-00";
$end = date("Y-m-");
$end .= "31 23-59-59";
} elseif ($type == "day") {
$start = date("Y-m-d");
$start .= " 00-00-00";
$end = date("Y-m-d");
$end .= " 23-59-59";
} elseif ($type == "week") {
$date = date("Y-m-d");
}
//$this->load->database();
if ($type == "week") {
$sql = DB::select(DB::raw("SELECT `id` FROM `sales` WHERE YEARWEEK(`created_at`) = YEARWEEK('{$date}') AND `deleted` = '0' "));
} else {
$sql = DB::select(DB::raw("SELECT `id` FROM `sales` WHERE (`created_at` BETWEEN '{$start}' AND '{$end}') AND `deleted` = '0' "));
}
foreach ($sql as $row) {
$sales_id[] = $row->id;
}
if (!isset($sales_id)) {
$sales_id[] = 0;
$sales_id[] = 0;
}
$ids = join(',', $sales_id);
//$sql = "SELECT COUNT(sales_product.id) AS 'Count', item.name AS 'Name' FROM sales_product INNER JOIN item ON item.id = sales_product.product WHERE sales_product.sale_id IN ($ids) GROUP BY sales_product.product ORDER BY `Count` DESC";
$sql = DB::select(DB::raw("SELECT COUNT(sales_product.id) AS 'Count', item.name AS 'Name' FROM sales_product INNER JOIN item ON item.id = sales_product.product WHERE sales_product.sale_id IN ({$ids}) GROUP BY sales_product.product ORDER BY `Count` DESC"));
foreach ($sql as $row) {
$inq[] = $row->Count;
$leg[] = $row->Name;
}
if (!isset($inq)) {
$inq[] = 0;
$leg[] = "null";
}
if (sizeof($inq) > 5) {
$c = sizeof($inq) - 1;
$other = 0;
for ($x = 4; $x <= $c; $x++) {
$other = $other + $inq[$x];
unset($inq[$x]);
unset($leg[$x]);
}
$inq[4] = $other;
$leg[4] = "other";
}
$data1y = $inq;
echo public_path('plugins\\streaming\\protected\\start.php');
echo asset('asxcasx\\dsddsd');
// die();
// Create the graph. These two calls are always required
$graph = new \Graph(350, 250, 'auto');
$graph->SetScale("textlin");
$theme_class = new \UniversalTheme();
$graph->SetTheme($theme_class);
// $graph->yaxis->SetTickPositions(array(0,30,60,90,120,150), array(15,45,75,105,135));
$graph->SetBox(false);
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels($leg);
$graph->xaxis->title->Set('Products');
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
$graph->yaxis->title->Set('Sales');
// Create the bar plots
$b1plot = new \BarPlot($data1y);
// $b2plot = new BarPlot($data2y);
// $b3plot = new BarPlot($data3y);
// Create the grouped bar plot
// $gbplot = new GroupBarPlot(array($b1plot,$b2plot,$b3plot));
$gbplot = new \GroupBarPlot(array($b1plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$b1plot->SetColor("white");
$b1plot->SetFillColor("#6EDBFF");
$b1plot->SetWidth(45);
$gdImgHandler = $graph->Stroke(_IMG_HANDLER);
$fileName = "assets/tmp/" . $type . "_bar_rev.png";
$graph->img->Stream($fileName);
}
示例8: Init
/**
* Construct the graph
*
*/
private function Init()
{
// Setup limits for color indications
$lowx = $this->iXMin;
$highx = $this->iXMax;
$lowy = $this->iYMin;
$highy = $this->iYMax;
$width = $this->iWidth;
$height = $this->iHeight;
// Margins
$lm = 50;
$rm = 40;
$tm = 60;
$bm = 40;
if ($width <= 300 || $height <= 250) {
$labelsize = 8;
$lm = 25;
$rm = 25;
$tm = 45;
$bm = 25;
} elseif ($width <= 450 || $height <= 300) {
$labelsize = 8;
$lm = 30;
$rm = 30;
$tm = 50;
$bm = 30;
} elseif ($width <= 600 || $height <= 400) {
$labelsize = 9;
} else {
$labelsize = 11;
}
if ($this->iSubTitle == '') {
$tm -= $labelsize + 4;
}
$graph = new Graph($width, $height);
$graph->SetScale('intint', $lowy, $highy, $lowx, $highx);
$graph->SetMargin($lm, $rm, $tm, $bm);
$graph->SetMarginColor($this->iMarginColor[$this->iColorMap]);
$graph->SetClipping();
$graph->title->Set($this->iTitle);
$graph->subtitle->Set($this->iSubTitle);
$graph->title->SetFont(FF_ARIAL, FS_BOLD, $labelsize + 4);
$graph->subtitle->SetFont(FF_ARIAL, FS_BOLD, $labelsize + 1);
$graph->SetBox(true, 'black@0.3');
$graph->xaxis->SetFont(FF_ARIAL, FS_BOLD, $labelsize);
$graph->yaxis->SetFont(FF_ARIAL, FS_BOLD, $labelsize);
$graph->xaxis->scale->ticks->Set(CCBPGraph::TickStep, CCBPGraph::TickStep);
$graph->yaxis->scale->ticks->Set(CCBPGraph::TickStep, CCBPGraph::TickStep);
$graph->xaxis->HideZeroLabel();
$graph->yaxis->HideZeroLabel();
$graph->xaxis->SetLabelFormatString('%d%%');
$graph->yaxis->SetLabelFormatString('%d%%');
// For the x-axis we adjust the color so labels on the left of the Y-axis are in black
$n1 = floor(abs($this->iXMin / 25)) + 1;
$n2 = floor($this->iXMax / 25);
if ($this->iColorMap == 0) {
$xlcolors = array();
for ($i = 0; $i < $n1; ++$i) {
$xlcolors[$i] = 'black';
}
for ($i = 0; $i < $n2; ++$i) {
$xlcolors[$n1 + $i] = 'lightgray:1.5';
}
$graph->xaxis->SetColor('gray', $xlcolors);
$graph->yaxis->SetColor('gray', 'lightgray:1.5');
} else {
$graph->xaxis->SetColor('darkgray', 'darkgray:0.8');
$graph->yaxis->SetColor('darkgray', 'darkgray:0.8');
}
$graph->SetGridDepth(DEPTH_FRONT);
$graph->ygrid->SetColor('gray@0.6');
$graph->ygrid->SetLineStyle('dotted');
$graph->ygrid->Show();
$graph->xaxis->SetWeight(1);
$graph->yaxis->SetWeight(1);
$ytitle = new Text(CCBPGraph::YTitle, floor($lm * 0.75), ($height - $tm - $bm) / 2 + $tm);
#$ytitle->SetFont(FF_VERA,FS_BOLD,$labelsize+1);
$ytitle->SetAlign('right', 'center');
$ytitle->SetAngle(90);
$graph->Add($ytitle);
$xtitle = new Text(CCBPGraph::XTitle, ($width - $lm - $rm) / 2 + $lm, $height - 10);
#$xtitle->SetFont(FF_VERA,FS_BOLD,$labelsize);
$xtitle->SetAlign('center', 'bottom');
$graph->Add($xtitle);
$df = 'D j:S M, Y';
if ($width < 400) {
$df = 'D j:S M';
}
$time = new Text(date($df), $width - 10, $height - 10);
$time->SetAlign('right', 'bottom');
#$time->SetFont(FF_VERA,FS_NORMAL,$labelsize-1);
$time->SetColor('darkgray');
$graph->Add($time);
// Use an accumulated fille line graph to create the colored bands
$n = 3;
for ($i = 0; $i < $n; ++$i) {
//.........这里部分代码省略.........
示例9: create_graph_barplot
function create_graph_barplot($text, $datay, $width, $height)
{
$margex = 140;
$graph = new Graph($width, $height);
$tab_txt = explode('|', $text);
$txt = new Text($tab_txt[0]);
$txt->SetPos(0, $height - 40);
$txt->SetColor('red');
$txtb = new Text($tab_txt[1] . ' ' . $tab_txt[2] . ' ' . $tab_txt[3]);
$txtb->SetPos(0, $height / 2);
$graph->AddText($txt);
$graph->AddText($txtb);
$graph->SetScale('textlin', 0, max($datay));
$graph->SetBox();
$graph->xaxis->HideLabels();
$graph->yaxis->HideLabels();
$graph->yaxis->SetPos('max');
$graph->yaxis->SetTitle(max($datay), 'high');
$graph->yaxis->SetTitleMargin(15);
$graph->yaxis->SetTitleSide(SIDE_RIGHT);
$graph->xgrid->Show();
$graph->img->SetMargin($margex, 15, 1, 1);
$graph->SetFrame(true, 'black', 0);
$graph->ygrid->SetWeight(0, 0);
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTextTickInterval(12, 0);
$bplot = new BarPlot($datay);
$graph->Add($bplot);
return $graph;
}
示例10: mycallback
$numpoints = 50;
$k = 0.05;
// Create some data points
for ($i = 0; $i < $numpoints; ++$i) {
$datay[$i] = exp(-$k * $i) * cos(2 * M_PI / 10 * $i);
}
// A format callbakc function
function mycallback($l)
{
return sprintf("%02.2f", $l);
}
// Setup the basic parameters for the graph
$graph = new Graph(400, 200);
$graph->SetScale("intlin");
$graph->SetShadow();
$graph->SetBox();
$graph->title->Set("Impuls Example 3");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Set format callback for labels
$graph->yaxis->SetLabelFormatCallback("mycallback");
// Set X-axis at the minimum value of Y-axis (default will be at 0)
$graph->xaxis->SetPos("min");
// "min" will position the x-axis at the minimum value of the Y-axis
// Extend the margin for the labels on the Y-axis and reverse the direction
// of the ticks on the Y-axis
$graph->yaxis->SetLabelMargin(12);
$graph->xaxis->SetLabelMargin(6);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->xaxis->SetTickSide(SIDE_DOWN);
// Create a new impuls type scatter plot
$sp1 = new ScatterPlot($datay);
示例11: barVPlot
private function barVPlot($question, $datax, $datay, $width, $height)
{
include_once BASE . "jpgraph.php";
include_once BASE . "jpgraph_bar.php";
$tFontSize = 11;
$xFontSize = 6 + $height / $this->amountOfVariants / 30;
$maxX = 0;
foreach ($datax as $x) {
if (($t = strlen($x)) > $maxX) {
$maxX = $t;
}
}
for ($i = 0; $i < $this->amountOfVariants; $i++) {
$x =& $datax[$i];
if (($t = strlen($x)) >= MAXCHARSPERLINE) {
$index = strrpos(substr($x, 0, MAXCHARSPERLINE - 1), ' ');
if ($index === false) {
$index = MAXCHARSPERLINE - 3;
}
$x[$index] = "\n";
if ($t > $index + MAXCHARSPERLINE) {
$x = substr($x, 0, $index + MAXCHARSPERLINE - 3) . "...";
}
}
}
unset($x);
// Set the basic parame graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale("textlin", 0, 100);
//if (amountOfVariants>5) $xFontSize--;
$lm = 0;
foreach ($datax as $x) {
$linia = strtok($x, "\n");
while ($linia != '') {
$t = new Text($linia);
$t->SetFont(FF_COMIC, FS_NORMAL, $xFontSize);
$lineWidth = $t->GetWidth($graph->img);
if ($lineWidth > $lm) {
$lm = $lineWidth;
}
//echo $linia.$lineWidth."<BR>";
$linia = strtok("\n");
}
}
// Rotate graph 90 degrees and set margin
$graph->SetMargin(35, 20, 40, $lm + 15);
// Set white margin color
$graph->SetMarginColor('gray@0.95');
// Setup title
//$graph->title->Set($question);
//$graph->title->SetMargin(10);
//$graph->title->SetFont(FF_VERDANA, FS_BOLD, $tFontSize);
$graph->tabtitle->Set($question);
$graph->tabtitle->SetFont(FF_ARIAL, FS_BOLD, $tFontSize);
$tWidth = $graph->tabtitle->GetWidth($graph->img);
//if ($graph->title->GetWidth($graph->img)>$width) $graph->title->SetFont(FF_VERDANA, FS_BOLD, $tFontSize-2);
if ($tWidth > $width) {
$index = strrpos(substr($question, 0, ($len = strlen($question)) / 2 + 5), ' ');
//echo $index;
if ($index === false) {
$index = $len / 2 - 3;
}
$question[$index] = "\n";
$graph->tabtitle->Set($question);
$graph->tabtitle->SetFont(FF_ARIAL, FS_BOLD, $tFontSize -= 2);
}
// Setup X-axis
$graph->xaxis->SetFont(FF_COMIC, FS_NORMAL, $xFontSize);
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetColor('black');
$graph->xaxis->SetLabelAngle(80);
// Some extra margin looks nicer
$graph->xaxis->SetLabelMargin(10);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('center', 'top');
// Add some grace to y-axis so the bars doesn't go
// all the way to the end of the plot area
$graph->yaxis->scale->SetGrace(10);
//$graph->yaxis->SetPos('max');
//$graph->yaxis->SetLabelAlign('center', 'top');
//$graph->yaxis->SetLabelSide('SIDE_RIGHT');
$graph->yaxis->SetLabelFormat('%2d%%');
// Now create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.4);
// We want to display the value of each bar at the top
$bplot->value->Show();
$bplot->value->SetFont(FF_VERDANA, FS_NORMAL, $xFontSize);
//$bplot->SetShadow("black@0.1",2,2);
//$bplot->value->SetAlign('left','center');
$bplot->value->SetColor("black");
$bplot->value->SetFormat('%d%%');
//$bplot->SetValuePos('max');
//$graph->SetMarginColor('green');
// Box around plotarea
$graph->SetBox();
$graph->SetFrame(false);
// $graph->SetShadow();
// Setup the X and Y grid
$graph->ygrid->SetFill(true, '#DDDDDD@0.5', '#BBBBBB@0.5');
//.........这里部分代码省略.........
示例12: LinePlot
$graph->yaxis->SetLabelAngle(90);
$graph->yaxis->SetColor('blue');
$graph->yaxis->SetFont(FF_ARIAL, FS_NORMAL, 9);
$graph->yaxis->SetLabelMargin(0);
$graph->yaxis->scale->SetAutoMin(0);
$line = new LinePlot($data_winddirection, $xdata);
$line->SetStepStyle();
$line->SetColor('blue');
$graph->Add($line);
// Setup the wind speed graph
$graph2 = new Graph(WIND_WIDTH - 30, WIND_HEIGHT);
$graph2->SetScale('datlin');
$graph2->Set90AndMargin(5, 20, 60, 30);
$graph2->SetMarginColor(BKG_COLOR);
$graph2->SetFrame(true, 'white', 0);
$graph2->SetBox();
$graph2->title->Set('Windspeed');
$graph2->title->SetColor('red');
$graph2->title->SetFont(FF_ARIAL, FS_BOLD, 14);
$graph2->title->SetMargin(5);
$graph2->xaxis->HideLabels();
$graph2->xgrid->Show();
$graph2->yaxis->SetLabelAngle(90);
$graph2->yaxis->SetColor('red');
$graph2->yaxis->SetFont(FF_ARIAL, FS_NORMAL, 9);
$graph2->yaxis->SetLabelMargin(0);
$graph2->yaxis->scale->SetAutoMin(0);
$line2 = new LinePlot($data_windspeed, $xdata);
$line2->SetStepStyle();
$line2->SetColor('red');
$graph2->Add($line2);
示例13: tracerCourbeMoyennes
/**
*
* @param array $datax
* @param array $datay1 Moy de classe pour une matiere
* @param type $datay2 pourcentage de reussite
*/
function tracerCourbeMoyennes($datax, $datay1, $datay2)
{
// Setup the graph
$graph = new Graph(850, 400, 'auto');
$graph->SetMargin(30, 15, 50, 5);
$graph->SetMarginColor('black');
$graph->SetScale("linlin");
$graph->SetBox();
// Hide the frame around the graph
$graph->SetFrame(false);
// Setup title
#$graph->title->Set("Using Builtin PlotMarks");
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 14);
// Note: requires jpgraph 1.12p or higher
// $graph->SetBackgroundGradient('blue','navy:0.5',GRAD_HOR,BGRAD_PLOT);
#$graph->tabtitle->Set('Region 1' );
#$graph->tabtitle->SetWidth(TABTITLE_WIDTHFULL);
// Enable X and Y Grid
$graph->SetScale('textlin', 0, max($datay2) + 1);
$graph->xgrid->SetColor('gray@0.5');
$graph->xaxis->SetTickLabels($datax);
$graph->ygrid->SetColor('gray@0.5');
// Format the legend box
$graph->legend->SetColor('black');
#$graph->legend->SetFillColor('lightgreen');
$graph->legend->SetLineWeight(1);
$graph->legend->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->legend->SetShadow('gray@0.4', 3);
#$graph->legend->SetAbsPos(15,120,'right','top');
$graph->legend->SetPos(0.3, 0.03, 'right', 'top');
// Create the line plots
$p1 = new LinePlot($datay1);
$p1->SetColor("red");
$p1->SetFillColor("yellow@0.5");
$p1->SetWeight(2);
$p1->mark->SetType(MARK_IMG_DIAMOND, 5, 0.6);
$p1->SetLegend('Moy.Classe');
$graph->Add($p1);
$p2 = new LinePlot($datay2);
$p2->SetColor("darkgreen");
$p2->SetWeight(2);
$p2->SetLegend('%REUSSITE');
$p2->mark->SetType(MARK_IMG_MBALL, 'red');
$graph->Add($p2);
// Add a vertical line at the end scale position '7'
$l1 = new PlotLine(VERTICAL, intval(count($datax) / 2));
$graph->Add($l1);
// Display the graph
$filename = ROOT . DS . "public" . DS . "tmp" . DS . "courbe.png";
if (file_exists($filename)) {
unlink($filename);
}
$graph->Stroke($filename);
}
示例14: genererCourbe
/**
* Un tableau contenant les moyennes des eleves pour chaque sequences
*
* @param type $moyennes = array()
*/
function genererCourbe($moyennes, $eleve)
{
try {
# Donnees de la courbe
$ydata = $moyennes;
$ydata2 = $moyennes;
/* for ($i = 1; $i <= 6; $i++) {
$r = rand(0, 20);
$ydata[] = $r;
$ydata2[] = $r;
} */
/** Definition des label de l'axe x */
$datax = array("seq 1", "seq 2", "seq 3", "seq 4", "seq 5", "seq 6");
# Creation du graph
$graph = new Graph(350, 250, 'auto');
$graph->SetMarginColor('white');
# Definir le max et le min des valeur X
$graph->SetScale('textlin', 0, 20);
#$graph->xaxis->title->Set("Séquences");
$graph->yaxis->title->Set("Moyennes");
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetTitle("Séquences", "middle");
$graph->SetBackgroundGradient('white', 'lightblue', GRAD_HOR, BGRAD_PLOT);
# Adjuster les margins (left, right, top, bottom)
$graph->SetMargin(40, 5, 21, 45);
# Box autour du plotarea
$graph->SetBox();
# Un cadre ou frame autour de l'image
$graph->SetFrame(false);
# Definir le titre tabulaire
$graph->tabtitle->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->tabtitle->Set($_SESSION['anneeacademique']);
# Definir le titre du graphe
$graph->title->SetFont(FF_VERDANA, FS_NORMAL, 8);
$graph->title->SetAlign("right");
if (count($ydata) > 1) {
$prev = $ydata[count($ydata) - 2];
if ($prev < $ydata[count($ydata) - 1]) {
$graph->title->Set("Performance en hausse");
} elseif ($prev == $ydata[count($ydata) - 1]) {
$graph->title->Set("Performance constante");
} else {
$graph->title->Set("Performance en baisse");
}
}
# Definir les grid X et Y
$graph->ygrid->SetFill(true, '#BBBBBB@0.9', '#FFFFFF@0.9');
//$graph->ygrid->SetLineStyle('dashed');
//$graph->ygrid->SetColor('gray');
//$graph->xgrid->SetLineStyle('dashed');
$graph->xgrid->SetColor('gray');
$graph->xgrid->Show();
//$graph->ygrid->Show();
#$graph->SetBackgroundGradient('blue','navy:0.5',GRAD_HOR,BGRAD_MARGIN);
$graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$graph->xaxis->SetLabelAngle(0);
# Creation d'une bar pot
$bplot = new BarPlot($ydata);
$bplot->SetWidth(0.9);
$fcol = '#440000';
$tcol = '#FF9090';
$bplot->SetFillGradient($fcol, $tcol, GRAD_LEFT_REFLECTION);
# Set line weigth to 0 so that there are no border around each bar
$bplot->SetWeight(0);
# Create filled line plot
$lplot = new LinePlot($ydata2);
$lplot->SetFillColor('skyblue@0.5');
$lplot->SetStyle(1);
$lplot->SetColor('navy@0.7');
$lplot->SetBarCenter();
$lplot->mark->SetType(MARK_SQUARE);
$lplot->mark->SetColor('blue@0.5');
$lplot->mark->SetFillColor('lightblue');
$lplot->mark->SetSize(5);
# Afficher les moyenne au dessus des barres
$accbarplot = new AccBarPlot(array($bplot));
$accbarplot->value->SetFormat("%.2f");
$accbarplot->value->Show();
$graph->Add($accbarplot);
$graph->SetBackgroundImageMix(50);
# Definir un fond d'ecran pour l'image
$background = SITE_ROOT . "public/photos/eleves/" . $eleve['PHOTO'];
if (!empty($eleve['PHOTO']) && file_exists(ROOT . DS . "public" . DS . "photos" . DS . "eleves" . DS . $eleve['PHOTO'])) {
$graph->SetBackgroundImage($background, BGIMG_FILLPLOT);
# $icon = new IconPlot($background, 25, 25, 0.8, 50);
} else {
//$graph->SetBackgroundImage(SITE_ROOT . "public/img/". LOGO, BGIMG_FILLPLOT);
# $icon = new IconPlot(SITE_ROOT . "public/img/ipw.png", 25, 25, 0.8, 50);
}
# $icon->SetAnchor('right', 'bottom');
$graph->Add($lplot);
// Display the graph
$filename = ROOT . DS . "public" . DS . "tmp" . DS . $eleve['IDELEVE'] . ".png";
if (file_exists($filename)) {
unlink($filename);
//.........这里部分代码省略.........
示例15: Graph
if ($i % DATAPERMONTH === 0) {
$months[$i] = $m[(int) ($i / DATAPERMONTH)];
} else {
$months[$i] = 'xx';
}
}
// New graph with a drop shadow
$graph = new Graph(400, 200);
//$graph->SetShadow();
// Use a "text" X-scale
$graph->SetScale('textlin');
// Specify X-labels
$graph->xaxis->SetTickLabels($months);
$graph->xaxis->SetTextTickInterval(DATAPERMONTH, 0);
$graph->xaxis->SetTextLabelInterval(2);
// Set title and subtitle
$graph->title->Set('Textscale with tickinterval=2');
// Use built in font
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->SetBox(true, 'red');
// Create the bar plot
$lp1 = new LinePlot($datay);
$lp1->SetLegend('Temperature');
// The order the plots are added determines who's ontop
$graph->Add($lp1);
// Finally output the image
$graph->Stroke();
?>