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


PHP Label::draw方法代码示例

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


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

示例1: drawLabels

	protected function drawLabels($drawer) {
		
		if($this->labelNumber !== NULL) {
			list($min, $max) = $this->range;
			$number = $this->labelNumber - 1;
			if($number < 1) {
				return;
			}
			$function = $this->rangeCallback['toValue'];
			$labels = array();
			for($i = 0; $i <= $number; $i++) {
				$labels[] = $function($i / $number, $min, $max);
			}
			$this->label->set($labels);
		}
		
		$labels = $this->label->count();
		
		for($i = 0; $i < $labels; $i++) {
		
			$p = $this->getPointFromValue($this->label->get($i));
			$this->label->draw($drawer, $p, $i);
		
		}
		
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:26,代码来源:Axis.class.php

示例2: draw

 /**
  * Draw HTML output
  */
 function draw()
 {
     global $c, $sid;
     echo '<td colspan="' . $this->cells . '"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
     $widget = new Cell("clc", "", 1, $this->width, 40);
     $widget->draw();
     echo "</tr><tr>\n";
     $widget = new Label("lbl", $this->headline, "headbox", 1);
     $widget->draw();
     echo "</tr><tr>\n";
     $widget = new FormImage($c["docroot"] . "modules/stats/widgets/statsimage.php?sid={$sid}&diagram=" . $this->diagramType . "&width=" . $this->width . "&height=" . $this->height . "&spid=" . $this->spid, $this->width, $this->height, 1);
     $widget->draw();
     // Draw Legend...
     echo "</tr><tr>\n";
     $widget = new Cell("clc", "", 1, $this->width, 10);
     $widget->draw();
     $colors[0] = __RED;
     $colors[1] = __BLUE;
     $colors[2] = __YELLOW;
     $colors[3] = __GREEN;
     for ($i = 0; $i < count($this->legend); $i++) {
         echo "</tr><tr><td>";
         echo '<table width="100%" border="0" cellpadding="2" cellspacing="0"><tr>';
         echo '<td width="10">' . ($i + 1) . '.</td>';
         echo '<td width="11">';
         echo '<table width="11" height="11" border="0" cellspacing="0" cellpadding="0"><tr><td style="background-color:' . $colors[$i] . ';">' . drawSpacer(11, 11) . '</td></tr></table>';
         echo '</td>';
         echo '<td>' . $this->legend[$i] . '</td>';
         echo '</tr></table></td>';
     }
     echo "</tr></table></td>";
     return $this->cells;
 }
开发者ID:BackupTheBerlios,项目名称:nxwcms-svn,代码行数:36,代码来源:statsdiagram.php

示例3: drawComponent

 function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $max = $this->getRealYMax();
     $min = $this->getRealYMin();
     // Get start and stop values
     list($start, $stop) = $this->getLimit();
     if ($this->lineMode === LINEPLOT_MIDDLE) {
         $inc = $this->xAxis->getDistance(0, 1) / 2;
     } else {
         $inc = 0;
     }
     // Build the polygon
     $polygon = new awPolygon();
     for ($key = $start; $key <= $stop; $key++) {
         $value = $this->datay[$key];
         if ($value !== NULL) {
             $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value));
             $p = $p->move($inc, 0);
             $polygon->set($key, $p);
         }
     }
     // Draw backgrounds
     if (is_a($this->lineBackground, 'awColor') or is_a($this->lineBackground, 'awGradient')) {
         $backgroundPolygon = new awPolygon();
         $p = $this->xAxisPoint($start);
         $p = $p->move($inc, 0);
         $backgroundPolygon->append($p);
         // Add others points
         foreach ($polygon->all() as $point) {
             $backgroundPolygon->append($point);
         }
         $p = $this->xAxisPoint($stop);
         $p = $p->move($inc, 0);
         $backgroundPolygon->append($p);
         // Draw polygon background
         $drawer->filledPolygon($this->lineBackground, $backgroundPolygon);
     }
     $this->drawArea($drawer, $polygon);
     // Draw line
     $prev = NULL;
     // Line color
     if ($this->lineHide === FALSE) {
         if ($this->lineColor === NULL) {
             $this->lineColor = new awColor(0, 0, 0);
         }
         foreach ($polygon->all() as $point) {
             if ($prev !== NULL) {
                 $drawer->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness));
             }
             $prev = $point;
         }
         $this->lineColor->free();
     }
     // Draw marks and labels
     foreach ($polygon->all() as $key => $point) {
         $this->mark->draw($drawer, $point);
         $this->label->draw($drawer, $point, $key);
     }
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:59,代码来源:LinePlot.class.php

