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


PHP Axis::setXCenter方法代码示例

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


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

示例1: init

 public function init(awDriver $driver)
 {
     list($x1, $y1, $x2, $y2) = $this->getPosition();
     // Get space informations
     list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1);
     $this->xAxis->setPadding($leftSpace, $rightSpace);
     if ($this->space->bottom > 0 or $this->space->top > 0) {
         list($min, $max) = $this->yAxis->getRange();
         $interval = $max - $min;
         $this->yAxis->setRange($min - $interval * $this->space->bottom / 100, $max + $interval * $this->space->top / 100);
     }
     // Auto-scaling mode
     $this->yAxis->autoScale();
     // Number of labels is not specified
     if ($this->yAxis->getLabelNumber() === NULL) {
         $number = round(($y2 - $y1) / 75) + 2;
         $this->yAxis->setLabelNumber($number);
     }
     $this->xAxis->line->setX($x1, $x2);
     $this->yAxis->line->setY($y2, $y1);
     // Set ticks
     /* <php5> */
     $this->xAxis->tick('major')->setNumber($this->getXAxisNumber());
     $this->yAxis->tick('major')->setNumber($this->yAxis->getLabelNumber());
     /* </php5> */
     /* <php4> --
     		$this->xAxis->ticks['major']->setNumber($this->getXAxisNumber());
     		$this->yAxis->ticks['major']->setNumber($this->yAxis->getLabelNumber());
     		-- </php4> */
     // Center X axis on zero
     if ($this->xAxisZero) {
         $this->xAxis->setYCenter($this->yAxis, 0);
     }
     // Center Y axis on zero
     if ($this->yAxisZero) {
         $this->yAxis->setXCenter($this->xAxis, 0);
     }
     // Set axis labels
     $labels = array();
     list($xMin, $xMax) = $this->xAxis->getRange();
     for ($i = $xMin; $i <= $xMax; $i++) {
         $labels[] = $i;
     }
     $this->xAxis->label->set($labels);
     parent::init($driver);
     list($x1, $y1, $x2, $y2) = $this->getPosition();
     list($leftSpace, $rightSpace) = $this->getSpace($x2 - $x1, $y2 - $y1);
     // Create the grid
     $this->createGrid();
     // Draw the grid
     $this->grid->setSpace($leftSpace, $rightSpace, 0, 0);
     $this->grid->draw($driver, $x1, $y1, $x2, $y2);
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:53,代码来源:Plot.class.php

示例2: init

 function init($drawer)
 {
     list($x1, $y1, $x2, $y2) = $this->getPosition();
     $this->xAxis->line->setX($x1, $x2);
     $this->xAxis->label->setAlign(NULL, LABEL_BOTTOM);
     $this->xAxis->label->move(0, 3);
     $this->xAxis->setRange($this->extremum->left, $this->extremum->right);
     $this->yAxis->line->setY($y2, $y1);
     $this->yAxis->label->setAlign(LABEL_RIGHT);
     $this->yAxis->label->move(-6, 0);
     $this->yAxis->reverseTickStyle();
     $this->yAxis->setRange($this->extremum->bottom, $this->extremum->top);
     $this->xAxis->setYCenter($this->yAxis, 0);
     $this->yAxis->setXCenter($this->xAxis, 0);
     if ($this->yAxis->getLabelNumber() === NULL) {
         $number = $this->extremum->top - $this->extremum->bottom + 1;
         $this->yAxis->setLabelNumber($number);
     }
     if ($this->xAxis->getLabelNumber() === NULL) {
         $number = $this->extremum->right - $this->extremum->left + 1;
         $this->xAxis->setLabelNumber($number);
     }
     // Set ticks
     $this->xAxis->ticks['major']->setNumber($this->xAxis->getLabelNumber());
     $this->yAxis->ticks['major']->setNumber($this->yAxis->getLabelNumber());
     // Set axis labels
     $labels = array();
     for ($i = 0, $count = $this->xAxis->getLabelNumber(); $i < $count; $i++) {
         $labels[] = $i;
     }
     $this->xAxis->label->set($labels);
     $labels = array();
     for ($i = 0, $count = $this->yAxis->getLabelNumber(); $i < $count; $i++) {
         $labels[] = $i;
     }
     $this->yAxis->label->set($labels);
     parent::init($drawer);
     // Create the grid
     $this->createGrid();
     // Draw the grid
     $this->grid->draw($drawer, $x1, $y1, $x2, $y2);
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:42,代码来源:MathPlot.class.php


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