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


PHP Text::SetFont方法代码示例

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


在下文中一共展示了Text::SetFont方法的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: generate_image

function generate_image($lang, $idx)
{
    global $LANGUAGES;
    $up_to_date = get_stats($idx, $lang, 'uptodate');
    $up_to_date = $up_to_date[0];
    //
    $outdated = @get_stats($idx, $lang, 'outdated');
    $outdated = $outdated[0];
    //
    $missing = get_stats($idx, $lang, 'notrans');
    $missing = $missing[0];
    //
    $no_tag = @get_stats($idx, $lang, 'norev');
    $no_tag = $no_tag[0];
    $data = array($up_to_date, $outdated, $missing, $no_tag);
    $percent = array();
    $total = array_sum($data);
    // Total ammount in EN manual (to calculate percentage values)
    $total_files_lang = $total - $missing;
    // Total ammount of files in translation
    foreach ($data as $value) {
        $percent[] = round($value * 100 / $total);
    }
    $legend = array($percent[0] . '%% up to date (' . $up_to_date . ')', $percent[1] . '%% outdated (' . $outdated . ')', $percent[2] . '%% missing (' . $missing . ')', $percent[3] . '%% without EN-Revision (' . $no_tag . ')');
    $title = 'Details for ' . $LANGUAGES[$lang] . ' PHP Manual';
    $graph = new PieGraph(530, 300);
    $graph->SetShadow();
    $graph->title->Set($title);
    $graph->title->Align('left');
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->legend->Pos(0.02, 0.18, "right", "center");
    $graph->subtitle->Set('(Total: ' . $total_files_lang . ' files)');
    $graph->subtitle->Align('left');
    $graph->subtitle->SetColor('darkred');
    $t1 = new Text(date('m/d/Y'));
    $t1->SetPos(522, 294);
    $t1->SetFont(FF_FONT1, FS_NORMAL);
    $t1->Align("right", 'bottom');
    $t1->SetColor("black");
    $graph->AddText($t1);
    $p1 = new PiePlot3D($data);
    $p1->SetSliceColors(array("#68d888", "#ff6347", "#dcdcdc", "#f4a460"));
    if ($total_files_lang != $up_to_date) {
        $p1->ExplodeAll();
    }
    $p1->SetCenter(0.35, 0.55);
    $p1->value->Show(false);
    $p1->SetLegends($legend);
    $graph->Add($p1);
    $graph->Stroke("../www/images/revcheck/info_revcheck_php_{$lang}.png");
}
开发者ID:phpsource,项目名称:web-doc,代码行数:51,代码来源:gen_picture_info.php

示例4: plot

 function plot()
 {
     $this->_setValues();
     // Create the Pie Graph.
     $graph = new PieGraph(500, 300);
     $graph->SetShadow();
     // Create
     $p1 = new PiePlot($this->_data);
     // Set A title for the plot
     $p1->SetLegends($this->_legends);
     $p1->SetSize(0.3);
     $p1->SetCenter(0.28, 0.5);
     $txt = new Text("Most Visited Titles", 0.15, 0.05);
     $txt->SetFont(FONT1_BOLD);
     $graph->Add($p1);
     $graph->AddText($txt);
     $graph->Stroke();
 }
开发者ID:Ethennoob,项目名称:Web,代码行数:18,代码来源:GraphTopTenTitles.php

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

示例6: array

// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_bar.php';
$datay = array(12, 8, 19, 3, 10, 5);
// Create the graph. These two calls are always required
$graph = new Graph(300, 200);
$graph->SetScale('textlin');
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->img->SetMargin(40, 30, 20, 40);
// Create a bar pot
$bplot = new BarPlot($datay);
$graph->Add($bplot);
// Create and add a new text
$txt = new Text("This is a text\nwith many\nand even\nmore\nlines of text");
$txt->SetPos(0.5, 0.5, 'center', 'center');
$txt->SetFont(FF_FONT2, FS_BOLD);
$txt->ParagraphAlign('center');
$txt->SetBox('yellow', 'navy', 'gray');
$txt->SetColor('red');
$graph->AddText($txt);
// Setup the titles
$graph->title->Set("A simple bar graph");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
// Display the graph
$graph->Stroke();
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:31,代码来源:example25.2.php

