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


PHP Label::text方法代码示例

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


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

示例1: testSetParams

 public function testSetParams()
 {
     $params = array('align' => Text::ALIGN_CENTER, 'fontSize' => 12, 'color' => '#ff0000', 'text' => 'foo', 'foo' => 123);
     $this->label->text()->setParams($params);
     $this->assertEquals($params['align'], $this->label->text()->getAlign());
     $this->assertEquals($params['fontSize'], $this->label->text()->getFontSize());
     $this->assertEquals($params['color'], $this->label->text()->getColor());
     $this->assertEquals($params['text'], $this->label->text()->getValue());
     $values = $this->label->toArray();
     $this->assertEquals($params['align'], $values['align']);
     $this->assertEquals($params['fontSize'], $values['fontSize']);
     $this->assertEquals($params['color'], $values['color']);
     $this->assertEquals($params['text'], $values['text']);
 }
开发者ID:neeckeloo,项目名称:AmChartsPHP,代码行数:14,代码来源:LabelTest.php

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

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


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