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


PHP Label::setFont方法代码示例

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


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

示例1: 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();
}
开发者ID:Kervinou,项目名称:OBM,代码行数:59,代码来源:chart_index.php

示例2: array

$plot->barShadow->smooth(TRUE);
$mois = array('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc');
$label = array();
foreach ($mois as $m) {
    $label[] = $m;
}
$label[] = ' ';
foreach ($mois as $m) {
    $label[] = $m;
}
$plot->xAxis->setLabelText($label);
/* ICI */
$max = array_max($values);
$yValues = array();
for ($i = 0; $i <= $max; $i++) {
    $yValues[] = $i;
}
$plot->yAxis->setLabelText($yValues);
// Image::drawError(var_export($yValues, TRUE));
$plot->yAxis->setLabelText($yValues);
$plot->setPadding(30, 5, 20, 15);
$labelAvant = new Label("2005");
$labelAvant->setFont(new TTFFont(ARTICHOW_FONT . '/TuffyBold.ttf', 12));
$labelAvant->move(180, 10);
$labelMaintenant = new Label("2006");
$labelMaintenant->setFont(new TTFFont(ARTICHOW_FONT . '/TuffyBold.ttf', 12));
$labelMaintenant->move(450, 10);
$graph->add($plot);
$graph->addLabel($labelAvant, 0, 0);
$graph->addLabel($labelMaintenant, 0, 0);
$graph->draw();
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:31,代码来源:set-label-text-error.php

示例3: drawComponent

 public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $this->label->setFont(new Tuffy(8));
     $datayReal = $this->datay;
     $dataySkewed = array();
     for ($index = 0; $index < count($this->datay); $index++) {
         $dataySkewed[$index] = false;
     }
     $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) {
             /* Determine if we should use cut symbol */
             $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;
             }
             if ($dataySkewed[$key]) {
                 $xmin = round($t1) - $this->depth + $this->move->top;
                 $xmax = round($t2) - $this->depth + $this->move->top;
                 $dividerPoint = ($xmax - $xmin) * 0.2 + $xmin;
                 $p1x = round($barStart) + $this->depth + $this->move->left;
                 $p1y = round($t1) - $this->depth + $this->move->top;
                 $p2x = round($barStop) + $this->depth + $this->move->left;
                 $p2y = round($t2) - $this->depth + $this->move->top;
                 $p1 = new awPoint($p1x, $p1y);
                 $p2 = new awPoint($p2x, $p2y);
                 $this->drawBar($drawer, $p1, $p2, $key);
                 $lineX = round($barStop) + $this->depth + $this->move->left;
                 $lineY = $dividerPoint;
                 /* Draw a two-pixel white line over the bar at the divider point. */
                 $white = imagecolorallocate($drawer->resource, 255, 255, 255);
                 imageline($drawer->resource, $lineX - $barSize + 1, $lineY, $lineX + 1, $lineY, $white);
                 imageline($drawer->resource, $lineX - $barSize + 1, $lineY + 1, $lineX + 1, $lineY + 1, $white);
             } else {
                 $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, $key);
             }
         }
     }
     $maxValue = $this->maxValue;
     // Draw labels
     foreach ($datayReal as $key => $value) {
         if ($value !== NULL) {
             if ($value > $maxValue) {
                 $maxValue = $value;
             }
             $position = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $this->datay[$key]));
             $position2 = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $this->datay[$key] / 2));
             $point = new awPoint($barPosition + ($this->identifier - 1) * $this->barSpace + $position->x + $barSize / 2 + 1 + $this->depth, $position->y - $this->depth);
             $point2 = new awPoint($barPosition + ($this->identifier - 1) * $this->barSpace + $position2->x + $barSize / 2 + 1 + $this->depth, $position2->y - $this->depth);
             if ($maxValue == 0) {
                 $maxValue = 1;
             }
             if ($value != 0 && $this->drawPercent) {
                 /* Mode 2 is the white box number at the top of the bar */
                 $this->label->drawSpecial($drawer, $point2, $key, $value);
                 //$this->label->draw($drawer, $point, $key);
             }
         }
     }
     switch ($this->view) {
         case DASHBOARD_GRAPH_YEARLY:
             $tabImage = imagecreatefrompng('images/tab3.png');
             imagecopy($drawer->resource, $tabImage, 399, 0, 0, 0, 63, 73);
             break;
         case DASHBOARD_GRAPH_MONTHLY:
             $tabImage = imagecreatefrompng('images/tab2.png');
             imagecopy($drawer->resource, $tabImage, 399, 0, 0, 0, 63, 73);
             break;
         case DASHBOARD_GRAPH_WEEKLY:
         default:
//.........这里部分代码省略.........
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:101,代码来源:BarPlotDashboard.class.php


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