本文整理汇总了PHP中Graph::SetGridDepth方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::SetGridDepth方法的具体用法?PHP Graph::SetGridDepth怎么用?PHP Graph::SetGridDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::SetGridDepth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
$datay = array(1.23, 1.9, 1.6, 3.1, 3.4, 2.8, 2.1, 1.9);
$graph = new Graph(300, 200);
$graph->SetScale("textlin");
$graph->img->SetMargin(40, 40, 40, 40);
$graph->SetShadow();
$graph->SetGridDepth(DEPTH_FRONT);
$graph->title->Set("Example of filled line plot");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$p1 = new LinePlot($datay);
$p1->SetFillColor("orange");
$p1->mark->SetType(MARK_FILLEDCIRCLE);
$p1->mark->SetFillColor("red");
$p1->mark->SetWidth(4);
$graph->Add($p1);
$graph->Stroke();
示例2: array
//.........这里部分代码省略.........
$xlabels[$k] = $v . "\n %.1f%%";
}
$lplot[$lplotct]->SetLabels($xlabels, 1.0);
$graph->Add($lplot[$lplotct]);
break;
case "STACKEDBAR":
case "BAR":
$lplot[$lplotct] = new BarPlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
$lplot[$lplotct]->SetWidth(0.8);
//$lplot[$lplotct]->SetWeight(5);
if ($v["fillcolor"]) {
$lplot[$lplotct]->SetFillColor($v["fillcolor"]);
}
if ($v["legend"]) {
$lplot[$lplotct]->SetLegend($v["legend"]);
}
$graph->Add($lplot[$lplotct]);
break;
case "LINE":
default:
if (count($v["data"]) == 1) {
$v["data"][] = 0;
}
$lplot[$lplotct] = new LinePlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
//$lplot[$lplotct]->SetWeight(5);
if ($v["fillcolor"]) {
$lplot[$lplotct]->SetFillColor($v["fillcolor"]);
}
if ($v["legend"]) {
$lplot[$lplotct]->SetLegend($v["legend"]);
}
$graph->Add($lplot[$lplotct]);
break;
}
$lplotct++;
}
$graph->title->Set($this->title_actual);
$graph->xaxis->title->Set($this->xtitle_actual);
$graph->yaxis->title->Set($this->ytitle_actual);
$graph->xgrid->SetColor($this->xgridcolor_actual);
$graph->ygrid->SetColor($this->ygridcolor_actual);
switch ($this->xgriddisplay_actual) {
case "all":
$graph->xgrid->Show(true, true);
break;
case "major":
$graph->xgrid->Show(true, false);
break;
case "minor":
$graph->xgrid->Show(false, true);
break;
case "none":
default:
$graph->xgrid->Show(false, false);
break;
}
switch ($this->ygriddisplay_actual) {
case "all":
$graph->ygrid->Show(true, true);
break;
case "major":
$graph->ygrid->Show(true, false);
break;
case "minor":
$graph->ygrid->Show(false, true);
break;
case "none":
default:
$graph->ygrid->Show(false, false);
break;
}
$graph->title->SetFont($fontfamilies[$this->titlefont_actual], $fontstyles[$this->titlefontstyle_actual], $this->titlefontsize_actual);
$graph->title->SetColor($this->titlecolor_actual);
$graph->xaxis->SetFont($fontfamilies[$this->xaxisfont_actual], $fontstyles[$this->xaxisfontstyle_actual], $this->xaxisfontsize_actual);
$graph->xaxis->SetColor($this->xaxiscolor_actual, $this->xaxisfontcolor_actual);
$graph->yaxis->SetFont($fontfamilies[$this->yaxisfont_actual], $fontstyles[$this->yaxisfontstyle_actual], $this->yaxisfontsize_actual);
$graph->yaxis->SetColor($this->yaxiscolor_actual, $this->yaxisfontcolor_actual);
$graph->xaxis->title->SetFont($fontfamilies[$this->xtitlefont_actual], $fontstyles[$this->xtitlefontstyle_actual], $this->xtitlefontsize_actual);
$graph->xaxis->title->SetColor($this->xtitlecolor_actual);
$graph->yaxis->title->SetFont($fontfamilies[$this->ytitlefont_actual], $fontstyles[$this->ytitlefontstyle_actual], $this->ytitlefontsize_actual);
$graph->yaxis->title->SetColor($this->ytitlecolor_actual);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetLabelMargin(5);
$graph->yaxis->SetLabelMargin(5);
$graph->xaxis->SetTickLabels($this->xlabels);
$graph->xaxis->SetTextLabelInterval($this->xticklabelinterval_actual);
$graph->yaxis->SetTextLabelInterval($this->yticklabelinterval_actual);
$graph->xaxis->SetTextTickInterval($this->xtickinterval_actual);
$graph->yaxis->SetTextTickInterval($this->ytickinterval_actual);
$graph->SetFrame(true, 'darkblue', 2);
$graph->SetFrameBevel(2, true, 'black');
if ($this->gridpos_actual == "front") {
$graph->SetGridDepth(DEPTH_FRONT);
}
// Display the graph
$handle = $graph->Stroke(_IMG_HANDLER);
return $handle;
}
示例3: 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) {
//.........这里部分代码省略.........