当前位置: 首页>>代码示例>>PHP>>正文


PHP Text::Stroke方法代码示例

本文整理汇总了PHP中Text::Stroke方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::Stroke方法的具体用法?PHP Text::Stroke怎么用?PHP Text::Stroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Text的用法示例。


在下文中一共展示了Text::Stroke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addTextToGraph

 /**
  * @return Text
  */
 private function addTextToGraph($msg, $padding_left, $padding_top, $font_weight, $font_size, $img_width)
 {
     $text = new Text($msg, $padding_left, $padding_top);
     $text->SetFont($this->getFont(), $font_weight, $font_size);
     $text->SetColor($this->getMainColor());
     //word wrap
     $width = $text->GetWidth($this->jpgraph_instance->img) - $padding_left;
     $text->SetWordWrap(floor(strlen($msg) * ($this->img_width - 3 * $padding_left) / $width));
     $text->Stroke($this->jpgraph_instance->img);
     return $text;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:ErrorChart.class.php

示例2: 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);
 }
开发者ID:nicolaisi,项目名称:adei,代码行数:52,代码来源:welcome.php

示例3: 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);
 }
开发者ID:nicolaisi,项目名称:adei,代码行数:36,代码来源:drawtext.php

示例4: 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
//.........这里部分代码省略.........
开发者ID:rebuy-de,项目名称:jpgraph,代码行数:101,代码来源:pdf417_backends.inc.php

示例5: 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

示例6: 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);
//.........这里部分代码省略.........
开发者ID:kractos26,项目名称:orfeo,代码行数:101,代码来源:jpgraph_polar.php

示例7: 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

示例8: 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

示例9: displayGraph


