本文整理汇总了PHP中PlotBand::SetDensity方法的典型用法代码示例。如果您正苦于以下问题:PHP PlotBand::SetDensity方法的具体用法?PHP PlotBand::SetDensity怎么用?PHP PlotBand::SetDensity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlotBand
的用法示例。
在下文中一共展示了PlotBand::SetDensity方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
示例2: array
<?php
// Illustration of the different patterns for bands
// $Id: smallstaticbandsex4.php,v 1.1.1.1 2005/11/30 23:01:53 gth2 Exp $
include "../jpgraph.php";
include "../jpgraph_bar.php";
$datay = array(10, 29, 3, 6);
// Create the graph.
$graph = new Graph(200, 150, "auto");
$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_3DPLANE, 15, 35, 'khaki4');
$band->SetDensity(60);
$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=60');
$graph->Stroke();
示例3: array
// content="text/plain; charset=utf-8"
// Illustration of the different patterns for bands
// $Id: smallstaticbandsex4.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_3DPLANE, 15, 35, 'khaki4');
$band->SetDensity(80);
$band->ShowFrame(true);
$graph->Add($band);
// Set title
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->SetColor('darkred');
$graph->title->Set('BAND_3DPLANE, Density=60');
$graph->Stroke();
示例4: 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();
}
示例5: 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);
}
示例6: 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(40);
$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=40');
$graph->Stroke();
示例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->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();