示例4: draw

		/**
		 * Write HTML for the WUI-Object.
		 *
		 */
		function draw() {
			$dr3 = new Label("lbl", $this->text, "headbox", $this->columns);
			echo "<tr>";
			$dr3->draw();
			echo "</tr>";

			return $this->columns;
		}
开发者ID:BackupTheBerlios,项目名称:nxwcms-svn,代码行数:12,代码来源:subtitle.php

示例5: drawTitle

	 function drawTitle() {
	
		$drawer = $this->getDrawer();
	
		$point = new awPoint(
			$this->width / 2,
			10
		);
		
		$this->title->draw($drawer, $point);
	
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:12,代码来源:Graph.class.php

示例6: drawComponent

 public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $count = count($this->datay);
     $max = $this->getRealYMax(NULL);
     $min = $this->getRealYMin(NULL);
     // Find zero for bars
     if ($this->xAxisZero and $min <= 0 and $max >= 0) {
         $zero = 0;
     } else {
         if ($max < 0) {
             $zero = $max;
         } else {
             $zero = $min;
         }
     }
     // Get base position
     $zero = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint(0, $zero));
     // Distance between two values on the graph
     $distance = $this->xAxis->getDistance(0, 1);
     // Compute paddings
     $leftPadding = $this->barPadding->left * $distance;
     $rightPadding = $this->barPadding->right * $distance;
     $padding = $leftPadding + $rightPadding;
     $space = $this->barSpace * ($this->number - 1);
     $barSize = ($distance - $padding - $space) / $this->number;
     $barPosition = $leftPadding + $barSize * ($this->identifier - 1);
     for ($key = 0; $key < $count; $key++) {
         $value = $this->datay[$key];
         if ($value !== NULL) {
             $position = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value));
             $barStart = $barPosition + ($this->identifier - 1) * $this->barSpace + $position->x;
             $barStop = $barStart + $barSize;
             $t1 = min($zero->y, $position->y);
             $t2 = max($zero->y, $position->y);
             if (round($t2 - $t1) == 0) {
                 continue;
             }
             $p1 = new awPoint(round($barStart) + $this->depth + $this->move->left, round($t1) - $this->depth + $this->move->top);
             $p2 = new awPoint(round($barStop) + $this->depth + $this->move->left, round($t2) - $this->depth + $this->move->top);
             $this->drawBar($drawer, $p1, $p2);
         }
     }
     // Draw labels
     foreach ($this->datay as $key => $value) {
         if ($value !== NULL) {
             $position = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value));
             $point = new awPoint($barPosition + ($this->identifier - 1) * $this->barSpace + $position->x + $barSize / 2 + 1 + $this->depth, $position->y - $this->depth);
             $this->label->draw($drawer, $point, $key);
         }
     }
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:51,代码来源:BarPlot.class.php

示例7: draw

 /**
  * Draw HTML output
  */
 function draw()
 {
     global $c, $sid;
     echo '<td colspan="' . $this->cells . '"><table width="600" border="0" cellpadding="0" cellspacing="0"><tr>';
     $widget = new Cell("clc", "", 2, $this->width, 20);
     $widget->draw();
     echo "</tr><tr>\n";
     $widget = new Label("lbl", '<br><h3>' . $this->headline . '</h3>', '', 2);
     $widget->draw();
     echo "</tr>\n";
     echo $this->container;
     echo "</tr></table></td>";
     return $this->cells;
 }
开发者ID:BackupTheBerlios,项目名称:nxwcms-svn,代码行数:17,代码来源:statsclickpath.php

示例8: draw

 /**
  * Draw HTML output
  */
 function draw()
 {
     global $c, $sid;
     echo '<td colspan="' . $this->cells . '" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
     $widget = new Cell("clc", "", 4, $this->width, 20);
     $widget->draw();
     echo "</tr><tr>\n";
     $widget = new Label("lbl", $this->headline, "stats_headline", 4);
     $widget->draw();
     echo "</tr>\n";
     echo $this->container;
     echo "</tr></table></td>";
     return $this->cells;
 }
开发者ID:BackupTheBerlios,项目名称:nxwcms-svn,代码行数:17,代码来源:topitems.php