示例7: Stroke

 function Stroke($aGraph)
 {
     $aImg = $aGraph->img;
     if ($this->iX > 0 && $this->iX < 1) {
         $this->iX = round($aImg->width * $this->iX);
     }
     if ($this->iY > 0 && $this->iY < 1) {
         $this->iY = round($aImg->height * $this->iY);
     }
     if ($this->iSize > 0 && $this->iSize < 1) {
         $this->iSize *= min($aImg->width, $aImg->height);
     }
     if ($this->iCenterSize > 0 && $this->iCenterSize < 1) {
         $this->iCenterSize *= $this->iSize;
     }
     $this->scale->AutoScale(($this->iSize - $this->iCenterSize) / 2, round(2.5 * $this->scale->iFontSize));
     $scaling = $this->iAntiAlias ? 2 : 1;
     $value = new Text();
     $value->SetFont($this->iFontFamily, $this->iFontStyle, $this->iFontSize * $scaling);
     $value->SetColor($this->iFontColor);
     $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;
     $w = $scaling * $this->getWidth($aImg);
     $h = $scaling * $this->getHeight($aImg);
     // Copy back the double buffered image to the proper canvas
     $ww = $w / $scaling;
     $hh = $h / $scaling;
     // Create the double buffer
     if ($this->iAntiAlias) {
         $dblImg = new RotImage($w, $h);
         // Set the background color
         $dblImg->SetColor($this->iColor);
         $dblImg->FilledRectangle(0, 0, $w, $h);
     } else {
         $dblImg = $aImg;
         // Make sure the ix and it coordinates correpond to the new top left center
         $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);
         $old = $dblImg->SetLineWeight($this->iBoxWeight);
         $dblImg->SetLineStyle($this->iBoxStyle);
         $dblImg->Rectangle(0, 0, $w - 1, $h - 1);
         $dblImg->SetLineWeight($old);
     }
     $xc = round($w / 2);
     $yc = round(($h - $legendheight) / 2);
     if (__DEBUG) {
         $dblImg->SetColor('red');
         $old = $dblImg->SetLineWeight(2);
         $dblImg->Line($xc - 5, $yc - 5, $xc + 5, $yc + 5);
         $dblImg->Line($xc + 5, $yc - 5, $xc - 5, $yc + 5);
         $dblImg->SetLineWeight($old);
     }
     $this->iSize *= $scaling;
     // Inner circle size
     $ri = $this->iCenterSize / 2;
     // Full circle radius
     $r = round($this->iSize / 2);
     // Get number of grid circles
     $n = $this->scale->GetNumCirc();
     // Plot circle grids
     $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 {
         // Check if we need to re-code the interpretation of the ordinal
         // number in the data. Internally ordinal value 0 is East and then
         // counted anti-clockwise. The user might choose an encoding
         // that have 0 being the first axis to the right of the "N" axis and then
         // counted clock-wise
         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;
//.........这里部分代码省略.........
开发者ID:muthulatha,项目名称:iem,代码行数:101,代码来源:jpgraph_windrose.php

示例8: Stroke

 function Stroke($aData, $aFile = '', $aShowDetails = false, $aShowEncodingDetails = false)
 {
     $textmargin = 5;
     $this->iEncoder->AddChecksum($this->iUseChecksum);
     $spec = $this->iEncoder->Enc($aData);
     $this->AdjustSpec($spec);
     if ($this->iFontFam == -1) {
         if ($this->iModuleWidth > 1) {
             $this->iFontFam = FF_FONT2;
             $this->iFontStyle = FS_BOLD;
         } else {
             $this->iFontFam = FF_FONT1;
             $this->iFontStyle = FS_BOLD;
         }
     }
     $s = '';
     $n = count($spec->iBar);
     $g = new CanvasGraph(0, 0);
     $g->img->SetImgFormat($this->iImgFormat);
     if ($aShowDetails) {
         $s = $spec->iEncoding . "\n";
         $s .= 'Data: ' . $spec->iData . "\n";
         if ($spec->iInfo != '') {
             $s .= 'Info: ' . $spec->iInfo . "\n";
         }
     }
     $w = round($spec->iModuleWidth);
     $totwidth = $spec->iLeftMargin * $w;
     $n = count($spec->iBar);
     for ($i = 0; $i < $n; ++$i) {
         $b = $spec->iBar[$i];
         $bn = strlen($b[3]);
         for ($j = 0; $j < $bn; ++$j) {
             $wb = substr($b[3], $j, 1) * $w;
             $totwidth += $wb;
         }
     }
     if ($spec->iInterCharModuleSpace) {
         $totwidth += ($n - 2) * $w;
     }
     $totwidth += $spec->iRightMargin * $w + 1;
     $height = $this->iHeight;
     if ($aShowDetails) {
         $g->img->SetFont(FF_FONT2);
         $height += $g->img->GetTextHeight($s);
     }
     $g->img->SetFont($this->iFontFam, $this->iFontStyle, $this->iFontSize);
     $th = $g->img->GetTextHeight($spec->iData);
     if ($spec->iStrokeDataBelow) {
         $height += $th + $this->iDataBelowMargin;
     }
     if ($height < round(0.15 * ($totwidth - $spec->iRightMargin * $w - $spec->iLeftMargin * $w))) {
         $height = round(0.15 * $totwidth);
     }
     $g->img->SetFont(FF_FONT2);
     $tw = 2 * $textmargin + $g->img->GetTextWidth($s);
     $width = $totwidth;
     if ($width < $tw) {
         $width = $tw;
     }
     if ($aShowEncodingDetails) {
         $g->img->SetFont(FF_FONT2);
         $height += $n * $g->img->GetTextHeight('0');
         $width = max(300, $totwidth);
     }
     $g = new CanvasGraph($width, $height);
     $g->img->SetImgFormat($this->iImgFormat);
     $g->SetMarginColor('white');
     if ($this->iShowFrame) {
         $g->frame_color = $this->iFrameColor;
         $g->InitFrame();
     }
     $g->img->SetColor('black');
     $x = $w * $spec->iLeftMargin;
     $ystart = $this->iTopMargin;
     $yend = $height - $this->iBottomMargin - 1;
     if ($aShowDetails) {
         $ystart += $g->img->GetTextHeight($s);
     }
     if ($aShowEncodingDetails) {
         $g->img->SetFont(FF_FONT2);
         $ystart += $n * $g->img->GetTextHeight('0');
     }
     if ($spec->iStrokeDataBelow) {
         $yend -= $th + $this->iDataBelowMargin;
     }
     $inunder = false;
     $under_s = '';
     $under_x = 0;
     for ($i = 0; $i < $n; ++$i) {
         $b = $spec->iBar[$i];
         if ($aShowEncodingDetails) {
             $s .= sprintf("%02d", $i) . " : {$b['0']}, {$b['1']}, {$b['2']}, {$b['3']}\n";
         }
         $bn = strlen($b[3]);
         if ($b[2] == 0 && !$this->iNoHumanText) {
             if (!$inunder) {
                 $inunder = true;
                 $under_x = $x;
                 $under_s = $b[0];
//.........这里部分代码省略.........
开发者ID:halimc17,项目名称:magsys,代码行数:101,代码来源:jpgraph_barcode.php

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

示例10: PieGraph

        $legenda[] = $array[0];
        $tot_top10 = $tot_top10 + $array[1];
        $data[] = $array[1];
    }
}
$legenda[] = "Other Titles";
$data[] = $total - $tot_top10;
// operação retirada em 02/2006
// Objetivo: aproveitar o arquivo já processada anteriormente, desde que no mesmo dia
// $OP="rm -f $db_tmp_issn.* ";
// $result=exec($OP);
// **************************************************************
// ********  Apresentação grafico                        ********
// **************************************************************
$graph = new PieGraph(690, 350);
//   $graph->SetShadow ();
// Create
$p1 = new PiePlot($data);
// Set A title for the plot
$p1->SetLegends($legenda);
$p1->SetSize(0.4);
$p1->SetCenter(0.28, 0.5);
$txt = new Text("Most Visited Titles", 0.15, 0.0);
$txt->SetFont(FONT1_BOLD);
$graph->Add($p1);
$graph->AddText($txt);
$graph->Stroke();
?>
 

开发者ID:Ethennoob,项目名称:Web,代码行数:28,代码来源:scielograph20.php

示例11: BarPlot

$graph->xaxis->SetLabelMargin(10);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('right', 'center');
// Add some grace to y-axis so the bars doesn't go
// all the way to the end of the plot area
$graph->yaxis->scale->SetGrace(20);
// We don't want to display Y-axis
$graph->yaxis->Hide();
// Now create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetShadow();
//You can change the width of the bars if you like
//$bplot->SetWidth(0.5);
// Set gradient fill for bars
$bplot->SetFillGradient('darkred', 'yellow', GRAD_HOR);
// We want to display the value of each bar at the top
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL, FS_BOLD, 10);
//$bplot->value->SetAlign('left','center');
$bplot->value->SetColor("white");
$bplot->value->SetFormat('%.1f');
$bplot->SetValuePos('max');
// Add the bar to the graph
$graph->Add($bplot);
// Add some explanation text
$txt = new Text('Note: Higher value is better.');
$txt->SetPos(190, 399, 'center', 'bottom');
$txt->SetFont(FF_ARIAL, FS_NORMAL, 8);
$graph->Add($txt);
// .. and stroke the graph
$graph->Stroke();
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:horizbarex6.php

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

示例13: Stroke

 function Stroke(&$img, &$xscale, &$yscale)
 {
     $img->SetLineWeight($this->weight);
     for ($i = 0; $i < $this->numpoints - 1; $i++) {
         $accy = 0;
         $accy_neg = 0;
         for ($j = 0; $j < $this->nbrplots; ++$j) {
             $img->SetColor($this->plots[$j]->color);
             if ($this->plots[$j]->coords[0][$i] > 0) {
                 $yt = $yscale->Translate($this->plots[$j]->coords[0][$i] + $accy);
                 $accyt = $yscale->Translate($accy);
                 $accy += $this->plots[$j]->coords[0][$i];
             } else {
                 $yt = $yscale->Translate($this->plots[$j]->coords[0][$i] + $accy_neg);
                 $accyt = $yscale->Translate($accy_neg);
                 $accy_neg += $this->plots[$j]->coords[0][$i];
             }
             $xt = $xscale->Translate($i);
             $abswidth = round($this->width * $xscale->scale_factor, 0);
             $pts = array($xt, $accyt, $xt, $yt, $xt + $abswidth, $yt, $xt + $abswidth, $accyt);
             if ($this->plots[$j]->grad) {
                 $grad = new Gradient($img);
                 $grad->FilledRectangle($pts[2], $pts[3], $pts[6], $pts[7], $this->plots[$j]->grad_fromcolor, $this->plots[$j]->grad_tocolor, $this->plots[$j]->grad_style);
             } elseif ($this->plots[$j]->fill_color) {
                 $img->SetColor($this->plots[$j]->fill_color);
                 $img->FilledPolygon($pts, 4);
                 $img->SetColor($this->plots[$j]->color);
             }
             if ($this->bar_shadow) {
                 $ssh = $this->bar_shadow_hsize;
                 $ssv = $this->bar_shadow_vsize;
                 // Create points to create a "upper-right" shadow
                 $sp[0] = $pts[6];
                 $sp[1] = $pts[7];
                 $sp[2] = $pts[4];
                 $sp[3] = $pts[5];
                 $sp[4] = $pts[2];
                 $sp[5] = $pts[3];
                 $sp[6] = $pts[2] + $ssh;
                 $sp[7] = $pts[3] - $ssv;
                 $sp[8] = $pts[4] + $ssh;
                 $sp[9] = $pts[5] - $ssv;
                 $sp[10] = $pts[6] + $ssh;
                 $sp[11] = $pts[7] - $ssv;
                 $img->SetColor($this->bar_shadow_color);
                 $img->FilledPolygon($sp, 4);
             }
             if ($i < count($this->plots[$j]->csimtargets)) {
                 $this->csimareas .= "<area shape=\"rect\" coords=\"";
                 // Hmmm, this is fishy.  Fixes a bug in Opera whereby if Y2<Y1 or X2<X1 the csim doesn't work
                 // This means that the area MUST specify top left and bottom right corners
                 if ($pts[3] < $pts[7]) {
                     if ($pts[2] < $pts[6]) {
                         $this->csimareas .= "{$pts['2']}, {$pts['3']}, {$pts['6']}, {$pts['7']}\"";
                     } else {
                         $this->csimareas .= "{$pts['6']}, {$pts['3']}, {$pts['2']}, {$pts['7']}\"";
                     }
                 } else {
                     if ($pts[2] < $pts[6]) {
                         $this->csimareas .= "{$pts['2']}, {$pts['7']}, {$pts['6']}, {$pts['3']}\"";
                     } else {
                         $this->csimareas .= "{$pts['6']}, {$pts['7']}, {$pts['2']}, {$pts['3']}\"";
                     }
                 }
                 $this->csimareas .= " href=\"" . $this->plots[$j]->csimtargets[$i] . "\"";
                 if (!empty($this->plots[$j]->csimalts[$i])) {
                     $sval = sprintf($this->plots[$j]->csimalts[$i], $this->plots[$j]->coords[0][$i]);
                     $this->csimareas .= " alt=\"{$sval}\"";
                 }
                 $this->csimareas .= ">\r\n";
             }
             $img->Polygon($pts, 4);
         }
         $yt = $yscale->Translate($accy);
         if ($this->show_value) {
             $sval = sprintf($this->show_value_format, $accy);
             $txt = new Text($sval);
             $txt->SetFont($this->show_value_ff, $this->show_value_fs, $this->show_value_fsize);
             $txt->SetColor($this->show_value_color);
             $x = $pts[2] + ($pts[4] - $pts[2]) / 2;
             if ($this->bar_shadow) {
                 $x += $ssh;
             }
             $txt->Pos($x, $yt - $this->show_value_margin);
             $txt->Align("center", "bottom");
             $txt->SetOrientation($this->show_value_angle);
             $txt->Stroke($img);
         }
     }
     return true;
 }
开发者ID:ahviplc,项目名称:judgegirl,代码行数:91,代码来源:jpgraph_bar.php

示例14: 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)) {
         // Special case for headers already sent or that the installation doesn't support
         // the PNG format (which the error icon is encoded in).
         // Dont return an image since it can't be displayed
         die($this->iTitle . ' ' . $aMsg);
     }
     $aMsg = wordwrap($aMsg, 55);
     $lines = substr_count($aMsg, "\n");
     // Create the error icon GD
     $erricon = Image::CreateFromString(base64_decode($img_iconerror));
     // Create an image that contains the error text.
     $w = 400;
     $h = 100 + 15 * max(0, $lines - 3);
     $img = new Image($w, $h);
     // Drop shadow
     $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);
     // Window background
     $img->SetColor("lightblue");
     $img->FilledRectangle(1, 1, $w - 5, $h - 5);
     $img->CopyCanvasH($img->img, $erricon, 5, 30, 0, 0, 40, 40);
     // Window border
     $img->SetColor("black");
     $img->Rectangle(1, 1, $w - 5, $h - 5);
     $img->Rectangle(0, 0, $w - 4, $h - 4);
     // Window top row
     $img->SetColor("darkred");
     for ($y = 3; $y < 18; $y += 2) {
         $img->Line(1, $y, $w - 6, $y);
     }
     // "White shadow"
     $img->SetColor("white");
     // Left window edge
     $img->Line(2, 2, 2, $h - 5);
     $img->Line(2, 2, $w - 6, 2);
     // "Gray button shadow"
     $img->SetColor("darkgray");
     // Gray window shadow
     $img->Line(2, $h - 6, $w - 5, $h - 6);
     $img->Line(3, $h - 7, $w - 5, $h - 7);
     // Window title
     $m = floor($w / 2 - 5);
     $l = 110;
     $img->SetColor("lightgray:1.3");
     $img->FilledRectangle($m - $l, 2, $m + $l, 16);
     // Stroke text
     $img->SetColor("darkred");
     $img->SetFont(FF_FONT2, FS_BOLD);
     $img->StrokeText($m - 90, 15, $this->iTitle);
     $img->SetColor("black");
     $img->SetFont(FF_FONT1, FS_NORMAL);
     $txt = new Text($aMsg, 52, 25);
     $txt->SetFont(FF_FONT1);
     $txt->Align("left", "top");
     $txt->Stroke($img);
     if ($this->iDest) {
         $img->Stream($this->iDest);
     } else {
         $img->Headers();
         $img->Stream();
     }
     if ($aHalt) {
         die;
     }
 }