//.........这里部分代码省略.........
            $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");
                $graph->legend->SetFillColor("#fafafa");
                $graph->legend->SetColor("#444444", "#999999");
                $graph->legend->SetShadow('gray@0.6', 4);
                $graph->legend->SetColumns($G_LEYEND_NUM_COLUMN);
                $graph->title->Set($G_TITLE);
                $pieplot3d = new PiePlot3d($G_YDATAS[0]);
                $pieplot3d->SetSliceColors($G_ARR_COLOR);
                $pieplot3d->SetCenter(0.4);
                $pieplot3d->SetSize($dataSizePie);
                $pieplot3d->SetAngle(45);
                $pieplot3d->SetStartAngle(45);
                $pieplot3d->value->SetColor('black');
                //color a los porcentages
                $pieplot3d->SetEdge('black');
                //da color al contorno y separacion del pastel
                $pieplot3d->SetLegends($xData);
                $graph->Add($pieplot3d);
                $graph->Stroke();
            } else {
                if ($G_TYPE == 'plot3d2') {
                    if (!function_exists('displayGraph_draw_pie3d')) {
开发者ID:hardikk,项目名称:HNH,代码行数:67,代码来源:paloSantoGraphImage.lib.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: 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

示例12: Stroke

 function Stroke(&$img, $aVal, $x, $y)
 {
     if ($this->show) {
         if ($this->negformat == "") {
             $this->negformat = $this->format;
         }
         if ($this->negcolor == "") {
             $this->negcolor = $this->color;
         }
         if ($aVal === NULL || is_string($aVal) && ($aVal == "" || $aVal == "-" || $aVal == "x")) {
             return;
         }
         if (is_numeric($aVal) && $aVal == 0 && $this->iHideZero) {
             return;
         }
         if ($this->iFormCallback != '') {
             $f = $this->iFormCallback;
             $sval = call_user_func($f, $aVal);
         } elseif (is_numeric($aVal)) {
             if ($aVal >= 0) {
                 $sval = sprintf($this->format, $aVal);
             } else {
                 $sval = sprintf($this->negformat, $aVal);
             }
         } else {
             $sval = $aVal;
         }
         $y = $y - sign($aVal) * $this->margin;
         $txt = new Text($sval, $x, $y);
         $txt->SetFont($this->ff, $this->fs, $this->fsize);
         if ($this->valign == "") {
             if ($aVal >= 0) {
                 $valign = "bottom";
             } else {
                 $valign = "top";
             }
         } else {
             $valign = $this->valign;
         }
         $txt->Align($this->halign, $valign);
         $txt->SetOrientation($this->angle);
         if ($aVal > 0) {
             $txt->SetColor($this->color);
         } else {
             $txt->SetColor($this->negcolor);
         }
         $txt->Stroke($img);
     }
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:49,代码来源:jpgraph.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: 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);
         }
     }
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:24,代码来源:findpolygon.php

示例15: Raise

 function Raise($aMsg, $aHalt = true)
 {
     $img_iconerror = 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAaV' . 'BMVEX//////2Xy8mLl5V/Z2VvMzFi/v1WyslKlpU+ZmUyMjEh/' . 'f0VyckJlZT9YWDxMTDjAwMDy8sLl5bnY2K/MzKW/v5yyspKlpY' . 'iYmH+MjHY/PzV/f2xycmJlZVlZWU9MTEXY2Ms/PzwyMjLFTjea' . 'AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACx' . 'IAAAsSAdLdfvwAAAAHdElNRQfTBgISOCqusfs5AAABLUlEQVR4' . '2tWV3XKCMBBGWfkranCIVClKLd/7P2Q3QsgCxjDTq+6FE2cPH+' . 'xJ0Ogn2lQbsT+Wrs+buAZAV4W5T6Bs0YXBBwpKgEuIu+JERAX6' . 'wM2rHjmDdEITmsQEEmWADgZm6rAjhXsoMGY9B/NZBwJzBvn+e3' . 'wHntCAJdGu9SviwIwoZVDxPB9+Rc0TSEbQr0j3SA1gwdSn6Db0' . '6Tm1KfV6yzWGQO7zdpvyKLKBDmRFjzeB3LYgK7r6A/noDAfjtS' . 'IXaIzbJSv6WgUebTMV4EoRB8a2mQiQjgtF91HdKDKZ1gtFtQjk' . 'YcWaR5OKOhkYt+ZsTFdJRfPAApOpQYJTNHvCRSJR6SJngQadfc' . 'vd69OLMddVOPCGVnmrFD8bVYd3JXfxXPtLR/+mtv59/ALWiiMx' . 'qL72fwAAAABJRU5ErkJggg==';
     if (function_exists("imagetypes")) {
         $supported = imagetypes();
     } else {
         $supported = 0;
     }
     if (!function_exists('imagecreatefromstring')) {
         $supported = 0;
     }
     if (ob_get_length() || headers_sent() || !($supported & IMG_PNG)) {
         die($this->iTitle . ' ' . $aMsg);
     }
     $aMsg = wordwrap($aMsg, 55);
     $lines = substr_count($aMsg, "\n");
     $erricon = Image::CreateFromString(base64_decode($img_iconerror));
     $w = 400;
     $h = 100 + 15 * max(0, $lines - 3);
     $img = new Image($w, $h);
     $img->SetColor("gray");
     $img->FilledRectangle(5, 5, $w - 1, $h - 1, 10);
     $img->SetColor("gray:0.7");
     $img->FilledRectangle(5, 5, $w - 3, $h - 3, 10);
     $img->SetColor("lightblue");
     $img->FilledRectangle(1, 1, $w - 5, $h - 5);
     $img->CopyCanvasH($img->img, $erricon, 5, 30, 0, 0, 40, 40);
     $img->SetColor("black");
     $img->Rectangle(1, 1, $w - 5, $h - 5);
     $img->Rectangle(0, 0, $w - 4, $h - 4);
     $img->SetColor("darkred");
     for ($y = 3; $y < 18; $y += 2) {
         $img->Line(1, $y, $w - 6, $y);
     }
     $img->SetColor("white");
     $img->Line(2, 2, 2, $h - 5);
     $img->Line(2, 2, $w - 6, 2);
     $img->SetColor("darkgray");
     $img->Line(2, $h - 6, $w - 5, $h - 6);
     $img->Line(3, $h - 7, $w - 5, $h - 7);
     $m = floor($w / 2 - 5);
     $l = 100;
     $img->SetColor("lightgray:1.3");
     $img->FilledRectangle($m - $l, 2, $m + $l, 16);
     $img->SetColor("darkred");
     $img->SetFont(FF_FONT2, FS_BOLD);
     $img->StrokeText($m - 50, 15, $this->iTitle);
     $img->SetColor("black");
     $img->SetFont(FF_FONT1, FS_NORMAL);
     $txt = new Text($aMsg, 52, 25);
     $txt->Align("left", "top");
     $txt->Stroke($img);
     if ($this->iDest) {
         $img->Stream($this->iDest);
     } else {
         $img->Headers();
         $img->Stream();
     }
     if ($aHalt) {
         die;
     }
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:62,代码来源:jpgraph_errhandler.inc.php


注:本文中的Text::Stroke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。