示例9: drawComponent

 public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $count = count($this->datay);
     // Get start and stop values
     list($start, $stop) = $this->getLimit();
     // Build the polygon
     $polygon = new awPolygon();
     for ($key = 0; $key < $count; $key++) {
         $x = $this->datax[$key];
         $y = $this->datay[$key];
         if ($y !== NULL) {
             $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($x, $y));
             $polygon->set($key, $p);
         } else {
             if ($this->linkNull === FALSE) {
                 $polygon->set($key, NULL);
             }
         }
     }
     // Link points if needed
     if ($this->link) {
         $prev = NULL;
         foreach ($polygon->all() as $point) {
             if ($prev !== NULL and $point !== NULL) {
                 $drawer->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness));
             }
             $prev = $point;
         }
         $this->lineColor->free();
     }
     // Draw impulses
     if ($this->impulse instanceof awColor) {
         foreach ($polygon->all() as $key => $point) {
             if ($point !== NULL) {
                 $zero = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, 0));
                 $drawer->line($this->impulse, new awLine($zero, $point, awLine::SOLID, 1));
             }
         }
     }
     // Draw marks and labels
     foreach ($polygon->all() as $key => $point) {
         $this->mark->draw($drawer, $point);
         $this->label->draw($drawer, $point, $key);
     }
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:45,代码来源:ScatterPlot.class.php

示例10: draw

 /**
  * Draw HTML output
  */
 function draw()
 {
     global $c, $sid, $lang;
     echo '<form name="form1">';
     echo '<td colspan="' . $this->cells . '"><table width="100%" border="0" cellpadding="3" cellspacing="0"><tr>';
     $widget = new Cell("clc", "", 2, $this->width, 20);
     $widget->draw();
     echo "</tr><tr>\n";
     $widget = new Label("lbl", $this->headline, "stats_headline", 2);
     $widget->draw();
     echo "</tr>\n";
     echo "<tr><td colspan=\"" . $this->cells . "\" class=\"bcopy\">" . $lang->get("pta", "Select page to analyze:") . "</td></tr>";
     echo "<tr>";
     $this->sps->draw();
     echo "<td> ";
     $lbi = new LinkButton("action", $lang->get("go", "Go"), "navelement", "submit");
     $lbi->draw();
     retain("action", "");
     retain("sid", $sid);
     echo "</td></tr></table></td>";
     echo "</form>";
     return $this->cells;
 }
开发者ID:BackupTheBerlios,项目名称:nxwcms-svn,代码行数:26,代码来源:page_selector.php

示例11: drawValues

 function drawValues($image, Boundary $b)
 {
     $out = $this->getValuesArea($b);
     if ($out->width() < $this->depth || $out->height() < $this->depth || $out->left() > $out->right() || $out->top() > $out->bottom()) {
         throw new ChartException("Недостаточно места для вывода значений.");
     }
     $line = new Line(new Boundary(0, 0, 0, 0), $this->values['bgcolors'][0], $this->values['thickness']);
     $w = ($out->width() - $this->depth) / count($this->data);
     $l = new Label(new Boundary(0, 0, 0, 0), '', $this->values['font'], Color::getDefault(), Label::ALIGN_CENTER_MIDDLE);
     $e = new Ellipse(new Boundary(0, 0, $this->values['thickness'] * 3, $this->values['thickness'] * 3));
     for ($i = 0; $i < count($this->data); $i++) {
         $c = $out->left() + $w * $i + $w / 2.0;
         $line->bounds()->right($c);
         $line->bounds()->bottom($out->bottom() - ($this->data[$i] - $this->min) * $out->height() / ($this->max - $this->min));
         $line->background($this->values['bgcolors'][$i % count($this->values['bgcolors'])]);
         if ($i != 0) {
             $line->draw($image);
             $e->bounds()->move(new Size($line->bounds()->left() - $this->values['thickness'] * 3 / 2, $line->bounds()->top() - $this->values['thickness'] * 3 / 2));
             $e->background($this->values['bgcolors'][($i - 1) % count($this->values['bgcolors'])]);
             $e->draw($image);
         }
         $line->bounds()->left($line->bounds()->right());
         $line->bounds()->top($line->bounds()->bottom());
         if ($this->values['labels']) {
             $l->text($this->data[$i]);
             $l->bounds()->bottom($line->bounds()->top() - 5);
             $l->bounds()->top($l->bounds()->bottom() - $this->values['font']->getTextExtent()->height);
             $l->bounds()->left($line->bounds()->left());
             $l->bounds()->right($line->bounds()->left());
             $l->background($this->values['fgcolors'][$i % count($this->values['fgcolors'])]);
             $l->draw($image);
         }
     }
     $e->bounds()->move(new Size($line->bounds()->left() - $this->values['thickness'] * 3 / 2, $line->bounds()->top() - $this->values['thickness'] * 3 / 2));
     $e->background($line->background());
     $e->draw($image);
 }
