本文整理汇总了PHP中PlotBand类的典型用法代码示例。如果您正苦于以下问题:PHP PlotBand类的具体用法?PHP PlotBand怎么用?PHP PlotBand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlotBand类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPintargrafica
public function getPintargrafica($riesgo)
{
JpGraph::module('bar');
$riesgo = number_format($riesgo, 0, '', '');
$valor_riesgo = 100 / $riesgo;
if ($riesgo <= 385) {
$color_riesgo = '#d9534f';
} else {
$color_riesgo = '#5cb85c';
}
$tamiz = 320;
$valor_tamiz = 100 / $tamiz;
if ($tamiz <= 385) {
$color_tamiz = '#d9534f';
} else {
$color_tamiz = '#5cb85c';
}
$data = array($valor_riesgo, $valor_tamiz);
// Instancia la gráfica recibiendo como parámetros ancho, alto
$graph = new Graph(310, 210);
$graph->SetScale("textlin");
//Muestra borde de la gráfica
$graph->SetBox(true);
$graph->title->SetColor('black');
$graph->title->Set('El Síndrome de Down');
$labelsX = array("Edad Solamente\n(1:" . $riesgo . ")", "Suero Tamíz\n(1:" . $tamiz . ")");
$graph->xaxis->SetTickLabels($labelsX);
//muestra los labels de las gráficas de barra
$graph->xaxis->SetLabelAlign('center', 'top', 'center');
//Centrar los labels
$graph->ygrid->SetFill(false);
//oculta el fondo de la gráfica
$graph->yaxis->SetTitle('1:385', "middle");
//Titulo de axis Y seteado a la mitad de la gráfica
$graph->yaxis->HideLabels();
//Oculta los valores de la axis Y
$graph->yaxis->HideTicks(false, false);
//Oculta las líneas de la axis Y
$graph->xaxis->SetColor('black');
$graph->yaxis->SetColor('black');
// Crea la gráfica de barra
$suero = new BarPlot($data);
// Agrega la gráfica de suero
$graph->Add($suero);
$suero->SetColor("white");
$suero->SetFillColor(array($color_riesgo, $color_tamiz));
$suero->SetWidth(0.6);
//línea intermedia de la gráfica
$band = new PlotBand(HORIZONTAL, BAND_SOLID, 0.2496, 0.25, 'black');
$band->ShowFrame(false);
$graph->Add($band);
//Muestra la grafica
$graph->Stroke();
}
示例2: array
<?php
// content="text/plain; charset=utf-8"
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_bar.php";
$datay = array(10, 29, 3, 6);
// Create the graph.
$graph = new Graph(200, 200);
$graph->SetScale('textlin');
$graph->SetMargin(25, 10, 20, 25);
$graph->SetBox(true);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10);
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor("lightblue");
$graph->ygrid->Show(false);
// .. and add the plot to the graph
$graph->Add($bplot);
// Add band
$band = new PlotBand(HORIZONTAL, BAND_3DPLANE, 15, 35, 'khaki4');
$band->SetDensity(10);
$band->ShowFrame(true);
$graph->AddBand($band);
// Set title
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->SetColor('darkred');
$graph->title->Set('BAND_3DPLANE, Density=10');
$graph->Stroke();
示例3: array
<?php
// content="text/plain; charset=utf-8"
// Illustration of the different patterns for bands
// $Id: smallstaticbandsex1.php,v 1.1 2002/09/01 21:51:08 aditus Exp $
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_bar.php";
$datay = array(10, 29, 3, 6);
// Create the graph.
$graph = new Graph(200, 150);
$graph->SetScale("textlin");
$graph->SetMargin(25, 10, 20, 20);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10);
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor("lightblue");
// Position the X-axis at the bottom of the plotare
$graph->xaxis->SetPos("min");
$graph->ygrid->Show(false);
// .. and add the plot to the graph
$graph->Add($bplot);
// Add band
$band = new PlotBand(HORIZONTAL, BAND_RDIAG, 15, 35, 'khaki4');
$band->ShowFrame(false);
$graph->Add($band);
// Set title
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->SetColor('darkred');
$graph->title->Set('BAND_RDIAG');
$graph->Stroke();
示例4: array
// content="text/plain; charset=utf-8"
// Illustration of the different patterns for bands
// $Id: smallstaticbandsex5.php,v 1.1 2002/09/01 21:51:08 aditus Exp $
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_bar.php";
$datay = array(10, 29, 3, 6);
// Create the graph.
$graph = new Graph(200, 150);
$graph->SetScale("textlin");
$graph->SetMargin(25, 10, 20, 20);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10);
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor("lightblue");
// Position the X-axis at the bottom of the plotare
$graph->xaxis->SetPos("min");
$graph->ygrid->Show(false);
// .. and add the plot to the graph
$graph->Add($bplot);
// Add band
$band = new PlotBand(HORIZONTAL, BAND_HVCROSS, 15, 35, 'khaki4');
$band->ShowFrame(true);
$band->SetOrder(DEPTH_FRONT);
$graph->Add($band);
// Set title
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->SetColor('darkred');
$graph->title->Set('BAND_HVCROSS, In front');
$graph->Stroke();
示例5: graph
//.........这里部分代码省略.........
if ($endTime - $startTime > 3600 * 2) {
//2 hours
$conversionFactor = 3600;
$XUnits = "Hours since midnight " . date("m/d", $explanationTime);
$varSuffix = 'Morning';
}
}
}
//This start point will be the ZERO
$relativeStart = $times[$varPrefix . $varSuffix];
/**/
//setup arrays
while (list($serial, $s) = each($list)) {
$xdata[$serial] = array();
$ydata[$serial] = array();
$names[$serial] = $s['name'];
}
/**/
//setup xdata and ydata
while (list($row, $d) = each($data)) {
$serial = $d['SerialNumber'];
//safety, should not be needed
if (!is_array($xdata[$serial])) {
$xdata[$serial] = array();
$ydata[$serial] = array();
$names[$serial] = $serial;
//it must not be described
}
$time = $d['unixtime'];
$x = sprintf("%0.3f", ($time - $relativeStart) / $conversionFactor);
//echo "Based on $startTime - $relativeStart div by $conversionFactor, it's $x <BR>";
//$temp = $d['Fahrenheit'];
$temp = $d[$units];
/**/
/**/
array_push($xdata[$serial], $x);
array_push($ydata[$serial], $temp);
//echo "Adding point $x - $temp";
}
//$graph = setupGraph($mintime,$maxtime,$mintemp, $maxtemp);
$count = count($data);
$graph = setupGraph($XUnits, $startTime, $count, $options);
reset($list);
//already walked this one
//make plots based on arrays
$graphHasData = false;
//if it doesn't have any data, it will blow up
$plots = array();
while (list($serial, $s) = each($list)) {
$color = $list[$serial]['color'];
if (!isset($color) || $color == '') {
//Take the default just in case
$color = array_pop($colors);
}
$plots[$serial] = makePlot($xdata[$serial], $ydata[$serial], $names[$serial], $color, $options);
if (sizeof($xdata[$serial]) > 0) {
$graphHasData = true;
}
//tossing each into its own var as it seems to be
//pass by ref and overwrites each time?
if (isset($plots[$serial])) {
/*
echo "Adding a plot: " ;
print_r($plot);
echo "<P><HR>";
*/
$graph->Add($plots[$serial]);
if (isset($options['showBands']) && $options['showBands'] == 1) {
if (isset($list[$serial]['max'])) {
$max = $list[$serial]['max'];
// $graph->Add(new PlotLine(HORIZONTAL,$max, $color, 1));
}
if (isset($list[$serial]['min'])) {
$min = $list[$serial]['min'];
// $graph->Add(new PlotLine(HORIZONTAL,$min, $color, 1));
}
/******** ADD BAND ******** ? ***/
if (isset($min) && isset($max)) {
$uband = new PlotBand(HORIZONTAL, BAND_SOLID, $min, $max, "white", 1, DEPTH_BACK);
$uband->ShowFrame(true);
$uband->SetDensity(3);
// % line density
$graph->AddBand($uband);
unset($uband);
}
/******* DONE ADD BAND *******/
}
//if showBands
}
}
if (!$graphHasData) {
$txt = new Text("There is no data in the selected timeframe. Consider expanding the range");
$txt->Pos(0.2, 0.5);
$txt->SetColor("red");
$graph->AddText($txt);
//override scale so it doesn't complain
$graph->SetScale("linlin", 0, 1, 0, 1);
}
$graph->Stroke();
}
示例6: prepareGraph
//.........这里部分代码省略.........
}
}
}
$this->graphValues = $datagraph;
$nbmonth = ceil(count($this->graphValues) / 30);
//create the graph
$this->graph = new Graph($nbmonth * 500, 450);
$this->graph->img->SetMargin(60, 120, 20, 90);
$gbparray = new BarPlot($this->graphValues);
} else {
// create the graph
$this->graph = new Graph(900, 400);
$this->graph->img->SetMargin(60, 120, 20, 40);
}
//management of the axes scales
if ($this->filter == 'hour') {
$this->graph->SetScale("linlin");
} else {
$this->graph->SetScale("textlin");
}
$this->graph->yaxis->scale->SetGrace(20);
$this->graph->setShadow();
// create the bar plots in the advanced search display per month case
if ($this->advsrch == 2) {
$datagraph = array();
for ($y = $this->minyear; $y <= $this->maxyear; $y++) {
$minm = 1;
if ($y == $this->minyear) {
$minm = $this->minmonth;
}
$maxm = 12;
if ($y == $this->maxyear) {
$maxm = $this->maxmonth;
}
for ($m = $minm; $m <= $maxm; $m++) {
if (isset($this->graphValues[$y][$m])) {
$datagraph[] = $this->graphValues[$y][$m];
} else {
$datagraph[] = 0;
}
}
}
$this->graphValues = $datagraph;
$gbparray = new BarPlot($this->graphValues);
} else {
$gbparray = new BarPlot($this->graphValues);
}
$gbparray->value->Show();
$gbparray->value->HideZero();
$gbparray->value->SetFormat('%d');
$gbparray->SetLegend($this->selectedData);
$gbparray->SetFillColor($this->getColor());
//add to the graph
$this->graph->legend->Pos(0.02, 0.05, "right", "top");
if ($this->advsrch == 3) {
//the position of the legend depend on the number of month display
$this->graph->legend->Pos(0.075 / $nbmonth, 0.05, "right", "top");
}
$this->graph->Add($gbparray);
$color1 = array(195, 225, 255);
$color2 = array(225, 240, 255);
$this->graph->setBackgroundGradient($color1, $color2, GRAD_HOR, BGRAD_MARGIN);
//manage the Weekend display in the Simple search
if ($this->advsrch == 0 && $this->filter == 'day') {
foreach ($this->graphValues as $key => $val) {
$testday = date("w", mktime(0, 0, 0, $this->month, $key, $this->year));
$color3 = "#F4F3F2@0.45";
//color the Saturday
if ($testday == 5) {
$beginwe = $key;
$endwe = $beginwe + 1;
$uband = new PlotBand(VERTICAL, BAND_SOLID, $beginwe, $endwe, $color3);
$uband->ShowFrame(false);
$uband->SetDensity(80);
$ubandarray[] = $uband;
} elseif ($testday == 6) {
//color the Sunday
$beginwe = $key;
$endwe = $beginwe + 1;
$aband = new PlotBand(VERTICAL, BAND_SOLID, $beginwe, $endwe, $color3);
$aband->ShowFrame(false);
$aband->SetDensity(80);
$abandarray[] = $aband;
}
}
for ($i = 0; $i < count($ubandarray); $i++) {
$this->graph->AddBand($ubandarray[$i]);
}
for ($i = 0; $i < count($abandarray); $i++) {
$this->graph->AddBand($abandarray[$i]);
}
}
//manage the title of the graph
if ($this->advsrch != 0) {
$this->graph->title->Set('New ' . $this->selectedData . ' by ' . $this->filter . ' between ' . $this->titlePeriod);
} else {
$this->graph->title->Set('New ' . $this->selectedData . ' during ' . $this->titlePeriod);
}
$this->graph->title->setFont(FF_FONT1, FS_BOLD);
}
示例7: CResultatsLaboGraph
function CResultatsLaboGraph($patient, $examen, $resultats)
{
$resultats = array_reverse($resultats, true);
if ($examen->type != "num") {
JpGraphError::raise("Le type d'examen doit être numérique pour être affiché");
}
// Prepare values
// Value plot
$ydata = array();
$xlabels = array();
$min = $examen->min;
$max = $examen->max;
foreach ($resultats as $resultat) {
$min = min($min, $resultat->resultat);
$max = max($max, $resultat->resultat);
$ydata[] = $resultat->resultat;
$xlabels[] = $resultat->date ? CMbDT::transform(null, $resultat->date, "%d/%m/%y") : "attendu";
}
// Setup the graph.
$this->Graph(360, 250, "auto");
$delta = 2;
$this->SetScale("textlin", max(0, $min - $delta), $max + $delta);
$this->SetMarginColor("lightblue");
// Image setup
$this->img->SetAntiAliasing(true);
$this->img->SetMargin(40, 10, 30, 40);
if ($examen->max) {
$uband = new PlotBand(HORIZONTAL, BAND_RDIAG, $examen->max, "max", "#ffbbbb");
$uband->ShowFrame(true);
$uband->SetDensity(92);
$this->AddBand($uband);
}
if ($examen->min) {
$lband = new PlotBand(HORIZONTAL, BAND_RDIAG, "min", $examen->min, "#ffbbbb");
$lband->ShowFrame(true);
$lband->SetDensity(92);
$this->AddBand($lband);
}
// Legend setup
$this->legend->Pos(0.02, 0.5, "right", "center");
$this->legend->SetShadow("darkgray@0.5", 3);
$this->legend->SetFont(FF_ARIAL, FS_NORMAL, 7);
$this->legend->SetFillColor("white@0.3");
// Title setup
$this->title->SetFont(FF_ARIAL, FS_NORMAL, 10);
$this->title->SetColor("darkred");
$this->title->Set("Résultats pour " . $examen->_view);
$this->subtitle->SetFont(FF_ARIAL, FS_NORMAL, 8);
$this->subtitle->SetColor("darkgray");
$this->subtitle->Set($patient->_view);
// Setup X-axis labels
$this->xgrid->Show(true);
$this->xgrid->SetColor("lightgray", "lightgray:1.7");
$this->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 7);
$this->xaxis->SetLabelAlign("right", "top", "right");
$this->xaxis->SetLabelMargin(2);
$this->xaxis->SetLabelAngle(45);
$this->xaxis->SetTickLabels($xlabels);
// Setup Y-axis labels
$this->ygrid->Show(true, true);
$this->ygrid->SetColor("lightgray", "lightgray:1.7");
$this->yaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$this->yaxis->scale->ticks->SupressMinorTickMarks(false);
$this->yaxis->title->SetFont(FF_ARIAL, FS_NORMAL, 7);
$this->yaxis->title->SetColor("darkred");
$this->yaxis->title->Set("valeurs en {$examen->unite}");
$this->yaxis->SetLabelMargin(4);
$this->yaxis->SetTitleMargin(28);
$plot = new LinePlot($ydata);
$plot->SetCenter();
$plot->mark->SetType(MARK_FILLEDCIRCLE);
$plot->mark->SetFillColor("gray");
$this->Add($plot);
}
示例8: BarPlot
$graph->subtitle->Set("(Department X)");
// Show both X and Y grid
$graph->xgrid->Show(true, false);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10, 10);
// Turn the tick mark out from the plot area
$graph->xaxis->SetTickSide(SIDE_DOWN);
$graph->yaxis->SetTickSide(SIDE_LEFT);
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor("orange");
// Show the actual value for each bar on top/bottom
$bplot->value->Show(true);
$bplot->value->SetFormat("%02d kr");
// Position the X-axis at the bottom of the plotare
$graph->xaxis->SetPos("min");
// .. and add the plot to the graph
$graph->Add($bplot);
// Add upper and lower band and use no frames
$uband = new PlotBand(HORIZONTAL, BAND_RDIAG, 0, "max", "green");
$uband->ShowFrame(false);
$lband = new PlotBand(HORIZONTAL, BAND_LDIAG, "min", 0, "red");
$lband->ShowFrame(false);
$graph->AddBand($uband);
$graph->AddBand($lband);
//$graph->title->Set("Test of bar gradient fill");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->Stroke();
示例9: BarPlot
$graph->yscale->SetGrace(10, 10);
// Turn the tick mark out from the plot area
$graph->xaxis->SetTickSide(SIDE_DOWN);
$graph->yaxis->SetTickSide(SIDE_LEFT);
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor("orange");
// Show the actual value for each bar on top/bottom
$bplot->value->Show(true);
$bplot->value->SetFormat("%02d kr");
// Position the X-axis at the bottom of the plotare
$graph->xaxis->SetPos("min");
// .. and add the plot to the graph
$graph->Add($bplot);
// Add upper and lower band and use no frames
$uband = new PlotBand(HORIZONTAL, BAND_RDIAG, 0, "max", "green");
$uband->ShowFrame(false);
$uband->SetDensity(50);
// 50% line density
$lband = new PlotBand(HORIZONTAL, BAND_LDIAG, "min", 0, "red");
$lband->ShowFrame(false);
$lband->SetDensity(20);
// 20% line density
$graph->AddBand($uband);
$graph->AddBand($lband);
//$graph->title->Set("Test of bar gradient fill");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->Stroke();
示例10: generateGraphbartotcalls
function generateGraphbartotcalls($type)
{
for ($i = 0; $i < 4; $i++) {
$time = DATE('Y-m-d');
$date = strtotime($time . ' -' . $i . $type);
if ($type == "year") {
$labels[] = date('Y', $date);
$date = date('Y', $date);
} elseif ($type == "month") {
$labels[] = date('M', $date);
$date = date('Y-m', $date);
} elseif ($type == "week") {
$labels = array(4, 3, 2, 1);
$date = date('oW', $date);
} else {
$labels[] = date('d', $date);
$date = date('Y-m-d', $date);
}
if ($type == "week") {
//$sql = "SELECT COUNT(*) AS 'count', `call_type` FROM `call_log` WHERE YEARWEEK(call_created_time,1) LIKE '$date' AND `deleted` = '0' GROUP BY `call_type` ORDER BY `call_type`";
$sql = DB::select(DB::raw("SELECT COUNT(*) AS 'count', `call_type` FROM `call_log` WHERE YEARWEEK(created_at,1) LIKE '{$date}' AND `deleted` = '0' GROUP BY `call_type` ORDER BY `call_type`"));
} else {
//$sql = "SELECT COUNT(*) AS 'count', `call_type` FROM `call_log` WHERE `call_created_time` LIKE '$date%' AND `deleted` = '0' GROUP BY `call_type` ORDER BY `call_type`";
$sql = DB::select(DB::raw("SELECT COUNT(*) AS 'count', `call_type` FROM `call_log` WHERE `created_at` LIKE '{$date}%' AND `deleted` = '0' GROUP BY `call_type` ORDER BY `call_type`"));
}
// $this->load->database();
// $query=$this->db->query($sql);
foreach ($sql as $row) {
$call[$row->call_type][$i] = $row->count;
}
if (!isset($call['Inquiry'][$i])) {
$call['Inquiry'][$i] = "0";
}
if (!isset($call['Sales'][$i])) {
$call['Sales'][$i] = "0";
}
if (!isset($call['Tickets'][$i])) {
$call['Tickets'][$i] = "0";
}
}
//bar3
// $data3y=array(220,230,210,175,185);
// $data4y=array(40,45,70,80,50);
// $data5y=array(20,20,25,22,30);
$data3y = $call['Inquiry'];
$data4y = $call['Sales'];
$data5y = $call['Tickets'];
// Create the graph. These two calls are always required
$graph = new \Graph(350, 250, 'auto');
$graph->SetScale("textlin");
$graph->SetY2Scale("lin", 0, 90);
$graph->SetY2OrderBack(false);
$graph->SetMargin(35, 50, 20, 5);
$theme_class = new \UniversalTheme();
$graph->SetTheme($theme_class);
// $graph->yaxis->SetTickPositions(array(0,50,100,150,200,250,300,350), array(25,75,125,175,275,325));
$graph->y2axis->SetTickPositions(array(30, 40, 50, 60, 70, 80, 90));
// $months = $gDateLocale->GetShortMonth();
// $months = array_merge(array_slice($months,3,9), array_slice($months,0,3));
// $graph->SetBox(false);
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels($labels);
$graph->xaxis->title->Set($type);
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
$graph->yaxis->title->Set('Calls');
// Setup month as labels on the X-axis
// $graph->xaxis->SetTickLabels($months);
// Create the bar plots
$b3plot = new \BarPlot($data3y);
$b4plot = new \BarPlot($data4y);
$b5plot = new \BarPlot($data5y);
// Create the grouped bar plot
$gbbplot = new \AccBarPlot(array($b3plot, $b4plot, $b5plot));
$gbplot = new \GroupBarPlot(array($gbbplot));
// ...and add it to the graPH
$graph->Add($gbplot);
$gbplot->SetWidth(45);
$b3plot->SetColor("#3333CC");
$b3plot->SetFillColor("#3333CC");
$b3plot->SetLegend("Inquiry");
$b4plot->SetColor("#7474FF");
$b4plot->SetFillColor("#7474FF");
$b4plot->SetLegend("Sales");
$b5plot->SetColor("#6EB7FF");
$b5plot->SetFillColor("#6EB7FF");
$b5plot->SetLegend("Tickets");
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColumns(5);
// $graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->Pos(0.2, 0.9);
$band = new \PlotBand(VERTICAL, BAND_RDIAG, 11, "max", 'khaki4');
$band->ShowFrame(true);
$band->SetOrder(DEPTH_BACK);
$graph->Add($band);
// $graph->title->Set("Combineed Line and Bar plots");
// Display the graph
// $graph->Stroke();
$gdImgHandler = $graph->Stroke(_IMG_HANDLER);
$fileName = "assets/tmp/" . $type . "_bar_tcall.png";
//.........这里部分代码省略.........