當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Text::SetAlign方法代碼示例

本文整理匯總了PHP中Text::SetAlign方法的典型用法代碼示例。如果您正苦於以下問題:PHP Text::SetAlign方法的具體用法?PHP Text::SetAlign怎麽用?PHP Text::SetAlign使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Text的用法示例。


在下文中一共展示了Text::SetAlign方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: CanvasGraph

$txt = "The day was rapidly becoming more and\nmore strange.\n\nNot only had he managed to\nget by the first pass without so much as\na hint of questions but now when he\ncould feel that the second pass wouldn't\nlong be noone had yet seen him.";
$w = 950;
$h = 250;
$xm = 20;
$ym = 20;
$tw = 300;
$g = new CanvasGraph($w, $h);
$img = $g->img;
// Alignment for anchor points to use
$palign = array('left', 'center', 'right');
$n = count($palign);
$t = new Text($txt);
$y = $ym;
for ($i = 0; $i < $n; ++$i) {
    $x = $xm + $i * $tw;
    $t->SetColor('black');
    $t->SetAlign('left', 'top');
    $t->SetFont(FF_ARIAL, FS_NORMAL, 11);
    $t->SetBox();
    $t->SetParagraphAlign($palign[$i]);
    $t->Stroke($img, $x, $y);
    $img->SetColor('black');
    $img->SetFont(FF_FONT1, FS_BOLD);
    $img->SetTextAlign('center', 'top');
    $img->StrokeText($x + 140, $y + 160, '"' . $palign[$i] . '"' . ' pargraph align');
}
// .. and send back to browser
$g->Stroke();
?>

開發者ID:youli023023,項目名稱:zabbix_api,代碼行數:29,代碼來源:textpalignex1.php

示例2: count

 function _StrokeLegend($aImg, $x, $y, $scaling = 1, $aReturnWidth = false)
 {
     if (!$this->legend->iShow) {
         return 0;
     }
     $nlc = count($this->iLegColors);
     $nlw = count($this->iLegweights);
     // Setup font for ranges
     $value = new Text();
     $value->SetAlign('center', 'bottom');
     $value->SetFont($this->legend->iLblFontFamily, $this->legend->iLblFontStyle, $this->legend->iLblFontSize * $scaling);
     $value->SetColor($this->legend->iLblFontColor);
     // Remember x-center
     $xcenter = $x;
     // Construct format string
     $fmt = $this->legend->iFormatString . '-' . $this->legend->iFormatString;
     // Make sure that the length of each range is enough to cover the
     // size of the labels
     $tst = sprintf($fmt, $this->iRanges[0], $this->iRanges[1]);
     $value->Set($tst);
     $w = $value->GetWidth($aImg);
     $l = round(max($this->legend->iLength * $scaling, $w * 1.5));
     $r = $this->legend->iCircleRadius * $scaling;
     $len = 2 * $r + $this->scale->iMaxNum * $l;
     // We are called just to find out the width
     if ($aReturnWidth) {
         return $len;
     }
     $x -= round($len / 2);
     $x += $r;
     // 4 pixels extra vertical margin since the circle sometimes is +/- 1 pixel of the
     // theorethical radius due to imperfection in the GD library
     //$y -= round(max($r,$scaling*$this->iLegweights[($this->scale->iMaxNum-1) % $nlw])+4*$scaling);
     $y -= ($this->legend->iCircleRadius + 2) * $scaling + $this->legend->iBottomMargin * $scaling;
     // Adjust for bottom text
     if ($this->legend->iTxt != '') {
         // Setup font for text
         $value->Set($this->legend->iTxt);
         $y -= $value->GetHeight($aImg);
     }
     // Stroke 0-circle
     $this->_ThickCircle($aImg, $x, $y, $r, $this->legend->iCircleWeight, $this->legend->iCircleColor);
     // Remember the center of the circe
     $xc = $x;
     $yc = $y;
     $value->SetAlign('center', 'bottom');
     $x += $r + 1;
     // Stroke all used ranges
     $txty = $y - round($this->iLegweights[($this->scale->iMaxNum - 1) % $nlw] * $scaling) - 4 * $scaling;
     if ($this->scale->iMaxNum >= count($this->iRanges)) {
         JpGraphError::RaiseL(22007);
         //('To few values for the range legend.');
     }
     $i = 0;
     $idx = 0;
     while ($i < $this->scale->iMaxNum) {
         $y1 = $y - round($this->iLegweights[$i % $nlw] * $scaling);
         $y2 = $y + round($this->iLegweights[$i % $nlw] * $scaling);
         $x2 = $x + $l;
         $aImg->SetColor($this->iLegColors[$i % $nlc]);
         $aImg->FilledRectangle($x, $y1, $x2, $y2);
         if ($this->iRangeStyle == RANGE_OVERLAPPING) {
             $lbl = sprintf($fmt, $this->iRanges[$idx], $this->iRanges[$idx + 1]);
         } else {
             $lbl = sprintf($fmt, $this->iRanges[$idx], $this->iRanges[$idx + 1]);
             ++$idx;
         }
         $value->Set($lbl);
         $value->Stroke($aImg, $x + $l / 2, $txty);
         $x = $x2;
         ++$i;
         ++$idx;
     }
     // Setup circle font
     $value->SetFont($this->legend->iCircleFontFamily, $this->legend->iCircleFontStyle, $this->legend->iCircleFontSize * $scaling);
     $value->SetColor($this->legend->iCircleFontColor);
     // Stroke 0-circle text
     $value->Set($this->legend->iZCircleTxt);
     $value->SetAlign('center', 'center');
     $value->ParagraphAlign('center');
     $value->Stroke($aImg, $xc, $yc);
     // Setup circle font
     $value->SetFont($this->legend->iTxtFontFamily, $this->legend->iTxtFontStyle, $this->legend->iTxtFontSize * $scaling);
     $value->SetColor($this->legend->iTxtFontColor);
     // Draw the text under the legend
     $value->Set($this->legend->iTxt);
     $value->SetAlign('center', 'top');
     $value->SetParagraphAlign('center');
     $value->Stroke($aImg, $xcenter, $y2 + $this->legend->iTxtMargin * $scaling);
 }