开发者ID:shevtsov-s,项目名称:planetsbook,代码行数:37,代码来源:LineChart.php

示例12: drawSpacer

		/** 
		 * Draw the control body
		 */
		function draw_body($parent = "0", $depth = 0) {
			$data = $this->getFunctionData($parent);

			for ($i = 0; $i < count($data); $i++) {
				echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";

				echo "<tr>";
				echo "<td width=\"25\">" . drawSpacer(1, 1). "</td>";
				echo "<td width=\"" . (250 - $depth * 25) . "\">" . drawSpacer(1, 1). "</td>";
				echo "<td width=\"300\">" . drawSpacer(1, 1). "</td>";
				echo "</tr>";

				if ($depth == 0) {
					echo "<tr>";

					echo "<td width=\"25\" style=\"border-bottom:1px solid black;\">" . drawSpacer(1, 1). "</td>";
					echo "<td width=\"250\" style=\"border-bottom:1px solid black;\">" . drawSpacer(1, 1). "</td>";
					echo "<td width=\"300\" style=\"border-bottom:1px solid black;\">" . drawSpacer(1, 1). "</td>";
					echo "</tr>";
				}

				echo "<tr>";

				if (in_array($data[$i][ID], $this->configData)) {
					$checked = true;
				} else {
					$checked = false;
				}

				$chkbox = new Checkbox($data[$i][ID], "1", "embedded", $checked);
				$chkbox->draw();
				$lbl = new Label("lbl", $data[$i][NAME], "bcopy");
				$lbl->draw();
				$lbl = new Label("lbl", $data[$i][DESC], "bcopy");
				$lbl->draw();
				echo "</tr>";

				echo "<tr>";
				echo "<td width=\"15\">" . drawSpacer(1, 1). "</td>";
				echo "<td colspan=\"2\">" . drawSpacer(1, 1);
				$this->draw_body($data[$i][ID], ($depth + 1));
				echo "</td>";
				echo "</tr>";
				echo "</table>";
			}
		}
开发者ID:BackupTheBerlios,项目名称:nxwcms-svn,代码行数:49,代码来源:acl_widget.php

示例13: drawValues

 function drawValues($image, Boundary $b)
 {
     $out = $this->getValuesArea($b);
     if ($out->width() < $this->depth || $out->height() < $this->depth || $out->left() > $out->right() || $out->top() > $out->bottom()) {
         throw new ChartException("Недостаточно места для вывода значений.");
     }
     $r = new Rectangle3D(new Boundary(0, 0, 0, 0), NULL, Color::getDefault(), NULL, $this->depth);
     $w = ($out->width() - $this->depth) / count($this->data);
     $wr = $w / 1.5 - $this->depth;
     $l = new Label(new Boundary(0, 0, 0, 0), '', $this->values['font'], Color::getDefault(), Label::ALIGN_CENTER_MIDDLE);
     for ($i = 0; $i < count($this->data); $i++) {
         $c = $out->left() + $w * $i + $w / 2.0;
         $r->bounds()->left($c - $wr / 2);
         $r->bounds()->right($c + $wr / 2);
         $r->bounds()->top($out->bottom() - ($this->data[$i] - $this->min) * $out->height() / ($this->max - $this->min));
         $r->bounds()->bottom($out->bottom() - 1);
         $r->background($this->values['bgcolors'][$i % count($this->values['bgcolors'])]);
         $r->draw($image);
         $l->text($this->data[$i]);
         if (($h = $this->values['font']->getTextExtent()->height) > $r->bounds()->height()) {
             $r->bounds()->bottom($r->bounds()->top());
             $r->bounds()->top($r->bounds()->bottom() - $h);
         }
         if ($this->values['labels']) {
             $l->bounds($r->bounds());
             $l->background($this->values['fgcolors'][$i % count($this->values['fgcolors'])]);
             $l->draw($image);
         }
     }
 }
开发者ID:shevtsov-s,项目名称:planetsbook,代码行数:30,代码来源:BarChart.php

示例14: drawTitle

 function drawTitle($image, Boundary $b)
 {
     $s = $this->title['font']->getTextExtent($this->title['text']);
     //var_dump(imagettfbbox($this->title['font']->size,$this->title['font']->angle,$this->title['font']->family,$this->title['text']));
     //throw new exception ($s->height);
     if ($s->height > $b->height() || $s->width > $b->width()) {
         throw new ChartException("Недостаточно места для вывода заголовка.");
     }
     $b->bottom($b->top() + $s->height);
     $title = new Label($b, $this->title['text'], $this->title['font'], $this->title['color'], Label::ALIGN_CENTER_TOP);
     $title->draw($image);
 }