开发者ID:munishsethi777,项目名称:eliveui,代码行数:78,代码来源:jpgraph_errhandler.inc.php

示例15: CanvasGraph

 function BAR_graph($module, $type, $start, $extra_fields)
 {
     global $C_translate, $C_auth;
     include_once PATH_CORE . 'validate.inc.php';
     $dt = new CORE_validate();
     include PATH_GRAPH . "jpgraph.php";
     ####################################################################
     ### Check if 'search' is authorized for this account
     ####################################################################
     # check the validation for this function
     if ($C_auth->auth_method_by_name($module, 'search')) {
         # validate this file exists, and include it.
         if (file_exists(PATH_MODULES . '/' . $module . '/' . $module . '.inc.php')) {
             include_once PATH_MODULES . '/' . $module . '/' . $module . '.inc.php';
         } else {
             ### Not exist!
             $error = $C_translate->translate('module_non_existant', '', '');
         }
     } else {
         ### Not auth
         $error = $C_translate->translate('module_non_auth', '', '');
     }
     if (isset($error)) {
         include PATH_GRAPH . "jpgraph_canvas.php";
         // Create the graph.
         $graph = new CanvasGraph(460, 55, "auto");
         $t1 = new Text($error);
         $t1->Pos(0.2, 0.5);
         $t1->SetOrientation("h");
         $t1->SetBox("white", "black", 'gray');
         $t1->SetFont(FF_FONT1, FS_NORMAL);
         $t1->SetColor("black");
         $graph->AddText($t1);
         $graph->Stroke();
         exit;
     }
     ####################################################################
     ### BY WEEK
     ####################################################################
     if ($type == 'week') {
         $FONT_SIZE = 7;
         $AbsWidth = 12;
         $interval = 4;
         $type = $C_translate->translate('week', '', '');
         if ($start == "" || $start <= 12) {
             ## Get the beginning/end of this week
             $start_str = mktime(24, 0, 0, 12, 31, date("Y") - 1);
             $start = date(UNIX_DATE_FORMAT, $start_str);
             $end_str = mktime(24, 0, 0, 12, 30, date("Y", $start_str));
             $end = date(UNIX_DATE_FORMAT, $end_str);
         } else {
             ## Get the beginning/end of the specified week
             $start_str = mktime(24, 0, 0, 12, 31, date("{$start}") - 1);
             $start = date(UNIX_DATE_FORMAT, $start_str);
             $end_str = mktime(24, 0, 0, 12, 30, date("Y", $start_str));
             $end = date(UNIX_DATE_FORMAT, $end_str);
         }
         ### Set the constraint array:
         $curr_str = $start_str;
         while ($curr_str <= $end_str) {
             $new_curr_str = mktime(0, 0, 0, date("m", $curr_str), date("d", $curr_str) + 7, date("Y", $curr_str));
             $constraint_array[] = array('start' => $curr_str, 'end' => $new_curr_str);
             $curr_str = $new_curr_str;
             $default_array[] = 0;
         }
     } else {
         if ($type == 'month') {
             $FONT_SIZE = 10;
             $AbsWidth = 12;
             $TickLables = $gDateLocale->GetShortMonth();
             $interval = 1;
             $type = $C_translate->translate('month', '', '');
             if ($start == "" || $start < 12) {
                 ## Get the beginning/end of this week
                 $start_str = mktime(24, 0, 0, 12, 31, date("Y") - 1);
                 $start = date(UNIX_DATE_FORMAT, $start_str);
                 $end_str = mktime(24, 0, 0, 12, 30, date("Y", $start_str));
                 $end = date(UNIX_DATE_FORMAT, $end_str);
             } else {
                 ## Get the beginning/end of the specified week
                 ## Get the beginning/end of this week
                 $start_str = mktime(24, 0, 0, 12, 31, date("{$start}") - 1);
                 $start = date(UNIX_DATE_FORMAT, $start_str);
                 $end_str = mktime(24, 0, 0, 12, 30, date("Y", $start_str));
                 $end = date(UNIX_DATE_FORMAT, $end_str);
             }
             ### Set the constraint array:
             $curr_str = $start_str;
             while ($curr_str <= $end_str) {
                 $new_curr_str = mktime(0, 0, 0, date("m", $curr_str) + 1, date("d", $curr_str), date("Y", $curr_str));
                 $constraint_array[] = array('start' => $curr_str, 'end' => $new_curr_str);
                 $curr_str = $new_curr_str;
                 $default_array[] = 0;
             }
         } else {
             if ($type == 'year') {
                 $FONT_SIZE = 10;
                 $interval = 1;
                 $AbsWidth = 13;
                 $type = $C_translate->translate('year', '', '');
//.........这里部分代码省略.........
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:101,代码来源:graph.inc.php


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