開發者ID:muthulatha,項目名稱:iem,代碼行數:90,代碼來源:jpgraph_windrose.php

示例3: count

 function _StrokeLegend(&$aImg, $x, $y, $scaling = 1, $aReturnWidth = false)
 {
     if (!$this->legend->iShow) {
         return;
     }
     $nlc = count($this->iLegColors);
     $nlw = count($this->iLegweights);
     $value = new Text();
     $value->SetAlign('center', 'bottom');
     $value->SetFont($this->legend->iLblFontFamily, $this->legend->iLblFontStyle, $this->legend->iLblFontSize * $scaling);
     $value->SetColor($this->legend->iLblFontColor);
     $xcenter = $x;
     $fmt = $this->legend->iFormatString . '-' . $this->legend->iFormatString;
     $tst = sprintf($fmt, $this->iRanges[0], $this->iRanges[1]);
     $value->Set($tst);
     $w = $value->GetWidth($aImg);
     $l = round(max($this->legend->iLength * $scaling, $w * 1.5));
     $r = $this->legend->iCircleRadius * $scaling;
     $len = 2 * $r + $this->scale->iMaxNum * $l;
     if ($aReturnWidth) {
         return $len;
     }
     $x -= round($len / 2);
     $x += $r;
     $y -= ($this->legend->iCircleRadius + 2) * $scaling + $this->legend->iBottomMargin * $scaling;
     if ($this->legend->iTxt != '') {
         $value->Set($this->legend->iTxt);
         $y -= $value->GetHeight($aImg);
     }
     $this->_ThickCircle($aImg, $x, $y, $r, $this->legend->iCircleWeight, $this->legend->iCircleColor);
     $xc = $x;
     $yc = $y;
     $value->SetAlign('center', 'bottom');
     $x += $r + 1;
     $txty = $y - round($this->iLegweights[($this->scale->iMaxNum - 1) % $nlw] * $scaling) - 4 * $scaling;
     if ($this->scale->iMaxNum >= count($this->iRanges)) {
         JpGraphError::RaiseL(22007);
     }
     $i = 0;
     $idx = 0;
     while ($i < $this->scale->iMaxNum) {
         $y1 = $y - round($this->iLegweights[$i % $nlw] * $scaling);
         $y2 = $y + round($this->iLegweights[$i % $nlw] * $scaling);
         $x2 = $x + $l;
         $aImg->SetColor($this->iLegColors[$i % $nlc]);
         $aImg->FilledRectangle($x, $y1, $x2, $y2);
         if ($this->iRangeStyle == RANGE_OVERLAPPING) {
             $lbl = sprintf($fmt, $this->iRanges[$idx], $this->iRanges[$idx + 1]);
         } else {
             $lbl = sprintf($fmt, $this->iRanges[$idx], $this->iRanges[$idx + 1]);
             ++$idx;
         }
         $value->Set($lbl);
         $value->Stroke($aImg, $x + $l / 2, $txty);
         $x = $x2;
         ++$i;
         ++$idx;
     }
     $value->SetFont($this->legend->iCircleFontFamily, $this->legend->iCircleFontStyle, $this->legend->iCircleFontSize * $scaling);
     $value->SetColor($this->legend->iCircleFontColor);
     $value->Set($this->legend->iZCircleTxt);
     $value->SetAlign('center', 'center');
     $value->ParagraphAlign('center');
     $value->Stroke($aImg, $xc, $yc);
     $value->SetFont($this->legend->iTxtFontFamily, $this->legend->iTxtFontStyle, $this->legend->iTxtFontSize * $scaling);
     $value->SetColor($this->legend->iTxtFontColor);
     $value->Set($this->legend->iTxt);
     $value->SetAlign('center', 'top');
     $value->SetParagraphAlign('center');
     $value->Stroke($aImg, $xcenter, $y2 + $this->legend->iTxtMargin * $scaling);
 }