开发者ID:shevtsov-s,项目名称:planetsbook,代码行数:12,代码来源:Chart.php

示例15: drawComponent

 public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $count = count($this->values);
     $sum = array_sum($this->values);
     $width = $x2 - $x1;
     $height = $y2 - $y1;
     if ($aliasing) {
         $x = $width / 2;
         $y = $height / 2;
     } else {
         $x = $width / 2 + $x1;
         $y = $height / 2 + $y1;
     }
     $position = $this->angle;
     $values = array();
     $parts = array();
     $angles = 0;
     if ($aliasing) {
         $side = new awSide(0, 0, 0, 0);
     }
     foreach ($this->values as $key => $value) {
         $angle = $value / $sum * 360;
         if ($key === $count - 1) {
             $angle = 360 - $angles;
         }
         $angles += $angle;
         if (array_key_exists($key, $this->explode)) {
             $middle = 360 - ($position + $angle / 2);
             $posX = $this->explode[$key] * cos($middle * M_PI / 180);
             $posY = $this->explode[$key] * sin($middle * M_PI / 180) * -1;
             if ($aliasing) {
                 $explode = new awPoint($posX * 2, $posY * 2);
                 $side->set(max($side->left, $posX * -2), max($side->right, $posX * 2), max($side->top, $posY * -2), max($side->bottom, $posY * 2));
             } else {
                 $explode = new awPoint($posX, $posY);
             }
         } else {
             $explode = new awPoint(0, 0);
         }
         $values[$key] = array($position, $position + $angle, $explode);
         $color = $this->colors[$key % count($this->colors)];
         $parts[$key] = new awPiePart($color);
         // Add part to the legend
         $legend = array_key_exists($key, $this->legendValues) ? $this->legendValues[$key] : $key;
         $this->legend->add($parts[$key], $legend, awLegend::BACKGROUND);
         $position += $angle;
     }
     if ($aliasing) {
         $mainDrawer = $drawer;
         $x *= 2;
         $y *= 2;
         $width *= 2;
         $height *= 2;
         $this->size *= 2;
         $image = new awImage();
         $image->border->hide();
         $image->setSize($width + $side->left + $side->right, $height + $side->top + $side->bottom + $this->size + 1);
         $drawer = $image->getDrawer($width / $image->width, $height / $image->height, ($width / 2 + $side->left) / $image->width, ($height / 2 + $side->top) / $image->height);
     }
     // Draw 3D effect
     for ($i = $this->size; $i > 0; $i--) {
         foreach ($values as $key => $value) {
             $color = clone $this->colors[$key % count($this->colors)];
             $color->brightness(-50);
             list($from, $to, $explode) = $value;
             $drawer->filledArc($color, $explode->move($x, $y + $i), $width, $height, $from, $to);
             $color->free();
             unset($color);
             if ($this->border instanceof awColor) {
                 $point = $explode->move($x, $y);
                 if ($i === $this->size) {
                     $drawer->arc($this->border, $point->move(0, $this->size), $width, $height, $from, $to);
                 }
             }
         }
     }
     foreach ($values as $key => $value) {
         $color = $this->colors[$key % count($this->colors)];
         list($from, $to, $explode) = $value;
         $drawer->filledArc($color, $explode->move($x, $y), $width, $height, $from, $to);
         if ($this->border instanceof awColor) {
             $point = $explode->move($x, $y);
             $drawer->arc($this->border, $point, $width, $height, $from, $to);
         }
     }
     if ($aliasing) {
         $x = $x / 2 + $x1;
         $y = $y / 2 + $y1;
         $width /= 2;
         $height /= 2;
         $this->size /= 2;
         foreach ($values as $key => $value) {
             $old = $values[$key][2];
             $values[$key][2] = new awPoint($old->x / 2, $old->y / 2);
         }
         $mainDrawer->copyResizeImage($image, new awPoint($x1 - $side->left / 2, $y1 - $side->top / 2), new awPoint($x1 - $side->left / 2 + $image->width / 2, $y1 - $side->top / 2 + $image->height / 2), new awPoint(0, 0), new awPoint($image->width, $image->height), TRUE);
         $drawer = $mainDrawer;
     }
     // Get labels values
     $pc = array();
//.........这里部分代码省略.........
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:101,代码来源:Pie.class.php


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