本文整理汇总了PHP中CanvasGraph::SetColor方法的典型用法代码示例。如果您正苦于以下问题:PHP CanvasGraph::SetColor方法的具体用法?PHP CanvasGraph::SetColor怎么用?PHP CanvasGraph::SetColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CanvasGraph
的用法示例。
在下文中一共展示了CanvasGraph::SetColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Stroke
function Stroke($aData, $aFile = '', $aOnlyDebug = false)
{
$topmargin = 10;
$bottommargin = 10;
$textmargin = 5;
$txtmargin = 4;
$this->iHeight *= $this->iModuleWidth;
$spec = $this->iEncoder->Enc($aData);
if ($aOnlyDebug) {
return $spec->toString();
}
$this->AdjustSpec($spec);
$data = '';
if (is_array($aData)) {
$n = count($aData);
for ($i = 0; $i < $n; ++$i) {
$data .= $aData[$i][1];
}
} elseif (is_string($aData)) {
$data = $aData;
}
if (!$this->iFontSpecified) {
if ($this->iModuleWidth > 1) {
$this->iFontFam = FF_ARIAL;
$this->iFontStyle = FS_BOLD;
$this->iFontSize = 10;
} else {
$this->iFontFam = FF_ARIAL;
$this->iFontStyle = FS_NORMAL;
$this->iFontSize = 7;
}
}
$s = '';
$g = new CanvasGraph(0, 0);
// Dummy graph context
$g->img->SetImgFormat($this->iImgFormat);
$w = round($spec->iModuleWidth);
// Calculate total width
$totwidth = $spec->iLeftMargin * $w;
$n = count($spec->iBar[0]);
for ($i = 0; $i < $n; ++$i) {
$b = $spec->iBar[0][$i];
$bn = strlen($b[3]);
for ($j = 0; $j < $bn; ++$j) {
$wb = substr($b[3], $j, 1) * $w;
$totwidth += $wb;
}
}
$totwidth += $spec->iRightMargin * $w;
// Calculate total height
$height = $this->iHeight * count($spec->iBar) + $topmargin + $bottommargin;
$g->img->SetFont($this->iFontFam, $this->iFontStyle, $this->iFontSize);
$th = $g->img->GetTextHeight($data) + $txtmargin;
if ($spec->iStrokeDataBelow) {
$height += $th;
}
$width = $totwidth;
$g->img->SetFont(FF_FONT2);
$tw = 2 * $textmargin + $g->img->GetTextWidth($s);
if ($width < $tw) {
$width = $tw;
}
$g = new CanvasGraph($width, $height);
$g->img->SetImgFormat($this->iImgFormat);
$g->SetMarginColor($this->iBkgColor);
$g->SetColor($this->iBkgColor);
if ($this->iShowFrame) {
$g->InitFrame();
} else {
$g->frame_weight = 0;
$g->InitFrame();
}
$g->img->SetLineWeight(1);
$g->img->SetColor('black');
$x = $w * $spec->iLeftMargin;
$ystart = $topmargin;
$inunder = false;
$under_s = '';
$startx = $x;
for ($r = 0; $r < count($spec->iBar); ++$r) {
$yend = $ystart + $this->iHeight - 1;
$x = $startx;
for ($i = 0; $i < $n; ++$i) {
$b = $spec->iBar[$r][$i];
$bn = strlen($b[3]);
for ($j = 0; $j < $bn; ++$j) {
$wb = substr($b[3], $j, 1) * $w;
if (!($j % 2)) {
$g->img->SetColor($this->iColor);
$g->img->FilledRectangle($x, $ystart, $x + $wb - 1, $yend);
}
$x += $wb;
}
}
$ystart += $this->iHeight;
}
// row
$g->img->SetColor($this->iColor);
if ($spec->iStrokeDataBelow) {
// Center data underneath
//.........这里部分代码省略.........
示例2: displayGraph
//.........这里部分代码省略.........
// * * * * * * * * * //
// * *** ***** ***** ***** ***** //
// * * * * * * * * * //
// ***** * * * * * * * //
//*****************************************//
// L I N E P L O T
if (sizeof($G_YDATAS) >= 1) {
// true no funciona porque cada cadena u otro valor que se retorne es valor "valido o verdadero"
// y equivale a true, entonces para diferenciarlo verdaderamente se compara con 'true'
$str = checkAttributes($G_TITLE, $G_TYPE, $G_LABEL_Y, $_MSJ_ERROR, $_MSJ_NOTHING);
if ($str != 'true') {
showError($str, $G_SIZE);
return;
}
if ($G_TYPE == 'lineplot') {
$graph = new Graph($G_SIZE[0], $G_SIZE[1], "auto");
if ($G_SHADOW) {
$graph->SetShadow();
}
$graph->SetScale($G_SCALE);
$graph->SetMarginColor($G_COLOR);
$graph->title->Set($G_TITLE);
$graph->SetFrame(true, '#999999');
$graph->img->SetMargin($G_MARGIN[0], $G_MARGIN[1], $G_MARGIN[2], $G_MARGIN[3]);
$graph->img->SetAntiAliasing();
$graph->xaxis->SetLabelFormatCallback("CallBack");
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->title->Set($G_LABEL[0]);
$graph->yaxis->title->Set($G_LABEL[1]);
$graph->xgrid->Show();
$graph->legend->SetFillColor("#fafafa");
$graph->legend->Pos($G_LEYEND_POS[0], $G_LEYEND_POS[1], "right", "center");
$graph->legend->SetColumns($G_LEYEND_NUM_COLUMN);
$graph->legend->SetColor("#444444", "#999999");
$arr_lineplot = array();
foreach ($G_YDATAS as $num => $yDatas) {
$lineplot = new LinePlot($yDatas);
if ($G_ARR_STEP[$num] == true) {
$lineplot->SetStepStyle();
}
if ($G_ARR_FILL_COLOR[$num] == true) {
$lineplot->SetFillColor($G_ARR_COLOR[$num]);
}
$lineplot->SetColor($G_ARR_COLOR[$num]);
$lineplot->SetWeight($G_WEIGHT);
$lineplot->SetLegend($G_ARR_LEYEND[$num]);
$arr_lineplot[] = $lineplot;
}
foreach ($arr_lineplot as $num => $yDatas) {
$graph->Add($yDatas);
}
if (sizeof($xData) > 100) {
$graph->xaxis->SetTextTickInterval((int) (sizeof($xData) / 10));
}
$graph->Stroke();
} else {
if ($G_TYPE == 'plot3d') {
$graph = new PieGraph($G_SIZE[0], $G_SIZE[1], "auto");
if ($G_SHADOW) {
$graph->SetShadow();
}
$dataMarginColor = isset($result["ATTRIBUTES"]["MARGIN_COLOR"]) ? $result["ATTRIBUTES"]["MARGIN_COLOR"] : "#999999";
$dataSizePie = isset($result["ATTRIBUTES"]["SIZE_PIE"]) ? $result["ATTRIBUTES"]["SIZE_PIE"] : "80";
$graph->SetMarginColor($G_COLOR);
$graph->SetFrame(true, $dataMarginColor);
$graph->legend->Pos($G_LEYEND_POS[0], $G_LEYEND_POS[1], "right", "center");
示例3: CanvasGraph
<?php
// $Id: listfontsex1.php,v 1.3 2002/10/25 22:44:15 aditus Exp $
include "../jpgraph.php";
include "../jpgraph_canvas.php";
include "../jpgraph_canvtools.php";
$g = new CanvasGraph(550, 450, 'auto');
$scale = new CanvasScale($g);
$scale->Set(0, 27, 0, 53);
$g->SetMargin(5, 6, 5, 6);
$g->SetColor('white');
$g->SetMarginColor("teal");
$g->InitFrame();
$t = new CanvasRectangleText();
$t->SetFillColor('lightgreen');
$t->SetFontColor('navy');
$t->SetFont(FF_ARIAL, FS_NORMAL, 16);
$t->Set("\n\n\n\n\n\n\n\n\n\n\nTTF Fonts", 0.5, 19, 26, 32);
$t->Stroke($g->img, $scale);
$t = new CanvasRectangleText();
$t->SetFillColor('');
$t->SetFontColor('black');
$t->SetColor('');
$t->SetShadow('');
$t->SetFont(FF_ARIAL, FS_BOLD, 18);
$t->Set('Family', 1, 1, 8);
$t->Stroke($g->img, $scale);
$t->Set('Italic style', 9, 1, 8);
$t->Stroke($g->img, $scale);
$t->Set('Bold style', 17.5, 1, 8);
$t->Stroke($g->img, $scale);