本文整理汇总了PHP中imagestringup函数的典型用法代码示例。如果您正苦于以下问题:PHP imagestringup函数的具体用法?PHP imagestringup怎么用?PHP imagestringup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imagestringup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: draw_bar_graph
function draw_bar_graph($width, $height, $data, $max_value, $filename)
{
// Create the empty graph image
$img = imagecreatetruecolor($width, $height);
// Set a white background with black text and gray graphics
$bg_color = imagecolorallocate($img, 255, 255, 255);
// white
$text_color = imagecolorallocate($img, 255, 255, 255);
// white
$bar_color = imagecolorallocate($img, 0, 0, 0);
// black
$border_color = imagecolorallocate($img, 192, 192, 192);
// light gray
// Fill the background
imagefilledrectangle($img, 0, 0, $width, $height, $bg_color);
// Draw the bars
$bar_width = $width / (count($data) * 2 + 1);
for ($i = 0; $i < count($data); $i++) {
imagefilledrectangle($img, $i * $bar_width * 2 + $bar_width, $height, $i * $bar_width * 2 + $bar_width * 2, $height - $height / $max_value * $data[$i][1], $bar_color);
imagestringup($img, 5, $i * $bar_width * 2 + $bar_width, $height - 5, $data[$i][0], $text_color);
}
// Draw a rectangle around the whole thing
imagerectangle($img, 0, 0, $width - 1, $height - 1, $border_color);
// Draw the range up the left side of the graph
for ($i = 1; $i <= $max_value; $i++) {
imagestring($img, 5, 0, $height - $i * ($height / $max_value), $i, $bar_color);
}
// Write the graph image to a file
imagepng($img, $filename, 5);
imagedestroy($img);
}
开发者ID:khk0613,项目名称:YHK,代码行数:31,代码来源:mymismatch.php
示例2: draw_bar_graph
function draw_bar_graph($width, $height, $data, $max_value, $filename)
{
/*1. Create the empty graph image*/
$img = imagecreatetruecolor($width, $height);
/*2. set a white background with black text and gray graphic*/
$bg_color = imagecolorallocate($img, 255, 255, 255);
//white
$text_color = imagecolorallocate($img, 255, 255, 255);
$bar_color = imagecolorallocate($img, 0, 0, 0);
//black
$border_color = imagecolorallocate($img, 192, 192, 192);
//light gray
/*3. fill the background */
imagefilledrectangle($img, 0, 0, $width, $height, $bg_color);
/*4. Draw the bars */
$bar_width = $width / (count($data) * 2 + 1);
for ($i = 0; $i < count($data); $i++) {
imagefilledrectangle($img, $i * $bar_width * 2 + $bar_width, $height, $i * $bar_width * 2 + $bar_width * 2, $height - $height / $max_value * $data[$i][1], $bar_color);
imagestringup($img, 5, $i * $bar_width * 2 + $bar_width, $height - 5, $data[$i][0], $text_color);
}
/*5. Draw a rectangle around the whole thing*/
imagerectangle($img, 0, 0, $width - 1, $height - 1, $border_color);
/*6. Draw the range up the left side of graph*/
for ($i = 1; $i <= $max_value; $i++) {
imagestring($img, 5, 0, $height - $i * ($height / $max_value), $i, $bar_color);
}
/*7. output image to a file.*/
imagepng($img, $filename, 5);
/*8. destroy image.*/
imagedestroy($img);
}
开发者ID:jekin000,项目名称:hf_php,代码行数:31,代码来源:bar.php
示例3: getGDImageOfMemoryLine
public function getGDImageOfMemoryLine(Watcher $Watcher, $width, $height, $y_scale = 1, $memory_size_scale = 1048576)
{
$points = $Watcher->getPointsArray();
if (empty($points) || empty($y_scale) || empty($memory_size_scale)) {
return false;
}
$max_y = $height;
$max_x = $width;
$img = imagecreatetruecolor($max_x, $max_y);
$point_color = imagecolorallocate($img, 0, 0, 255);
$line_color = imagecolorallocate($img, 0, 255, 0);
$string_color = imagecolorallocate($img, 0, 0, 0);
$white = imagecolorallocate($img, 255, 255, 255);
imagefill($img, 10, 10, $white);
$x = 0;
$y = 0;
$x_step = intval($max_x / 100);
foreach ($points as $point) {
$value = round($point[$Watcher::point_memory] / $memory_size_scale, 2);
$new_x = $x + $x_step;
$new_y = $value * $y_scale;
imageline($img, $x + 1, $max_y - $y, $new_x, $max_y - $new_y, $line_color);
$x = $new_x;
$y = $new_y;
imagesetpixel($img, $x, $max_y - $y, $point_color);
imagestringup($img, 1, $x, $max_y - $y - 5, $point[$Watcher::point_name], $string_color);
imagestringup($img, 1, $x, $max_y - $y + 30, $value, $string_color);
}
return $img;
}
开发者ID:jamm,项目名称:errorhandler,代码行数:30,代码来源:WatchPointsPrinter.php
示例4: getCanvas
public function getCanvas()
{
$date = zbx_date2str(DATE_TIME_FORMAT_SECONDS);
imagestring($this->canvas, 1, $this->width - 120, $this->height - 12, $date, $this->getColor('gray'));
imagestringup($this->canvas, 1, $this->width - 10, $this->height - 50, ZABBIX_HOMEPAGE, $this->getColor('gray'));
return $this->canvas;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:7,代码来源:CCanvas.php
示例5: getCanvas
public function getCanvas()
{
$grey = get_color($this->canvas, '969696', 50);
$date = zbx_date2str(DATE_TIME_FORMAT_SECONDS);
imagestring($this->canvas, 1, $this->width - 120, $this->height - 12, $date, $grey);
imagestringup($this->canvas, 1, $this->width - 10, $this->height - 50, ZABBIX_HOMEPAGE, $grey);
return $this->canvas;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:8,代码来源:CCanvas.php
示例6: vtext
private function vtext($x, $y, $text, $color)
{
if ($x < 0) {
$x = $this->width + $x;
}
if ($y < 0) {
$y = $this->height + $y;
}
imagestringup($this->img, 2, $x, $y, $text, $color);
}
开发者ID:laiello,项目名称:xiv,代码行数:10,代码来源:graph.php
示例7: FilledArc
function FilledArc(&$im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, $fill_color='none',$key='')
{
ImageArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color);
// To close the arc with 2 lines between the center and the 2 limits of the arc
$x = $CenterX + (cos(deg2rad($Start)) * ($DiameterX / 2));
$y = $CenterY + (sin(deg2rad($Start)) * ($DiameterY / 2));
ImageLine($im, $x, $y, $CenterX, $CenterY, $line_color);
$x = $CenterX + (cos(deg2rad($End)) * ($DiameterX / 2));
$y = $CenterY + (sin(deg2rad($End)) * ($DiameterY / 2));
ImageLine($im, $x, $y, $CenterX, $CenterY, $line_color);
// To fill the arc, the starting point is a point in the middle of the closed space
$x = $CenterX + (cos(deg2rad(($Start + $End) / 2)) * ($DiameterX / 4));
$y = $CenterY + (sin(deg2rad(($Start + $End) / 2)) * ($DiameterY / 4));
ImageFillToBorder($im, $x, $y, $line_color, $fill_color);
// Ainda faltam vários ajustes para escrita do label na vertical... Anderson Peterle => 08/08/2007
if ($key)
imagestringup($im,2,$x,$y,$key,$x);
}
开发者ID:GabrielDiniz,项目名称:FluxNetControl,代码行数:19,代码来源:piechart.php
示例8: createImage
function createImage($data, $twidth, $tspace, $height)
{
$dataName = array();
$dataValue = array();
$i = 0;
$j = 0;
$k = 0;
$num = sizeof($data);
foreach ($data as $key => $val) {
$dataName[] = $key;
$dataValue[] = $val;
}
$maxnum = max($data);
$width = ($twidth + $tspace) * $num + 4;
//image's width
$im = imagecreate($width + 40, $height + 20);
$lineColor = imagecolorallocate($im, 12, 12, 12);
$bgColor = imagecolorallocate($im, 255, 233, 233);
$tColor = imagecolorallocate($im, 123, 200, 56);
imagefill($im, 0, 0, $bgColor);
imageline($im, 30, 0, 30, $height - 2, $lineColor);
imageline($im, 30, $height - 2, $width + 30 - 2, $height - 2, $lineColor);
while ($i < $num) {
imagefilledrectangle($im, $i * ($tspace + $twidth) + 40, $height - $dataValue[$i], $i * ($tspace + $twidth) + 40 + $twidth, $height - 3, $tColor);
imagestringup($im, 4, $i * ($tspace + $twidth) + $twidth / 2 + 30, $height - 10, $dataName[$i] . "(" . $dataValue[$i] . ")", $lineColor);
$i++;
}
while ($j <= 500 / 10) {
imagestringup($im, 4, 2, $height - $j * 10 + 10, $j * 10, $lineColor);
$j = $j + 10;
}
while ($k <= 500 / 10) {
if ($k != 0) {
imageline($im, 28, $height - $k * 10, 32, $height - $k * 10, $lineColor);
}
$k = $k + 10;
}
imagepng($im);
}
开发者ID:chaobj001,项目名称:tt,代码行数:39,代码来源:createimage.php
示例9: _drawData
private function _drawData()
{
$x = 0;
$y0 = $this->_getY(0);
foreach ($this->_data as $key => $item) {
$y = $this->_getY($item['value']);
imagefilledrectangle($this->_img, $x, $y0, $x + $this->_item_width, $y, 0x6564ff);
imagerectangle($this->_img, $x, $y0, $x + $this->_item_width, $y, 0x4a49c0);
if ($this->_text_dir == 'vertical') {
imagestringup($this->_img, 2, $x + 3, $y - 3, number_format($item['value']), 0x4a49c0);
imagestringup($this->_img, 2, $x + 3, 299, str_pad($item['label'], 16, ' ', STR_PAD_LEFT), 0x333333);
} else {
$text_len_px = strlen(number_format($item['value'])) * 7;
$text_x = $x + ($this->_item_width - $text_len_px) / 2;
imagestring($this->_img, 2, $text_x, $y - 13, number_format($item['value']), 0x4a49c0);
$text_len_px = strlen($item['label']) * 7;
$text_x = $x + ($this->_item_width - $text_len_px) / 2;
imagestring($this->_img, 2, $text_x, 289, $item['label'], 0x333333);
}
$x += $this->_item_width;
}
}
开发者ID:Albertoni,项目名称:GFUserDatabase,代码行数:22,代码来源:Graph.class.php
示例10: draw_graph
function draw_graph($category_array, $width, $height, $max_value, $filename)
{
$img = imagecreatetruecolor($width, $height);
$bg_color = imagecolorallocate($img, 255, 255, 255);
// white
$text_color = imagecolorallocate($img, 255, 255, 255);
// white
$bar_color = imagecolorallocate($img, 0, 0, 0);
// black
$border_color = imagecolorallocate($img, 192, 192, 192);
// light gray
imagefilledrectangle($img, 0, 0, $width, $height, $bg_color);
$bar_width = $width / (count($category_array) * 2 + 1);
for ($i = 0; $i < count($category_array); $i++) {
imagefilledrectangle($img, $i * $bar_width * 2 + $bar_width, $height, $i * $bar_width * 2 + $bar_width * 2, $height - $height / $max_value * $category_array[$i][1], $bar_color);
imagestringup($img, 5, $i * $bar_width * 2 + $bar_width, $height - 5, $category_array[$i][0], $text_color);
}
imagerectangle($img, 0, 0, $width - 1, $height - 1, $border_color);
for ($i = 1; $i <= $max_value; $i++) {
imagestring($img, 5, 0, $height - $i * ($height / $max_value), $i, $bar_color);
}
imagepng($img, $filename, 5);
imagedestroy($img);
}
开发者ID:sgreenholtz,项目名称:php_course_work,代码行数:24,代码来源:bar_graph.php
示例11: _StrokeBuiltinFont
function _StrokeBuiltinFont($x, $y, $txt, $dir = 0, $paragraph_align = "left", &$aBoundingBox, $aDebug = false)
{
if (is_numeric($dir) && $dir != 90 && $dir != 0) {
JpGraphError::RaiseL(25091);
}
//(" Internal font does not support drawing text at arbitrary angle. Use TTF fonts instead.");
$h = $this->GetTextHeight($txt);
$fh = $this->GetFontHeight();
$w = $this->GetTextWidth($txt);
if ($this->text_halign == "right") {
$x -= $dir == 0 ? $w : $h;
} elseif ($this->text_halign == "center") {
// For center we subtract 1 pixel since this makes the middle
// be prefectly in the middle
$x -= $dir == 0 ? $w / 2 - 1 : $h / 2;
}
if ($this->text_valign == "top") {
$y += $dir == 0 ? $h : $w;
} elseif ($this->text_valign == "center") {
$y += $dir == 0 ? $h / 2 : $w / 2;
}
if ($dir == 90) {
imagestringup($this->img, $this->font_family, $x, $y, $txt, $this->current_color);
$aBoundingBox = array(round($x), round($y), round($x), round($y - $w), round($x + $h), round($y - $w), round($x + $h), round($y));
if ($aDebug) {
// Draw bounding box
$this->PushColor('green');
$this->Polygon($aBoundingBox, true);
$this->PopColor();
}
} else {
if (ereg("\n", $txt)) {
$tmp = split("\n", $txt);
for ($i = 0; $i < count($tmp); ++$i) {
$w1 = $this->GetTextWidth($tmp[$i]);
if ($paragraph_align == "left") {
imagestring($this->img, $this->font_family, $x, $y - $h + 1 + $i * $fh, $tmp[$i], $this->current_color);
} elseif ($paragraph_align == "right") {
imagestring($this->img, $this->font_family, $x + ($w - $w1), $y - $h + 1 + $i * $fh, $tmp[$i], $this->current_color);
} else {
imagestring($this->img, $this->font_family, $x + $w / 2 - $w1 / 2, $y - $h + 1 + $i * $fh, $tmp[$i], $this->current_color);
}
}
} else {
//Put the text
imagestring($this->img, $this->font_family, $x, $y - $h + 1, $txt, $this->current_color);
}
if ($aDebug) {
// Draw the bounding rectangle and the bounding box
$p1 = array(round($x), round($y), round($x), round($y - $h), round($x + $w), round($y - $h), round($x + $w), round($y));
// Draw bounding box
$this->PushColor('green');
$this->Polygon($p1, true);
$this->PopColor();
}
$aBoundingBox = array(round($x), round($y), round($x), round($y - $h), round($x + $w), round($y - $h), round($x + $w), round($y));
}
}
开发者ID:giovanny751,项目名称:sst,代码行数:58,代码来源:gd_image.inc.php
示例12: _drawAxes
/**
* Draw X and Y axes
*
* @return @e void
*/
protected function _drawAxes()
{
//-----------------------------------------
// Allocate text and shadow cols
//-----------------------------------------
$textcolor = imagecolorallocate($this->image, hexdec(substr($this->options['titlecolor'], 1, 2)), hexdec(substr($this->options['titlecolor'], 3, 2)), hexdec(substr($this->options['titlecolor'], 5, 2)));
$shadowcolor = imagecolorallocate($this->image, hexdec(substr($this->options['titleshadow'], 1, 2)), hexdec(substr($this->options['titleshadow'], 3, 2)), hexdec(substr($this->options['titleshadow'], 5, 2)));
//-----------------------------------------
// Do we have axes titles?
//-----------------------------------------
if ($this->options['xaxistitle']) {
if ($this->use_ttf) {
$txtsize = imagettfbbox(10, 0, $this->options['font'], $this->options['xaxistitle']);
$textx = round(($this->grapharea['x1'] - $this->grapharea['x0']) / 2, 0) - round(($txtsize[4] - $txtsize[0]) / 2, 0);
$texty = $this->grapharea['y1'];
imagettftext($this->image, 10, 0, $textx + 1, $texty + 1, $shadowcolor, $this->options['font'], $this->options['xaxistitle']);
imagettftext($this->image, 10, 0, $textx, $texty, $textcolor, $this->options['font'], $this->options['xaxistitle']);
$this->grapharea['y1'] = $this->grapharea['y1'] - ($txtsize[1] - $txtsize[5]) - 5;
} else {
$txtwidth = imagefontwidth($this->fontsize) * strlen($this->options['xaxistitle']);
$textx = round(($this->grapharea['x1'] - $this->grapharea['x0']) / 2, 0) - round($txtwidth / 2, 0);
$texty = $this->grapharea['y1'] - imagefontheight($this->fontsize);
imagestring($this->image, $this->fontsize, $textx + 1, $texty + 1, $this->options['xaxistitle'], $shadowcolor);
imagestring($this->image, $this->fontsize, $textx, $texty, $this->options['xaxistitle'], $textcolor);
$this->grapharea['y1'] = $this->grapharea['y1'] - imagefontheight($this->fontsize) - 5;
}
}
if ($this->options['yaxistitle']) {
if ($this->use_ttf) {
$txtsize = imagettfbbox(10, 0, $this->options['font'], $this->options['yaxistitle']);
$textx = $this->grapharea['x0'] + ($txtsize[1] - $txtsize[5]);
$texty = round(($this->grapharea['y1'] - $this->grapharea['y0']) / 2, 0) + ($txtsize[4] - $txtsize[0]);
imagettftext($this->image, 10, 90, $textx + 1, $texty + 1, $shadowcolor, $this->options['font'], $this->options['yaxistitle']);
imagettftext($this->image, 10, 90, $textx, $texty, $textcolor, $this->options['font'], $this->options['yaxistitle']);
$this->grapharea['x0'] = $textx + 5;
} else {
$txtheight = imagefontwidth($this->fontsize) * strlen($this->options['yaxistitle']);
$textx = $this->grapharea['x0'];
$texty = round(($this->grapharea['y1'] - $this->grapharea['y0']) / 2, 0) + round($txtheight / 2, 0);
imagestringup($this->image, $this->fontsize, $textx + 1, $texty + 1, $this->options['yaxistitle'], $shadowcolor);
imagestringup($this->image, $this->fontsize, $textx, $texty, $this->options['yaxistitle'], $textcolor);
$this->grapharea['x0'] = $this->grapharea['x0'] + imagefontheight($this->fontsize) + 5;
}
}
//-----------------------------------------
// Determine height of the x-axis
//-----------------------------------------
$xaxisheight = 0;
if (isset($this->x_axis['type'])) {
if ($this->x_axis['type'] == 'numeric') {
if ($this->use_ttf) {
$txtsize = imagettfbbox(10, 0, $this->options['font'], $this->x_axis['max']);
$xaxisheight = $txtsize[1] - $txtsize[5];
} else {
$xaxisheight = imagefontheight($this->fontsize);
}
} else {
$xaxisheight = 0;
foreach ($this->x_axis['labels'] as $label) {
if ($this->use_ttf) {
$textsize = imagettfbbox(10, 45, $this->options['font'], $label);
if ($textsize[1] - $textsize[5] > $xaxisheight) {
$xaxisheight = $textsize[1] - $textsize[5];
}
} else {
$textsize = imagefontwidth($this->fontsize) * strlen($label);
if ($textsize > $xaxisheight) {
$xaxisheight = $textsize;
}
}
}
}
$xaxisheight += 8;
$this->grapharea['y1'] -= $xaxisheight;
}
//-----------------------------------------
// Determine width of the y-axis
//-----------------------------------------
$yaxiswidth = 0;
if (isset($this->y_axis['type'])) {
if ($this->y_axis['type'] == 'numeric') {
if ($this->use_ttf) {
$txtsize = imagettfbbox(10, 0, $this->options['font'], $this->y_axis['max']);
$yaxiswidth = $txtsize[2] - $txtsize[0];
} else {
$yaxiswidth = imagefontwidth($this->fontsize) * strlen($this->y_axis['max']);
}
} else {
$yaxiswidth = 0;
foreach ($this->y_axis['labels'] as $label) {
if ($this->use_ttf) {
$textsize = imagettfbbox(10, 0, $this->options['font'], $label);
if ($textsize[2] - $textsize[0] > $yaxiswidth) {
$yaxiswidth = $textsize[2] - $textsize[0];
}
//.........这里部分代码省略.........
开发者ID:mover5,项目名称:imobackup,代码行数:101,代码来源:classGraph.php
示例13: writestrup
public function writestrup($str)
{
// add by new network http://necz.net
$b = imagecolorallocate($this->workingImage, 0, 0, 0);
$w = imagecolorallocate($this->workingImage, 255, 255, 255);
$len = strlen($str) * 6;
$wa = imagesx($this->workingImage) - 14;
imagestringup($this->workingImage, 2, $wa + 1, $len, $str, $b);
imagestringup($this->workingImage, 2, $wa - 1, $len, $str, $b);
imagestringup($this->workingImage, 2, $wa, $len + 1, $str, $b);
imagestringup($this->workingImage, 2, $wa, $len - 1, $str, $b);
imagestringup($this->workingImage, 2, $wa, $len, $str, $w);
$this->oldImage = $this->workingImage;
return $this;
}
开发者ID:anugool,项目名称:php-news,代码行数:15,代码来源:GdThumb.inc.php
示例14: foreach
foreach ($per_host as $index => $percent) {
$week_day++;
if ($week_day > 6) {
$week_day -= 7;
}
if ($index / 2 == (int) ($index / 2)) {
$color = imageColorAllocate($img, 249, 243, 70);
$color2 = imageColorAllocate($img, 242, 226, 42);
$color3 = imageColorAllocate($img, 226, 210, 34);
} else {
$color = imageColorAllocate($img, 11, 215, 252);
$color2 = imageColorAllocate($img, 7, 203, 239);
$color3 = imageColorAllocate($img, 7, 187, 219);
}
$y1 = round($imageW - $imageW * $percent + 12);
imageFilledRectangle($img, $x1, $y1, $x2, $y2, $color);
$points = array(0 => $x1, 1 => $y1, 2 => $x1 + 3, 3 => $y1 - 5, 4 => $x1 + $collW + 3, 5 => $y1 - 5, 6 => $x2, 7 => $y1);
imageFilledPolygon($img, $points, 4, $color2);
$points = array(0 => $x2, 1 => $y1, 2 => $x1 + $collW + 3, 3 => $y1 - 5, 4 => $x1 + $collW + 3, 5 => $y2 - 5, 6 => $x2, 7 => $y2);
imageFilledPolygon($img, $points, 4, $color3);
// imageTTFtext($img, 7, 90, $x1+8, 50, $colorBlack, BASEDIR.'/assets/fonts/font.ttf', $host_data[$index]);
imagestringup($img, 1, $x1 + 3, 52, $host_data[$index], $colorBlack);
imageTTFtext($img, 6, 0, $x1 + 3, 66, $colorBlack, BASEDIR . '/assets/fonts/font.ttf', $arr_week[$week_day]);
$x1 += $collW;
$x2 += $collW;
}
//Header("Content-type: image/gif");
ImageGIF($img, BASEDIR . $imagecache);
ImageDestroy($img);
}
echo '<img src="' . $imagecache . '?' . date_fixed(SITETIME, "dmY") . '" alt="Неделя" /><br /><br />';
开发者ID:visavi,项目名称:rotorcms4,代码行数:31,代码来源:counter7.php
示例15: imagefilledrectangle
imagefilledrectangle($im, $x1 + $shiftX, $yt + $shiftYup, $x1 + $shiftX + 8, $yt + $yu + $shiftYup, imagecolorallocate($im, 235, 235, 235));
}
// UNKNOWN
$yf = $sizeY * $false[$i] / 100;
if ($yf > 0) {
imagefilledrectangle($im, $x1 + $shiftX, $yt + $yu + $shiftYup, $x1 + $shiftX + 8, $sizeY + $shiftYup, imagecolorallocate($im, 120, 235, 120));
}
// GREEN
//SDI($yt.'+'.$yf.'+'.$yu);
if ($yt + $yf + $yu > 0) {
imagerectangle($im, $x1 + $shiftX, $shiftYup, $x1 + $shiftX + 8, $sizeY + $shiftYup, $black);
}
}
for ($i = 0; $i <= $sizeY; $i += $sizeY / 10) {
imagestring($im, 1, $sizeX + 5 + $shiftX, $sizeY - $i - 4 + $shiftYup, $i * ($maxY - $minY) / $sizeY + $minY, $darkred);
}
imagefilledrectangle($im, $shiftX, $sizeY + $shiftYup + 39 + 15 * 0, $shiftX + 5, $sizeY + $shiftYup + 35 + 9 + 15 * 0, imagecolorallocate($im, 120, 235, 120));
imagerectangle($im, $shiftX, $sizeY + $shiftYup + 39 + 15 * 0, $shiftX + 5, $sizeY + $shiftYup + 35 + 9 + 15 * 0, $black);
imagestring($im, 2, $shiftX + 9, $sizeY + $shiftYup + 15 * 0 + 35, 'FALSE (%)', $black);
imagefilledrectangle($im, $shiftX, $sizeY + $shiftYup + 39 + 15 * 1, $shiftX + 5, $sizeY + $shiftYup + 35 + 9 + 15 * 1, imagecolorallocate($im, 235, 120, 120));
imagerectangle($im, $shiftX, $sizeY + $shiftYup + 39 + 15 * 1, $shiftX + 5, $sizeY + $shiftYup + 15 + 9 + 35 * 1, $black);
imagestring($im, 2, $shiftX + 9, $sizeY + $shiftYup + 15 * 1 + 35, 'TRUE (%)', $black);
imagefilledrectangle($im, $shiftX, $sizeY + $shiftYup + 39 + 15 * 2, $shiftX + 5, $sizeY + $shiftYup + 35 + 9 + 15 * 2, imagecolorallocate($im, 220, 220, 220));
imagerectangle($im, $shiftX, $sizeY + $shiftYup + 39 + 15 * 2, $shiftX + 5, $sizeY + $shiftYup + 35 + 9 + 15 * 2, $black);
imagestring($im, 2, $shiftX + 9, $sizeY + $shiftYup + 15 * 2 + 35, 'UNKNOWN (%)', $black);
imagestringup($im, 0, imagesx($im) - 10, imagesy($im) - 50, 'http://www.zabbix.com', $gray);
$end_time = time(NULL);
imagestring($im, 0, imagesx($im) - 100, imagesy($im) - 12, 'Generated in ' . ($end_time - $start_time) . ' sec', $gray);
ImageOut($im);
imagedestroy($im);
include_once 'include/page_footer.php';
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:chart4.php
示例16: floor
}
//Draw x points
for ($drawXpt = 0; $drawXpt < $numScores; $drawXpt++) {
$score = $scoreArray[$drawXpt];
$xPt = $xAxisStart + 2 + $xAxisUnit * $drawXpt;
$yPtRough = floor($score / ($yAxisUnit / $yAxisInc));
if ($yAxisMin != "0") {
$yOffset = $yAxisMin / 100 * $yAxisInc;
$yPt = $yAxisEnd - ($yPtRough - $yOffset);
} else {
$yPt = $yAxisEnd - $yPtRough;
}
if ($graphLabels != "off" && $score < 0) {
imagestringup($image, 2, $xPt - 7, $yPt - 5, $score, $red);
} elseif ($graphLabels != "off") {
imagestringup($image, 2, $xPt - 7, $yPt - 5, $score, $black);
}
imagefilledellipse($image, $xPt, $yPt, 4, 4, $black);
$arrayPoints[x][$drawXpt] = $xPt;
$arrayPoints[y][$drawXpt] = $yPt;
}
for ($cntC = 0; $cntC < $numScores; $cntC++) {
if ($cntC < $numScores - 1) {
$currVal = $cntC;
$nextVal = $cntC + 1;
} else {
$currVal = $cntC;
$nextVal = $cntC;
}
$currPointX = $arrayPoints[x][$currVal];
$currPointY = $arrayPoints[y][$currVal];
开发者ID:NorbertKrupa,项目名称:lqcenter-scores,代码行数:31,代码来源:stats_playerGraph.php
示例17: imagecreatetruecolor
$height = 80 + $max_height;
$result = imagecreatetruecolor($width, $height);
// bakgrunn
$bg_color = imagecolorallocate($result, 40, 0, 40);
imagefill($result, 0, 0, $bg_color);
// overskrift
$text_color = imagecolorallocate($result, 238, 238, 238);
imagestring($result, 2, 5, 5, "Statistikk for [gjennomsnitt/dag] {$user['user']}", $text_color);
$x = 10;
$y = 30 + $max_height;
$line_color = imagecolorallocate($result, 150, 150, 150);
imageline($result, 8, $y - 3, $width - 8, $y - 3, $line_color);
$bar_color = imagecolorallocate($result, 200, 200, 200);
$bar2_color = imagecolorallocatealpha($result, 150, 150, 150, 100);
$hits_color = imagecolorallocate($result, 150, 150, 150);
foreach ($stats as $hour => $hits) {
if ($peak == 0) {
$bar_h = 0;
} else {
$bar_h = ceil($hits / $peak * $max_height);
}
$bar_y1 = $y - $bar_h - 3;
$bar_y2 = $bar_y1 + $bar_h;
imagefilledrectangle($result, $x + 1, $bar_y1, $x + 12, $bar_y2, $bar_color);
imagefilledrectangle($result, $x + 1, $bar_y2, $x + 12, $bar_y2 + 50, $bar2_color);
imagestringup($result, 1, $x + 3, $y + 43, str_pad(number_format($hits, 0, ",", " "), 6, " ", STR_PAD_LEFT), $hits_color);
imagestring($result, 1, $x + 2, $y, str_pad($hour, 2, "0", STR_PAD_LEFT), $text_color);
$x += 13;
}
header("Content-Type: image/png");
imagepng($result);
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:user_day_avg.php
示例18: AStextInternal
function AStextInternal($p, $st, $pos, $angle)
{
/*if (func_num_args()>1) {
$p = $this->pt2arr($arg);
$st = func_get_arg(1);
if (func_num_args()>2) {
$pos = func_get_arg(2);
}
if (func_num_args()>3) {
$angle = func_get_arg(3);
}
} else {
$p = $this->pt2arr($arg[0]);
$st = $arg[1];
if (isset($arg[2])) {
$pos = $arg[2];
}
if (isset($arg[3])) {
$angle = $arg[3];
}
}*/
/*else {
if (preg_match('/\s*\[(.*?)\]\s*,\s*[\'"](.*?)[\'"]\s*,([^,]*)/',$arg,$m)) {
$p = $this->pt2arr($m[1]);
$st = $m[2];
$pos = trim(str_replace(array('"',"'"),'',$m[3]));
} else {
$arg = explode(',',$arg);
$p = $this->pt2arr($arg[0].','.$arg[1]);
$st = str_replace(array('"',"'"),'',$arg[2]);
}
}*/
if ($this->usettf) {
$bb = imagettfbbox($this->fontsize, $angle, $this->fontfile, $st);
$bbw = $bb[4] - $bb[0];
$bbh = -1 * ($bb[5] - $bb[1]);
$p[0] = $p[0] - 0.5 * $bbw;
$p[1] = $p[1] + 0.5 * $bbh;
if ($pos == 'above' || $pos == 'aboveright' || $pos == 'aboveleft') {
$p[1] = $p[1] - 0.5 * abs($bbh) - $this->fontsize / 2;
}
if ($pos == 'below' || $pos == 'belowright' || $pos == 'belowleft') {
$p[1] = $p[1] + 0.5 * abs($bbh) + $this->fontsize / 2;
}
if ($pos == 'left' || $pos == 'aboveleft' || $pos == 'belowleft') {
$p[0] = $p[0] - 0.5 * abs($bbw) - $this->fontsize / 2;
}
if ($pos == 'right' || $pos == 'aboveright' || $pos == 'belowright') {
$p[0] = $p[0] + 0.5 * abs($bbw) + $this->fontsize / 2;
}
if ($this->fontfill != '') {
$color = $this->fontfill;
} else {
$color = $this->stroke;
}
imagettftext($this->img, $this->fontsize, $angle, $p[0], $p[1], $this->{$color}, $this->fontfile, $st);
} else {
if ($this->fontsize < 9) {
$fs = 1;
} else {
if ($this->fontsize < 13) {
$fs = 2;
} else {
$fs = 4;
}
}
if ($angle == 90 || $angle == 270) {
$bb = array(imagefontheight($fs), imagefontwidth($fs) * strlen($st));
} else {
$bb = array(imagefontwidth($fs) * strlen($st), imagefontheight($fs));
}
$p[0] = $p[0] - 0.5 * $bb[0];
if ($angle == 90 || $angle == 270) {
$p[1] = $p[1] + 0.5 * $bb[1];
} else {
$p[1] = $p[1] - 0.5 * $bb[1];
}
if ($pos == 'above' || $pos == 'aboveright' || $pos == 'aboveleft') {
$p[1] = $p[1] - 0.5 * $bb[1] - $fs * 2;
}
if ($pos == 'below' || $pos == 'belowright' || $pos == 'belowleft') {
$p[1] = $p[1] + 0.5 * $bb[1] + $fs * 2;
}
if ($pos == 'left' || $pos == 'aboveleft' || $pos == 'belowleft') {
$p[0] = $p[0] - 0.5 * $bb[0] - $fs * 2;
}
if ($pos == 'right' || $pos == 'aboveright' || $pos == 'belowright') {
$p[0] = $p[0] + 0.5 * $bb[0] + $fs * 2;
}
if ($this->fontfill != '') {
$color = $this->fontfill;
} else {
$color = $this->stroke;
}
if ($angle == 90 || $angle == 270) {
imagestringup($this->img, $fs, $p[0], $p[1], $st, $this->{$color});
} else {
imagestring($this->img, $fs, $p[0], $p[1], $st, $this->{$color});
}
}
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:asciisvgimg.php
示例19: generateBars
//.........这里部分代码省略.........
// draw line
if ($this->bool_line) {
$lineX1 = $x1 + $this->bar_width / 2;
//MIDPOINT OF BARS, IF SHOWN
$lineY1 = $y1;
if (isset($lineX2)) {
imageline($this->image, $lineX2, $lineY2, $lineX1, $lineY1, $this->line_color[$data_set_num]);
$lineX2 = $lineX1;
$lineY2 = $lineY1;
} else {
$lineX2 = $lineX1;
$lineY2 = $lineY1;
}
}
// display data points
if ($this->bool_data_points) {
//dont draw datapoints here or will overlap poorly with line
//instead collect coordinates
$pointX = $x1 + $this->bar_width / 2;
//MIDPOINT OF BARS, IF SHOWN
$this->data_point_array[] = array($pointX, $y1);
}
// display data values
if ($this->bool_data_values) {
$dataX = $x1 + $this->bar_width / 2 - strlen($item) * self::DATA_VALUE_TEXT_WIDTH / 2;
//value to be graphed is equal/over 0
if ($item >= 0) {
$dataY = $y1 - self::DATA_VALUE_PADDING - self::DATA_VALUE_TEXT_HEIGHT;
} else {
//check for item values below user spec'd range
if ($this->bool_user_data_range && $item <= $this->data_range_min) {
$dataY = $y1 - self::DATA_VALUE_PADDING - self::DATA_VALUE_TEXT_HEIGHT;
} else {
$dataY = $y1 + self::DATA_VALUE_PADDING;
}
}
//add currency sign, formatting etc
if ($this->data_format_array) {
$item = $this->applyDataFormats($item);
}
if ($this->data_currency) {
$item = $this->applyDataCurrency($item);
}
//recenter data position if necessary
$dataX -= $this->data_additional_length * self::DATA_VALUE_TEXT_WIDTH / 2;
imagestring($this->image, 2, $dataX, $dataY, $item, $this->data_value_color);
}
//write x axis value
if ($this->bool_x_axis_values) {
if ($data_set_num == $this->data_set_count - 1) {
if ($this->bool_x_axis_values_vert) {
if ($this->bool_all_negative) {
//we must put values above 0 line
$textVertPos = round($this->y_axis_y2 - self::AXIS_VALUE_PADDING);
} else {
//mix of both pos and neg numbers
//write value y axis bottom value (will be under bottom of grid even if x axis is floating due to
$textVertPos = round($this->y_axis_y1 + strlen($key) * self::TEXT_WIDTH + self::AXIS_VALUE_PADDING);
}
$textHorizPos = round($xStart + $this->bar_width / 2 - self::TEXT_HEIGHT / 2);
//skip and dispplay every x intervals
if ($this->x_axis_value_interval) {
if ($this->x_axis_value_interval_counter < $this->x_axis_value_interval) {
$this->x_axis_value_interval_counter++;
} else {
imagestringup($this->image, 2, $textHorizPos, $textVertPos, $key, $this->x_axis_text_color);
$this->x_axis_value_interval_counter = 0;
}
} else {
imagestringup($this->image, 2, $textHorizPos, $textVertPos, $key, $this->x_axis_text_color);
}
} else {
if ($this->bool_all_negative) {
//we must put values above 0 line
$textVertPos = round($this->y_axis_y2 - self::TEXT_HEIGHT - self::AXIS_VALUE_PADDING);
} else {
//mix of both pos and neg numbers
//write value y axis bottom value (will be under bottom of grid even if x axis is floating due to
$textVertPos = round($this->y_axis_y1 + self::TEXT_HEIGHT * 2 / 3 - self::AXIS_VALUE_PADDING);
}
//horizontal data keys
$textHorizPos = round($xStart + $this->bar_width / 2 - strlen($key) * self::TEXT_WIDTH / 2);
//skip and dispplay every x intervals
if ($this->x_axis_value_interval) {
if ($this->x_axis_value_interval_counter < $this->x_axis_value_interval) {
$this->x_axis_value_interval_counter++;
} else {
imagestring($this->image, 2, $textHorizPos, $textVertPos, $key, $this->x_axis_text_color);
$this->x_axis_value_interval_counter = 0;
}
} else {
imagestring($this->image, 2, $textHorizPos, $textVertPos, $key, $this->x_axis_text_color);
}
}
}
}
$xStart += $this->bar_width + $this->space_width;
}
}
}
开发者ID:rostandnj,项目名称:ok,代码行数:101,代码来源:Phpgraphlib.php
示例20: centeredtext
#legend
centeredtext($im, ' ', 1, 570, 183, 638, 265, $black, $white, $black);
centeredtext($im, ' 1 day ', 1, 571, 184, 637, 200, $black, $white, $white);
imagefilledarc($im, 576, 192, 9, 9, 0, 360, $red, IMG_ARC_PIE);
centeredtext($im, ' 2 days ', 1, 571, 200, 637, 216, $black, $white, $white);
imagefilledarc($im, 576, 208, 7, 7, 0, 360, $blue, IMG_ARC_PIE);
centeredtext($im, ' 3 days ', 1, 571, 216, 637, 232, $black, $white, $white);
imagefilledarc($im, 576, 224, 5, 5, 0, 360, $green, IMG_ARC_PIE);
centeredtext($im, ' 4 days ', 1, 571, 232, 637, 248, $black, $white, $white);
imagefilledarc($im, 576, 240, 3, 3, 0, 360, $black, IMG_ARC_PIE);
centeredtext($im, ' 5+ days ', 1, 571, 248, 637, 264, $black, $white, $white);
imagesetpixel($im, 576, 256, $black);
#axis and grid
centeredtext($im, 'GMT time', 2, 30, 469, 561, 479,
|
请发表评论