開發者ID:natanoj,項目名稱:nuBuilderPro,代碼行數:71,代碼來源:jpgraph_windrose.php

示例4: showError

function showError($msj, $G_SIZE = array(400, 300), $G_TITLE = "")
{
    $graph = new CanvasGraph($G_SIZE[0], $G_SIZE[1], "auto");
    if ($msj == 'nothing') {
        global $_MSJ_NOTHING;
        $titulo = utf8_decode($_MSJ_NOTHING);
        $title = new Text($G_TITLE);
        $title->ParagraphAlign('center');
        $title->SetFont(FF_FONT2, FS_BOLD);
        $title->SetMargin(3);
        $title->SetAlign('center');
        $title->Center(0, $G_SIZE[0], $G_SIZE[1] / 2);
        $graph->AddText($title);
    } else {
        $titulo = utf8_decode($msj);
    }
    $t1 = new Text($titulo);
    $t1->SetBox("white", "black", true);
    $t1->ParagraphAlign("center");
    $t1->SetColor("black");
    $graph->AddText($t1);
    $graph->img->SetColor('navy');
    $graph->img->SetTextAlign('center', 'bottom');
    $graph->img->Rectangle(0, 0, $G_SIZE[0] - 1, $G_SIZE[1] - 1);
    $graph->Stroke();
}
開發者ID:hardikk,項目名稱:HNH,代碼行數:26,代碼來源:paloSantoGraphImage.lib.php

示例5: 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) {
//.........這裏部分代碼省略.........
開發者ID:hcvcastro,項目名稱:pxp,代碼行數:101,代碼來源:ccbpgraph.class.php

示例6: Odometer

    $odo[$i] = new Odometer();
    $odo[$i]->SetColor('lightgray:1.9');
    $odo[$i]->needle->Set(10 + $i * 17);
    $odo[$i]->needle->SetShadow();
    if ($i < 2) {
        $fsize = 10;
    } else {
        $fsize = 8;
    }
    $odo[$i]->scale->label->SetFont(FF_ARIAL, FS_NORMAL, $fsize);
    $odo[$i]->AddIndication(92, 100, 'red');
    $odo[$i]->AddIndication(80, 92, 'orange');
    $odo[$i]->AddIndication(60, 80, 'yellow');
}
// Create the layout
$row1 = new LayoutHor(array($odo[0], $odo[1]));
$row2 = new LayoutHor(array($odo[2], $odo[3], $odo[4]));
$col1 = new LayoutVert(array($row1, $row2));
// Add the odometer to the graph
$graph->Add($col1);
// Add an icon and text
$icon = new IconPlot('jpglogo.jpg', 250, 10, 0.85, 30);
$icon->SetAnchor('center', 'top');
$graph->Add($icon);
$t = new Text('JpGraph', 250, 70);
$t->SetAlign('center', 'top');
#$t->SetFont(FF_VERA,FS_BOLD,11);
$t->SetColor('darkgray');
$graph->Add($t);
// ... and finally stroke and stream the image back to the browser
$graph->Stroke();
開發者ID:Lazaro-Gallo,項目名稱:psmn,代碼行數:31,代碼來源:odotutex19.php

示例7: WindrosePlot

