本文整理汇总了PHP中Text::Set方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::Set方法的具体用法?PHP Text::Set怎么用?PHP Text::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Create
function Create()
{
if ($this->ready) {
return;
}
$this->graph = new CanvasGraph($this->width, $this->height, 'auto');
$this->graph->SetMargin(5, 11, 6, 11);
/*
$this->graph->SetShadow();
$this->graph->SetMarginColor( "teal");
$this->graph->InitFrame();
*/
$hpos = 15;
$text = new Text("ADEI", $this->width / 2, $hpos);
$text->SetFont(FF_ARIAL, FS_BOLD, 24);
$text->Align('center', 'top');
$text->Stroke($this->graph->img);
$hpos += $text->GetTextHeight($this->graph->img) + 10;
// $msg = "Welcome to the Advanced Data Extraction Infrastructure! Please";
$msg = preg_replace(array("/\n([^\n])/"), array(' \\1'), file_get_contents("docs/welcome.txt"));
$text_width = $this->width - 50;
if ($text_width < 100) {
return;
}
$text = new Text($msg, $this->width / 2, $hpos);
$text->SetFont(FF_ARIAL, FS_NORMAL, 18);
$text->Align('center', 'top');
$width = $text->GetWidth($this->graph->img);
if ($width > $text_width) {
$char_width = ceil($width / strlen($msg));
$cpl = $text_width / $char_width;
$wmsg = wordwrap($msg, $cpl, "\n", true);
$text->Set($wmsg);
$width = $text->GetWidth($this->graph->img);
while ($width > $text_width && $cpl > 10) {
$cpl -= $cpl / 10;
$wmsg = wordwrap($msg, $cpl, "\n", true);
$text->Set($wmsg);
$width = $text->GetWidth($this->graph->img);
}
}
$text->Stroke($this->graph->img);
// $text->ParagraphAlign('center');
// $text->SetBox( "white", "black","gray");
/*
// $text->Align('left', 'top');
// $text->ParagraphAlign('left');
// $text->SetBox( "white", "black","gray");
$width = $text->GetWidth($this->graph->img);
*/
// $text->Stroke( $this->graph->img);
}
示例2: CreateMessage
function CreateMessage($header, $msg)
{
$this->graph = new CanvasGraph($this->width, $this->height, 'auto');
$this->graph->SetMargin(5, 11, 6, 11);
$this->graph->SetShadow();
$this->graph->SetMarginColor("teal");
$this->graph->InitFrame();
$text_width = $this->width - 50;
if ($text_width < 100) {
return;
}
$text = new Text($msg, 25, 25);
$text->SetFont(FF_ARIAL, FS_NORMAL, 24);
// $text->Align('left', 'top');
// $text->ParagraphAlign('left');
// $text->SetBox( "white", "black","gray");
$width = $text->GetWidth($this->graph->img);
if ($width > $text_width) {
$char_width = ceil($width / strlen($msg));
$cpl = $text_width / $char_width;
/*
Does not taken into the account by GetWidth function
$text->SetWordWrap($cpl);
*/
$wmsg = wordwrap($msg, $cpl, "\n", true);
$text->Set($wmsg);
$width = $text->GetWidth($this->graph->img);
while ($width > $text_width && $cpl > 10) {
$cpl -= $cpl / 10;
$wmsg = wordwrap($msg, $cpl, "\n", true);
$text->Set($wmsg);
$width = $text->GetWidth($this->graph->img);
}
}
$text->Stroke($this->graph->img);
}
示例3: StrokeAngleLabels
function StrokeAngleLabels($pos, $type)
{
if (!$this->show_angle_label) {
return;
}
$x0 = round($this->img->left_margin + $this->img->plotwidth / 2) + 1;
$d = max($this->img->plotwidth, $this->img->plotheight) * 1.42;
$a = $this->angle_step;
$t = new Text();
$t->SetColor($this->angle_fontcolor);
$t->SetFont($this->angle_fontfam, $this->angle_fontstyle, $this->angle_fontsize);
$xright = $this->img->width - $this->img->right_margin;
$ytop = $this->img->top_margin;
$xleft = $this->img->left_margin;
$ybottom = $this->img->height - $this->img->bottom_margin;
$ha = 'left';
$va = 'center';
$w = $this->img->plotwidth / 2;
$h = $this->img->plotheight / 2;
$xt = $x0;
$yt = $pos;
$margin = 5;
$tl = $this->angle_tick_len;
// Outer len
$tl2 = $this->angle_tick_len2;
// Interior len
$this->img->SetColor($this->angle_tick_color);
$rot90 = $this->img->a == 90;
if ($type == POLAR_360) {
$ca1 = atan($h / $w) / M_PI * 180;
$ca2 = 180 - $ca1;
$ca3 = $ca1 + 180;
$ca4 = 360 - $ca1;
$end = 360;
while ($a < $end) {
$ca = cos($a / 180 * M_PI);
$sa = sin($a / 180 * M_PI);
$x = $d * $ca;
$y = $d * $sa;
$xt = 1000;
$yt = 1000;
if ($a <= $ca1 || $a >= $ca4) {
$yt = $pos - $w * $y / $x;
$xt = $xright + $margin;
if ($rot90) {
$ha = 'center';
$va = 'top';
} else {
$ha = 'left';
$va = 'center';
}
$x1 = $xright - $tl2;
$x2 = $xright + $tl;
$y1 = $y2 = $yt;
} elseif ($a > $ca1 && $a < $ca2) {
$xt = $x0 + $h * $x / $y;
$yt = $ytop - $margin;
if ($rot90) {
$ha = 'left';
$va = 'center';
} else {
$ha = 'center';
$va = 'bottom';
}
$y1 = $ytop + $tl2;
$y2 = $ytop - $tl;
$x1 = $x2 = $xt;
} elseif ($a >= $ca2 && $a <= $ca3) {
$yt = $pos + $w * $y / $x;
$xt = $xleft - $margin;
if ($rot90) {
$ha = 'center';
$va = 'bottom';
} else {
$ha = 'right';
$va = 'center';
}
$x1 = $xleft + $tl2;
$x2 = $xleft - $tl;
$y1 = $y2 = $yt;
} else {
$xt = $x0 - $h * $x / $y;
$yt = $ybottom + $margin;
if ($rot90) {
$ha = 'right';
$va = 'center';
} else {
$ha = 'center';
$va = 'top';
}
$y1 = $ybottom - $tl2;
$y2 = $ybottom + $tl;
$x1 = $x2 = $xt;
}
if ($a != 0 && $a != 180) {
$t->Align($ha, $va);
if ($this->show_angle_mark) {
$a .= '°';
}
$t->Set($a);
//.........这里部分代码省略.........
示例4: getHeight
function getHeight($aImg)
{
$scaling = 1;
//$this->iAntiAlias ? 2 : 1 ;
if ($this->iSize > 0 && $this->iSize < 1) {
$this->iSize *= min($aImg->width, $aImg->height);
}
$value = new Text();
$value->SetFont($this->iFontFamily, $this->iFontStyle, $this->iFontSize * $scaling);
$value->SetColor($this->iFontColor);
// Setup extra size around the graph needed so that the labels
// doesn't get cut. For this we need to find the largest label.
// The code below gives a possible a little to large margin. The
// really, really proper way would be to account for what angle
// the label are at
$n = count($this->iLabels);
if ($n > 0) {
$maxh = 0;
$maxw = 0;
foreach ($this->iLabels as $key => $lbl) {
$value->Set($lbl);
$maxh = max($maxh, $value->GetHeight($aImg));
}
} else {
$value->Set('180.8');
// Dummy value to get width/height
$maxh = $value->GetHeight($aImg);
}
// Add an extra margin of 50% the font size
//$maxh += round($this->iFontSize*$scaling * 0.5) ;
$valymarg = 2 * $maxh + 2 * $this->iLabelMargin * $scaling;
$legendheight = round($this->legend->iShow ? 1 : 0);
$legendheight *= max($this->legend->iCircleRadius * 2, $this->legend->iTxtFontSize * 2) + $this->legend->iMargin + $this->legend->iBottomMargin + 2;
$legendheight *= $scaling;
$h = round($this->iSize * $scaling + $valymarg) + $legendheight;
return $h;
}
示例5: SetDatapoints
function SetDatapoints($datapoints)
{
$ny = count($datapoints);
$nx = count($datapoints[0]);
$t = new Text();
$t->SetFont(FF_ARIAL, FS_NORMAL, 8);
for ($x = 0; $x < $nx; ++$x) {
for ($y = 0; $y < $ny; ++$y) {
list($x1, $y1) = $this->scale->Translate($x, $y);
if ($datapoints[$y][$x] > 0) {
$t->SetColor('blue');
} else {
$t->SetColor('black');
}
$t->SetFont(FF_ARIAL, FS_BOLD, 8);
$t->Set($datapoints[$y][$x]);
$t->Stroke($this->g->img, $x1, $y1);
$t->SetColor('gray');
$t->SetFont(FF_ARIAL, FS_NORMAL, 8);
$t->Set("({$y},{$x})");
$t->Stroke($this->g->img, $x1 + 10, $y1);
}
}
}
示例6: Stroke
function Stroke(&$aImg)
{
$scaling = $this->iAntiAlias ? 2 : 1;
$value = new Text();
$value->SetFont($this->iFontFamily, $this->iFontStyle, $this->iFontSize * $scaling);
$value->SetColor($this->iFontColor);
$n = count($this->iLabels);
if ($n > 0) {
$maxh = 0;
$maxw = 0;
foreach ($this->iLabels as $key => $lbl) {
$value->Set($lbl);
$maxh = max($maxh, $value->GetHeight($aImg));
$maxw = max($maxw, $value->GetWidth($aImg) / 2);
}
} else {
$value->Set("180.8");
$maxh = $value->GetHeight($aImg);
$maxw = $value->GetWidth($aImg);
}
$maxh += round($this->iFontSize * $scaling * 0.5);
$maxw += round($this->iFontSize * $scaling * 0.5);
$valxmarg = 2 * $maxw + 2 * $this->iLabelMargin * $scaling;
$valymarg = 2 * $maxh + 2 * $this->iLabelMargin * $scaling;
$w = round($this->iSize * $scaling + $valxmarg);
$legendwidth = $this->_StrokeLegend($aImg, 0, 0, $scaling, true) + 10 * $scaling;
$w = max($w, $legendwidth);
$legendheight = round($this->legend->iShow ? 1 : 0);
$legendheight *= max($this->legend->iCircleRadius * 2, $this->legend->iTxtFontSize * 2) + $this->legend->iMargin + $this->legend->iBottomMargin + 2;
$legendheight *= $scaling;
$h = round($this->iSize * $scaling + $valymarg) + $legendheight;
if ($this->iAntiAlias) {
$dblImg = new Image($w, $h);
$dblImg->SetColor($this->iColor);
$dblImg->FilledRectangle(0, 0, $w, $h);
} else {
$dblImg =& $aImg;
$dblImg->SetTranslation($this->iX - $w / 2, $this->iY - $h / 2);
}
if (__DEBUG) {
$dblImg->SetColor('red');
$dblImg->Rectangle(0, 0, $w - 1, $h - 1);
}
$dblImg->SetColor('black');
if ($this->iShowBox) {
$dblImg->SetColor($this->iBoxColor);
$dblImg->SetLineWeight($this->iBoxWeight);
$dblImg->Rectangle(0, 0, $w - 1, $h - 1);
$dblImg->SetLineWeight(1);
}
$xc = round($w / 2);
$yc = round(($h - $legendheight) / 2);
$this->iSize *= $scaling;
$ri = $this->iCenterSize / 2;
$r = round($this->iSize / 2);
$n = $this->scale->GetNumCirc();
$ri *= $scaling;
$rr = round(($r - $ri) / $n);
for ($i = 1; $i <= $n; ++$i) {
$this->_ThickCircle($dblImg, $xc, $yc, $rr * $i + $ri, $this->iCircGridWeight, $this->iGridColor1);
}
$num = 0;
if ($this->iType == WINDROSE_TYPEFREE) {
$this->_StrokeFreeRose($dblImg, $value, $scaling, $xc, $yc, $r, $ri);
} else {
if ($this->iOrdinalEncoding == KEYENCODING_CLOCKWISE) {
if ($this->iType == WINDROSE_TYPE16) {
$const1 = 19;
$const2 = 16;
} elseif ($this->iType == WINDROSE_TYPE8) {
$const1 = 9;
$const2 = 8;
} else {
$const1 = 4;
$const2 = 4;
}
$tmp = array();
$n = count($this->iData);
foreach ($this->iData as $key => $val) {
if (is_numeric($key)) {
$key = ($const1 - $key) % $const2;
}
$tmp[$key] = $val;
}
$this->iData = $tmp;
}
$this->_StrokeRegularRose($dblImg, $value, $scaling, $xc, $yc, $r, $ri);
}
$this->scale->iFontSize *= $scaling;
$this->scale->iZFontSize *= $scaling;
$this->scale->StrokeLabels($dblImg, $xc, $yc, $ri, $rr);
$this->_ThickCircle($dblImg, $xc, $yc, $ri, $this->iCircGridWeight, $this->iGridColor1);
$ww = $w / $scaling;
$hh = $h / $scaling;
if ($ww > $aImg->width) {
JpgraphError::RaiseL(22020);
}
$x = $xc;
$y = $h;
$this->_StrokeLegend($dblImg, $x, $y, $scaling);
//.........这里部分代码省略.........
示例7: SetTitle
function SetTitle($aTitle, $aAdjustAlign = 'high')
{
$this->title->Set($aTitle);
$this->title_adjust = $aAdjustAlign;
}
示例8: Graph
$grafiekServ = new Pdf_en_GrafiekService();
$leerling = $grafiekServ->maakPuntenLeerling($trimister, $id);
$klasgemiddelde = $grafiekServ->maakKlasgemiddelde($trimister, $klas);
// Create the graph -- these two calls are required
$graph = new Graph(650, 450);
$graph->SetScale("textlin");
/////////////////////////////////////////IF LEERLING || KLASGEMIDDELDE IS EMPTY
/////////////////////////////////////////MAAK ZELF ARRAYS
if (empty($leerling) || empty($klasgemiddelde)) {
//punten leerling
$leerling = array("WIS" => 95, "GES" => 45, "AAR" => 75, "NED" => 69, "LO" => 76);
$klasgemiddelde = array("WIS" => 81, "GES" => 63, "AAR" => 70, "NED" => 73, "LO" => 65);
$txt = new Text();
$txt->SetFont(FF_ARIAL, FS_NORMAL, 25);
$txt->SetColor('gray');
$txt->Set(" VOORBEELDGRAFIEK");
$txt->SetParagraphAlign('left');
$txt->SetPos(0.5600000000000001, 0.65, 'right');
$txt->SetBox('black');
$graph->Add($txt);
}
//TOTAAL KLASGEMIDDELDE EN TOTAAL GEMIDDELDE LEERLING BEREKENEN
$counter = 0;
$totaal = 0;
foreach ($klasgemiddelde as $key => $value) {
$totaal += $value;
$counter++;
}
$klasgemid = round($totaal / $counter, 1) . "%";
$counter2 = 0;
$totaal2 = 0;
示例9: strokeLabels
function strokeLabels()
{
$t = new Text();
$t->SetColor($this->labelColor);
$t->SetFont($this->labelFF, $this->labelFS, $this->labelFSize);
$t->SetAlign('center', 'center');
foreach ($this->labels as $cont_idx => $pos) {
if ($cont_idx >= 10) {
return;
}
foreach ($pos as $idx => $coord) {
$t->Set(sprintf("%.1f", $coord[2]));
$t->SetAngle($coord[3]);
$t->Stroke($this->g->img, $coord[0], $coord[1]);
}
}
}
示例10: Draw
public function Draw($aTitle, $aStart, $aEnd, $n = 64, $aReverse = false, $addColorNames = false)
{
// Setup to draw colormap with names platoe colors
$lmarg = ColorMapDriver::LMARG;
// left margin
$rmarg = ColorMapDriver::RMARG;
// right margin
$width = ColorMapDriver::WIDTH;
// Overall image width
// Module height
$mh = ColorMapDriver::MODHEIGHT;
// Step between each map
$ymarg = $mh + ColorMapDriver::MAPMARG;
if ($addColorNames) {
$ymarg += 50;
}
// Start position
$xs = $lmarg;
$ys = ColorMapDriver::YSTART;
// Setup a basic canvas graph
$height = ($aEnd - $aStart + 1) * $ymarg + 50;
$graph = new CanvasGraph($width, $height);
$graph->img->SetColor('darkgray');
$graph->img->Rectangle(0, 0, $width - 1, $height - 1);
$t = new Text($aTitle, $width / 2, 5);
$t->SetAlign('center', 'top');
$t->SetFont(FF_ARIAL, FS_BOLD, 14);
$t->Stroke($graph->img);
// Instantiate a colormap
$cm = new ColorMap();
$cm->InitRGB($graph->img->rgb);
for ($mapidx = $aStart; $mapidx <= $aEnd; ++$mapidx, $ys += $ymarg) {
$cm->SetMap($mapidx, $aReverse);
$n = $cm->SetNumColors($n);
list($mapidx, $maparray) = $cm->GetCurrMap();
$ncols = count($maparray);
$colbuckets = $cm->GetBuckets();
// The module width will depend on the actual number of colors
$mw = round(($width - $lmarg - $rmarg) / $n);
// Draw color map title (name)
$t->Set('Basic colors: ' . $ncols . ', Total colors: ' . $n);
$t->SetAlign('center', 'bottom');
$t->SetAngle(0);
$t->SetFont(FF_TIMES, FS_NORMAL, 14);
$t->Stroke($graph->img, $width / 2, $ys - 3);
// Add the name/number of the map to the left
$t->SetAlign('right', 'center');
$t->Set('Map: ' . $mapidx);
$t->SetFont(FF_ARIAL, FS_NORMAL, 14);
$t->Stroke($graph->img, $xs - 20, round($ys + $mh / 2));
// Setup text properties for the color names
if ($addColorNames) {
$t->SetAngle(30);
$t->SetFont(FF_ARIAL, FS_NORMAL, 12);
$t->SetAlign('right', 'top');
}
// Loop through all colors in the map
$x = $xs;
$y = $ys;
$k = 0;
for ($i = 0; $i < $n; ++$i) {
$graph->img->SetColor($colbuckets[$i]);
$graph->img->FilledRectangle($x, $y, $x + $mw, $y + $mh);
// Mark all basic colors in the map with a bar and name
if ($i % (($n - $ncols) / ($ncols - 1) + 1) == 0) {
$graph->img->SetColor('black');
$graph->img->FilledRectangle($x, $y + $mh + 4, $x + $mw - 1, $y + $mh + 6);
if ($addColorNames) {
$t->Set($maparray[$k++]);
$t->Stroke($graph->img, $x + $mw / 2, $y + $mh + 10);
}
}
$x += $mw;
}
// Draw a border around the map
$graph->img->SetColor('black');
$graph->img->Rectangle($xs, $ys, $xs + $mw * $n, $ys + $mh);
}
// Send back to client
$graph->Stroke();
}
示例11: Stroke
/**
* Internal. Stroke labels
* @param MatrixPlot $aMPlot
* @param Image $aImg
*/
function Stroke(MatrixPlot $aMPlot, Image $aImg)
{
$t = new Text();
$t->SetColor($this->iColor);
$t->SetFont($this->iFF, $this->iFS, $this->iFSize);
$n = count($this->iLabels);
$rows = count($aMPlot->iData);
$cols = count($aMPlot->iData[0]);
list($modwidth, $modheight) = $aMPlot->GetModSizes();
$x = $this->iStartX;
$y = $this->iStartY;
if (!empty($this->csimtargets) || is_array($this->csimtargets) && count($this->csimtargets) == 0) {
$csn = count($this->csimtargets);
if ($csn != $n) {
JpGraphError::RaiseL(29210, $csn, $n);
// CSIM Target for matrix labels must be the same length as the labels
}
}
$csim = '';
switch ($this->iSide) {
case 'top':
case 'bottom':
$t->SetAngle($this->iAngle);
$x += round($modwidth / 2);
if ($this->iSide == 'top') {
$y -= $this->iMargin;
$t->SetAlign('center', 'bottom');
} else {
$y += $this->iMargin + $rows * $modheight;
if ($this->iAngle > 0 && $this->iAngle < 90) {
$t->SetAlign('right', 'top');
} else {
$t->SetAlign('center', 'top');
}
}
for ($i = 0; $i < $n && $i < $cols; ++$i, $x += $modwidth) {
$t->Set($this->iLabels[$i]);
if (!empty($this->csimtargets)) {
if (!empty($this->csimalts[$i]) && !empty($this->csimwintargets[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], $this->csimalts[$i], $this->csimwintargets[$i]);
} elseif (!empty($this->csimalts[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], $this->csimalts[$i]);
} elseif (!empty($this->csimwintargets[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], '', $this->csimwintargets[$i]);
} else {
$t->SetCSIMTarget($this->csimtargets[$i]);
}
}
$t->Stroke($aImg, $x, $y);
$csim .= $t->GetCSIMareas();
}
break;
case 'left':
case 'right':
$t->SetAngle($this->iAngle);
$y += round($modheight / 2);
if ($this->iSide == 'left') {
$x -= $this->iMargin + 1;
$t->SetAlign('right', 'center');
} else {
$x += $this->iMargin + $cols * $modwidth;
$t->SetAlign('left', 'center');
}
for ($i = 0; $i < $n && $i < $rows; ++$i, $y += $modheight) {
$t->Set($this->iLabels[$i]);
if (!empty($this->csimtargets)) {
if (!empty($this->csimalts[$i]) && !empty($this->csimwintargets[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], $this->csimalts[$i], $this->csimwintargets[$i]);
} elseif (!empty($this->csimalts[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], $this->csimalts[$i]);
} elseif (!empty($this->csimwintargets[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], '', $this->csimwintargets[$i]);
} else {
$t->SetCSIMTarget($this->csimtargets[$i]);
}
}
$t->Stroke($aImg, $x, $y);
$csim .= $t->GetCSIMareas();
}
break;
}
$this->csimareas = $csim;
}
示例12: Text
$activity2->SetPattern(BAND_RDIAG, "yellow");
$activity2->SetFillColor("red");
// Set absolute height
$activity2->SetHeight(10);
// Specify progress to 30%
$activity2->progress->Set(0.3);
$activity2->progress->SetPattern(BAND_HVCROSS, "blue");
// Finally add the bar to the graph
$graph->Add($activity);
$graph->Add($activity2);
// Add text to top left corner of graph
$txt1 = new Text();
$txt1->SetPos(5, 2);
$txt1->Set("Note:\nEstimate done w148");
$txt1->SetFont(FF_ARIAL, FS_BOLD, 12);
$txt1->SetColor('darkred');
$graph->Add($txt1);
// Add text to the top bar
$txt2 = new Text();
$txt2->SetScalePos("2002-01-01", 1);
$txt2->SetFont(FF_ARIAL, FS_BOLD, 12);
$txt2->SetAlign('left', 'center');
$txt2->Set("Remember this!");
$txt2->SetBox('yellow');
$graph->Add($txt2);
// Add a vertical line
$vline = new GanttVLine("2001-12-24", "Phase 1");
$vline->SetDayOffset(0.5);
//$graph->Add($vline);
// ... and display it
$graph->Stroke();
示例13: StrokeLabels
/**
* Stroke all stored labels to the plot
*
* @return void
*/
function StrokeLabels()
{
$t = new Text();
$t->SetColor($this->labelColor);
$t->SetFont($this->labelFF, $this->labelFS, $this->labelFSize);
$t->SetAlign('center', 'center');
foreach ($this->labels as $cont_idx => $pos) {
// FIXME:
//if( $cont_idx >= 10 ) return;
foreach ($pos as $idx => $coord) {
$t->Set(sprintf("%.1f", $coord[2]));
if ($this->angledLabels) {
$t->SetAngle($coord[3]);
}
//$t->SetBox2('lightyellow:1.9');
$t->Stroke($this->img, $coord[0], $coord[1]);
}
}
}
示例14: init_graphs
function init_graphs()
{
global $rundate;
// Create the graphs
$tdate1 = new Text();
$tdate1->SetFont(FF_ARIAL, FS_NORMAL, 8);
$tdate1->SetColor("#000000");
$tdate1->Set("generated at: {$rundate}");
$tdate1->SetBox("#ffffff", "#8b898b", "#aaaaaa", 0, 0);
$tdate1->SetPos(280, 220);
$tdate2 = new Text();
$tdate2->SetFont(FF_ARIAL, FS_NORMAL, 8);
$tdate2->SetColor("#000000");
$tdate2->Set("generated at: {$rundate}");
$tdate2->SetBox("#ffffff", "#8b898b", "#aaaaaa", 0, 0);
$tdate2->SetPos(560, 420);
// ** ------------- **
$graph1 = new Graph(470, 250, "auto");
$graph1->SetScale("textlin");
$graph1->SetShadow();
$graph1->SetBox();
$graph1->img->SetMargin(60, 30, 30, 80);
$graph1->SetMarginColor('#ececec');
$graph1->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph1->AddText($tdate1);
// --------------
$graph1->ygrid->Show(true, true);
$graph1->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph1->yaxis->title->SetAngle(90);
$graph1->yaxis->SetTitleMargin(40);
$graph1->yaxis->title->Text("Translated Messages", "high");
$graph1->yaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$graph1->yaxis->SetLabelAngle(0);
$graph1->yaxis->SetPos('min');
// -------------
$graph1->xgrid->Show(false, false);
$graph1->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph1->xaxis->title->SetAngle(0);
$graph1->xaxis->title->Text("Days");
$graph1->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$graph1->xaxis->SetLabelAngle(30);
$graph1->xaxis->SetTextLabelInterval(10);
$graph1->xaxis->SetPos('min');
$sline = new PlotLine(HORIZONTAL, 0, "black", 1);
$graph1->Add($sline);
// ** ------------- **
$graph2 = new Graph(750, 450, "auto");
$graph2->SetScale("textlin");
$graph2->SetShadow();
$graph2->SetBox();
$graph2->img->SetMargin(60, 30, 30, 80);
$graph2->SetMarginColor('#ececec');
$graph2->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph2->AddText($tdate2);
// --------------
$graph2->ygrid->Show(true, true);
$graph2->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph2->yaxis->title->SetAngle(90);
$graph2->yaxis->SetTitleMargin(40);
$graph2->yaxis->title->Text("Translated Messages", "high");
$graph2->yaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$graph2->yaxis->SetLabelAngle(0);
$graph2->yaxis->SetPos('min');
// -------------
$graph2->xgrid->Show(true, false);
$graph2->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph2->xaxis->title->SetAngle(0);
$graph2->xaxis->title->Text("Days");
$graph2->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$graph2->xaxis->SetLabelAngle(30);
$graph2->xaxis->SetTextLabelInterval(10);
$graph2->xaxis->SetPos('min');
$sline = new PlotLine(HORIZONTAL, 0, "black", 1);
$graph2->Add($sline);
return array($graph1, $graph2);
}
示例15: StrokeLabels
public function StrokeLabels($aImg, $xc, $yc, $ri, $rr)
{
if ($this->iHideLabels) {
return;
}
// Setup some convinient vairables
$a = $this->iAngle * M_PI / 180.0;
$n = $this->iNumCirc;
$d = $this->iDelta;
// Setup the font and font color
$val = new Text();
$val->SetFont($this->iFontFamily, $this->iFontStyle, $this->iFontSize);
$val->SetColor($this->iFontColor);
if ($this->iFontBkgColor !== false) {
$val->SetBox($this->iFontBkgColor, $this->iFontFrameColor);
}
// Position the labels relative to the radiant circles
if ($this->iLblAlign == LBLALIGN_TOP) {
if ($a > 0 && $a <= M_PI / 2) {
$val->SetAlign('left', 'bottom');
} elseif ($a > M_PI / 2 && $a <= M_PI) {
$val->SetAlign('right', 'bottom');
}
} elseif ($this->iLblAlign == LBLALIGN_CENTER) {
$val->SetAlign('center', 'center');
}
// Stroke the labels close to each circle
$v = $d;
$si = sin($a);
$co = cos($a);
for ($i = 0; $i < $n; ++$i, $v += $d) {
$r = $ri + ($i + 1) * $rr;
$x = $xc + $co * $r;
$y = $yc - $si * $r;
$val->Set(sprintf($this->iLblFmt, $v));
$val->Stroke($aImg, $x, $y);
}
// Print the text in the zero circle
if ($this->iLblZeroTxt === null) {
$this->iLblZeroTxt = sprintf($this->iLblFmt, $this->iZeroSum);
} else {
$this->iLblZeroTxt = sprintf($this->iLblZeroTxt, $this->iZeroSum);
}
$val->Set($this->iLblZeroTxt);
$val->SetAlign('center', 'center');
$val->SetParagraphAlign('center');
$val->SetColor($this->iZFontColor);
$val->SetFont($this->iZFontFamily, $this->iZFontStyle, $this->iZFontSize);
$val->Stroke($aImg, $xc, $yc);
}