本文整理汇总了PHP中Label::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Label::count方法的具体用法?PHP Label::count怎么用?PHP Label::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: 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();
//.........这里部分代码省略.........