$wp1 = new WindrosePlot($data);
$wp1->SetType(WINDROSE_TYPE16);
// This is the default encoding
$wp1->SetDataKeyEncoding(KEYENCODING_ANTICLOCKWISE);
$wp1->legend->Hide();
$wp1->SetPos($xpos1, $ypos1);
$wp1->SetSize(0.5);
// Create the second plot
$wp2 = new WindrosePlot($data);
$wp2->SetType(WINDROSE_TYPE16);
$wp2->SetDataKeyEncoding(KEYENCODING_CLOCKWISE);
$wp2->legend->Hide();
$wp2->SetPos($xpos2, $ypos1);
$wp2->SetSize(0.5);
$txt1 = new Text('KEYENCODING_ANTICLOCKWISE');
$txt1->SetFont(FF_COURIER, FS_BOLD, 12);
$txt1->SetPos($xpos1, $ypos2);
$txt1->SetAlign('center', 'top');
$txt2 = new Text('KEYENCODING_CLOCKWISE');
$txt2->SetFont(FF_COURIER, FS_BOLD, 12);
$txt2->SetPos($xpos2, $ypos2);
$txt2->SetAlign('center', 'top');
// Finally add it to the graph and send back to the client
$graph->Add($wp1);
$graph->Add($txt1);
$graph->Add($wp2);
$graph->Add($txt2);
$graph->Stroke();
?>

開發者ID:munishsethi777,項目名稱:eliveui,代碼行數:29,代碼來源:windrose_ex9.1.php

示例8: 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]);
         }
     }
 }
開發者ID:pawelzielak,項目名稱:opencaching-pl,代碼行數:17,代碼來源:tri-quad.php

示例9: 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;
 }
開發者ID:nicolaisi,項目名稱:kitcube-lidar,代碼行數:88,代碼來源:jpgraph_matrix.php

示例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();
 }
開發者ID:Lazaro-Gallo,項目名稱:psmn,代碼行數:81,代碼來源:colormaps.php

示例11: ejecutarGrafico

function ejecutarGrafico($value_criteria, $date_start, $date_end)
{
    global $arrLang;
    $data_graph = leerDatosGrafico($value_criteria, $date_start, $date_end);
    if (count($data_graph["values"]) > 0) {
        // Create the Pie Graph.
        $graph = new PieGraph(630, 220, "auto");
        $graph->SetMarginColor('#fafafa');
        $graph->SetFrame(true, '#999999');
        $graph->legend->SetFillColor("#fafafa");
        $graph->legend->SetColor("#444444", "#999999");
        $graph->legend->SetShadow('gray@0.6', 4);
        // Set A title for the plot
        $graph->title->Set(utf8_decode($data_graph["title"]));
        $graph->title->SetColor("#444444");
        $graph->legend->Pos(0.1, 0.2);
        // Create 3D pie plot
        $p1 = new PiePlot3d($data_graph["values"]);
        $p1->SetCenter(0.4);
        $p1->SetSize(100);
        // Adjust projection angle
        $p1->SetAngle(60);
        // Adjsut angle for first slice
        $p1->SetStartAngle(45);
        // Display the slice values
        $p1->value->SetColor("black");
        // Add colored edges to the 3D pie
        // NOTE: You can't have exploded slices with edges!
        $p1->SetEdge("black");
        $p1->SetLegends($data_graph["legend"]);
        $graph->Add($p1);
        $graph->Stroke();
    } else {
        $graph = new CanvasGraph(630, 220, "auto");
        $title = new Text(utf8_decode($data_graph["title"]));
        $title->ParagraphAlign('center');
        $title->SetFont(FF_FONT2, FS_BOLD);
        $title->SetMargin(3);
        $title->SetAlign('center');
        $title->Center(0, 630, 110);
        $graph->AddText($title);
        $t1 = new Text(utf8_decode($arrLang["No records found"]));
        $t1->SetBox("white", "black", true);
        $t1->ParagraphAlign("center");
        $t1->SetColor("black");
        $graph->AddText($t1);
        $graph->img->SetColor('navy');
        $graph->img->SetTextAlign('center', 'bottom');
        $graph->img->Rectangle(0, 0, 629, 219);
        $graph->Stroke();
        /*
               //no hay datos - por ahora muestro una imagen en blanco con mensaje no records found
                header('Content-type: image/png');
                $titulo=utf8_decode($data_graph["title"]);
                $im = imagecreate(630, 220);
                $background_color = imagecolorallocate($im, 255, 255, 255);
                $text_color = imagecolorallocate($im, 233, 14, 91);
                imagestring($im, 10, 5, 5, $titulo. "  -  No records found", $text_color);
                imagepng($im);
                imagedestroy($im);*/
    }
}
開發者ID:hardikk,項目名稱:HNH,代碼行數:62,代碼來源:index.php

示例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();
開發者ID:hcvcastro,項目名稱:pxp,代碼行數:31,代碼來源:gantt_textex1.php

