本文整理汇总了PHP中Label::setAlign方法的典型用法代码示例。如果您正苦于以下问题:PHP Label::setAlign方法的具体用法?PHP Label::setAlign怎么用?PHP Label::setAlign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::setAlign方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct a new graph
*
* @param int $width Graph width
* @param int $height Graph height
* @param string $name Graph name for the cache (must be unique). Let it null to not use the cache.
* @param int $timeout Cache timeout (unix timestamp)
*/
public function __construct($width = NULL, $height = NULL, $name = NULL, $timeout = 0)
{
parent::__construct();
$this->setSize($width, $height);
$this->name = $name;
$this->timeout = $timeout;
// Clean sometimes all the cache
if (mt_rand(0, 5000) === 0) {
awGraph::cleanCache();
}
if ($this->name !== NULL) {
$file = ARTICHOW . "/cache/" . $this->name . "-time";
if (is_file($file)) {
$type = awGraph::cleanGraphCache($file);
if ($type === NULL) {
awGraph::deleteFromCache($this->name);
} else {
header("Content-Type: image/" . $type);
readfile(ARTICHOW . "/cache/" . $this->name . "");
exit;
}
}
}
$this->title = new awLabel(NULL, new awTuffy(16), NULL, 0);
$this->title->setAlign(awLabel::CENTER, awLabel::BOTTOM);
}
示例2: __construct
/**
* Construct a new graph
*
* @param int $width Graph width
* @param int $height Graph height
* @param string $name Graph name for the cache (must be unique). Let it null to not use the cache.
* @param int $timeout Cache timeout (unix timestamp)
*/
public function __construct($width = NULL, $height = NULL, $name = NULL, $timeout = 0)
{
parent::__construct();
$this->setSize($width, $height);
if (ARTICHOW_CACHE) {
$this->name = $name;
$this->timeout = $timeout;
// Clean sometimes all the cache
if (mt_rand(0, 5000) === 0) {
awGraph::cleanCache();
}
// Take the graph from the cache if possible
if ($this->name !== NULL) {
$this->fileCache = ARTICHOW_CACHE_DIRECTORY . "/" . $this->name;
$this->fileCacheTime = $this->fileCache . "-time";
if (is_file($this->fileCache)) {
$type = awGraph::cleanGraphCache($this->fileCacheTime);
if ($type === NULL) {
awGraph::deleteFromCache($this->name);
} else {
header("Content-Type: image/" . $type);
echo file_get_contents($this->fileCache);
exit;
}
}
}
}
$this->title = new awLabel(NULL, new awTuffy(16), NULL, 0);
$this->title->setAlign(awLabel::CENTER, awLabel::BOTTOM);
}
示例3: setTitleAlignment
/**
* Change title alignment
*
* @param int $alignment New Alignment
*/
public function setTitleAlignment($alignment) {
switch($alignment) {
case awLabel::TOP :
$this->setTitlePosition(1);
$this->title->setAlign(NULL, awLabel::BOTTOM);
break;
case awLabel::BOTTOM :
$this->setTitlePosition(0);
$this->title->setAlign(NULL, awLabel::TOP);
break;
case awLabel::LEFT :
$this->setTitlePosition(0);
$this->title->setAlign(awLabel::LEFT);
break;
case awLabel::RIGHT :
$this->setTitlePosition(1);
$this->title->setAlign(awLabel::RIGHT);
break;
}
}
示例4: setTitleAlignment
/**
* Change title alignment
*
* @param int $alignment New Alignment
*/
function setTitleAlignment($alignment) {
switch($alignment) {
case LABEL_TOP :
$this->setTitlePosition(1);
$this->title->setAlign(NULL, LABEL_BOTTOM);
break;
case LABEL_BOTTOM :
$this->setTitlePosition(0);
$this->title->setAlign(NULL, LABEL_TOP);
break;
case LABEL_LEFT :
$this->setTitlePosition(0);
$this->title->setAlign(LABEL_LEFT);
break;
case LABEL_RIGHT :
$this->setTitlePosition(1);
$this->title->setAlign(LABEL_RIGHT);
break;
}
}
示例5: awComponent
/**
* Build the component
*/
function awComponent()
{
// Component legend
$this->legend = new awLegend();
$this->padding = new awSide(25, 25, 25, 25);
$this->space = new awSide(0, 0, 0, 0);
// Component title
$this->title = new awLabel(NULL, new awTuffy(10), NULL, 0);
$this->title->setAlign(LABEL_CENTER, LABEL_TOP);
}
示例6: __construct
/**
* Build the component
*/
public function __construct()
{
// Component legend
$this->legend = new awLegend();
$this->padding = new awSide(25, 25, 25, 25);
$this->space = new awSide(0, 0, 0, 0);
// Component title
$this->title = new awLabel(NULL, new awTuffy(10), NULL, 0);
$this->title->setAlign(awLabel::CENTER, awLabel::TOP);
}
示例7: drawComponent
//.........这里部分代码省略.........
// 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();
foreach ($this->values as $key => $value) {
$pc[$key] = round($value / $sum * 100, $this->precision);
}
if ($this->label->count() === 0) {
// Check that there is no user defined values
$this->label->set($pc);
}
$position = 0;
foreach ($pc as $key => $value) {
// Limit number of labels to display
if ($position === $this->number) {
break;
}
if (is_null($this->minimum) === FALSE and $value < $this->minimum) {
continue;
}
$position++;
list($from, $to, $explode) = $values[$key];
$angle = $from + ($to - $from) / 2;
$angleRad = (360 - $angle) * M_PI / 180;
$point = new awPoint($x + $explode->x + cos($angleRad) * ($width / 2 + $this->position), $y + $explode->y - sin($angleRad) * ($height / 2 + $this->position));
$angle %= 360;
// We don't display labels on the 3D effect
if ($angle > 0 and $angle < 180) {
$point = $point->move(0, -1 * sin($angleRad) * $this->size);
}
if ($angle >= 45 and $angle < 135) {
$this->label->setAlign(awLabel::CENTER, awLabel::BOTTOM);
} else {
if ($angle >= 135 and $angle < 225) {
$this->label->setAlign(awLabel::RIGHT, awLabel::MIDDLE);
} else {
if ($angle >= 225 and $angle < 315) {
$this->label->setAlign(awLabel::CENTER, awLabel::TOP);
} else {
$this->label->setAlign(awLabel::LEFT, awLabel::MIDDLE);
}
}
}
$this->label->draw($drawer, $point, $key);
}
}
示例8: dis_chart_bar_multiple
function dis_chart_bar_multiple($chart) {
global $chart_colors;
$title = $chart["title"];
$xlabels = $chart["xlabels"];
$values = $chart["plots"]["values"];
$labels = $chart["plots"]["labels"];
$legends = $chart["plots"]["legends"];
$new_bar = $chart["plots"]["new_bar"];
$graph = new Graph(600, 250);
$graph->setAntiAliasing(TRUE);
$graph->setBackgroundColor(new Color(240, 240, 240));
$group = new PlotGroup;
$group->grid->hideVertical();
$group->setPadding(45, 22 ,30, 40);
$group->setSpace(3, 3, NULL, NULL);
$group->legend->setAlign(NULL, LEGEND_TOP);
$group->legend->setPosition(1,0);
// X axis Labels infos
$xlabel = new Label($xlabels);
$group->axis->bottom->setlabelText($xlabels);
// Title infos
if ($title != "") {
$graph->title->set("$title");
}
$num = 0;
$nb_bars = array_sum($new_bar);
$num_bar = 0;
// $num_plot is the plot number
// $num_bar is the bar number (1 bar can cumul more than one plot)
foreach ($values as $num_plot => $plot_values) {
// Chart infos : colors, size, shadow
if ($new_bar[$num_plot] == 1) {
$num_bar++;
}
$plot = new BarPlot($plot_values, $num_bar, $nb_bars);
$plot->setBarColor(new Color($chart_colors[$num_plot][0], $chart_colors[$num_plot][1], $chart_colors[$num_plot][2]));
$plot->setBarSize(0.6);
if ($new_bar[$num_plot] == 1) {
$plot->barShadow->setSize(2);
$plot->barShadow->smooth(TRUE);
// Labels infos
$label = new Label($labels[$num_plot]);
$label->setFont(new Tuffy(8));
$label->setAlign(NULL, LABEL_TOP);
$plot->label = $label;
}
$group->add($plot);
$group->legend->add($plot, utf8_decode($legends[$num_plot]), LEGEND_BACKGROUND);
}
$graph->add($group);
$graph->draw();
}