示例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]);
         }
     }
 }
開發者ID:rebuy-de,項目名稱:jpgraph,代碼行數:24,代碼來源:jpgraph_contourf.php

示例14: grafic_trunk2

function grafic_trunk2(&$pDB_ast_cdr, &$pDB_ast, $module_name, $trunk, $dti, $dtf)
{
    //
    require_once "modules/{$module_name}/libs/paloSantoExtention.class.php";
    $objPalo_AST_CDR = new paloSantoExtention($pDB_ast_cdr);
    /* Si la troncal pedida es un grupo, se expande el grupo para averiguar las
       troncales individuales. */
    $regs = NULL;
    if (preg_match('!^DAHDI/(g|r)(\\d+)$!i', $trunk, $regs)) {
        $iGrupoTrunk = (int) $regs[2];
        $gruposTrunk = getTrunkGroupsDAHDI();
        if (is_array($gruposTrunk) && isset($gruposTrunk[$iGrupoTrunk])) {
            $trunk = $gruposTrunk[$iGrupoTrunk];
        }
    }
    //total minutos de llamadas in y out
    $arrayTemp = $objPalo_AST_CDR->loadTrunks($trunk, "numcall", $dti, $dtf);
    $arrResult = $arrayTemp[0];
    //$arrResult[0] => "IN"
    //$arrResult[1] => "OUT"
    $tot = $arrResult[0] + $arrResult[1];
    $usoDisco = $tot != 0 ? 100 * ($arrResult[0] / $tot) : 0;
    if ($tot != 0) {
        $freeDisco = 100 - $usoDisco;
        // Some data
        $data = array($usoDisco, $freeDisco);
        // Create the Pie Graph.
        $graph = new PieGraph(400, 170, "auto");
        //$graph->SetShadow();
        $graph->SetMarginColor('#fafafa');
        $graph->SetFrame(true, '#999999');
        $graph->legend->SetFillColor("#fafafa");
        //$graph->legend->Pos(0.012, 0.5, "right","center");
        $graph->legend->SetColor("#444444", "#999999");
        $graph->legend->SetShadow('gray@0.6', 4);
        //$graph->title->SetColor("#444444");
        // Set A title for the plot
        $graph->title->Set(utf8_decode(_tr("Number of Calls")));
        //$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
        $graph->title->SetColor("#444444");
        $graph->legend->Pos(0.04, 0.2);
        // Create 3D pie plot
        $p1 = new PiePlot3d($data);
        //$p1->SetTheme("water");
        $p1->SetSliceColors(array("#3333cc", "#9999cc", "#CC3333", "#72394a", "#aa3424"));
        $p1->SetCenter(0.3);
        $p1->SetSize(80);
        // Adjust projection angle
        $p1->SetAngle(45);
        // Adjsut angle for first slice
        $p1->SetStartAngle(45);
        // Display the slice values
        //$p1->value->SetFont(FF_ARIAL,FS_BOLD,11);
        //$p1->value->SetColor("navy");
        $p1->value->SetColor("black");
        // Add colored edges to the 3D pies
        // NOTE: You can't have exploded slices with edges!
        $p1->SetEdge("black");
        $p1->SetLegends(array(utf8_decode(_tr("Incoming Calls") . ":  ") . $arrResult[0], utf8_decode(_tr("Outcoming Calls") . ": ") . $arrResult[1]));
        $graph->Add($p1);
        $graph->Stroke();
    } else {
        $graph = new CanvasGraph(400, 140, "auto");
        $title = new Text(utf8_decode(_tr("Number of Calls")));
        $title->ParagraphAlign('center');
        $title->SetFont(FF_FONT2, FS_BOLD);
        $title->SetMargin(3);
        $title->SetAlign('center');
        $title->Center(0, 400, 70);
        $graph->AddText($title);
        $t1 = new Text(utf8_decode(_tr("There are no data to present")));
        $t1->SetBox("white", "black", true);
        $t1->ParagraphAlign("center");
        $t1->SetColor("black");
        $graph->AddText($t1);
        $graph->img->SetColor('navy');
        $graph->img->SetTextAlign('center', 'bottom');
        $graph->img->Rectangle(0, 0, 399, 139);
        $graph->Stroke();
    }
}
開發者ID:netconstructor,項目名稱:elastix-mt-gui,代碼行數:81,代碼來源:index.php

示例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);
 }
開發者ID:solodeuva,項目名稱:polideportivo,代碼行數:50,代碼來源:WindrosePlotScale.php


注:本文中的Text::SetAlign方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。