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


PHP ezcGraphRenderer::drawGridLine方法代码示例

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


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

示例1: drawGrid

 /**
  * Draw grid
  *
  * Draws a grid line at the current position
  * 
  * @param ezcGraphRenderer $renderer Renderer to draw the grid with
  * @param ezcGraphBoundings $boundings Boundings of axis
  * @param ezcGraphCoordinate $position Position of step
  * @param ezcGraphCoordinate $direction Direction of axis
  * @param ezcGraphColor $color Color of axis
  * @param int $stepPosition
  * @return void
  */
 protected function drawGrid(ezcGraphRenderer $renderer, ezcGraphBoundings $boundings, ezcGraphCoordinate $position, ezcGraphCoordinate $direction, ezcGraphColor $color, $stepPosition = null)
 {
     // Calculate position on last axis
     $start = new ezcGraphCoordinate($boundings->x0 + ($width = $boundings->width / 2), $boundings->y0 + ($height = $boundings->height / 2));
     $lastAngle = $this->lastStep * 2 * M_PI;
     $end = new ezcGraphCoordinate($start->x + sin($lastAngle) * $width, $start->y - cos($lastAngle) * $height);
     $direction = new ezcGraphVector($end->x - $start->x, $end->y - $start->y);
     $direction->unify();
     // Convert elipse to circle for correct angle calculation
     $direction->y *= $renderer->xAxisSpace / $renderer->yAxisSpace;
     $angle = $direction->angle(new ezcGraphVector(0, 1));
     $movement = new ezcGraphVector(sin($angle) * $renderer->xAxisSpace * ($direction->x < 0 ? -1 : 1), cos($angle) * $renderer->yAxisSpace);
     $start->x += $movement->x;
     $start->y += $movement->y;
     $end->x -= $movement->x;
     $end->y -= $movement->y;
     $lastPosition = new ezcGraphCoordinate($start->x + ($end->x - $start->x) * $stepPosition, $start->y + ($end->y - $start->y) * $stepPosition);
     $renderer->drawGridLine($position, $lastPosition, $color);
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:32,代码来源:axis_label_radar.php

示例2: drawRectangularGrid

 /**
  * Draw rectangular grid
  *
  * Draws a grid line at the current position for rectangular directed axis.
  *
  * Method special for rectangularly directed axis to minimize the floating
  * point calculation inaccuracies. Those are not necessary for rectangles,
  * while for non-rectangular directed axis.
  * 
  * @param ezcGraphRenderer $renderer Renderer to draw the grid with
  * @param ezcGraphBoundings $boundings Boundings of axis
  * @param ezcGraphCoordinate $position Position of step
  * @param ezcGraphCoordinate $direction Direction of axis
  * @param ezcGraphColor $color Color of axis
  * @return void
  */
 protected function drawRectangularGrid(ezcGraphRenderer $renderer, ezcGraphBoundings $boundings, ezcGraphCoordinate $position, ezcGraphCoordinate $direction, ezcGraphColor $color)
 {
     if (abs($direction->x) < 1.0E-5) {
         $renderer->drawGridLine(new ezcGraphCoordinate($boundings->x0, $position->y), new ezcGraphCoordinate($boundings->x1, $position->y), $color);
     } else {
         $renderer->drawGridLine(new ezcGraphCoordinate($position->x, $boundings->y0), new ezcGraphCoordinate($position->x, $boundings->y1), $color);
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:24,代码来源:axis_label_renderer.php

示例3: drawGrid

 /**
  * Draw grid
  *
  * Draws a grid line at the current position
  * 
  * @param ezcGraphRenderer $renderer Renderer to draw the grid with
  * @param ezcGraphBoundings $boundings Boundings of axis
  * @param ezcGraphCoordinate $position Position of step
  * @param ezcGraphCoordinate $direction Direction of axis
  * @param ezcGraphColor $color Color of axis
  * @return void
  */
 protected function drawGrid(ezcGraphRenderer $renderer, ezcGraphBoundings $boundings, ezcGraphCoordinate $position, ezcGraphCoordinate $direction, ezcGraphColor $color)
 {
     // Direction of grid line is direction of axis turned right by 90
     // degrees
     $gridDirection = new ezcGraphCoordinate($direction->y, -$direction->x);
     $cuttingPoints = array();
     foreach (array(array('start' => new ezcGraphCoordinate($boundings->x0, $boundings->y0), 'dir' => new ezcGraphCoordinate(0, $boundings->y1 - $boundings->y0)), array('start' => new ezcGraphCoordinate($boundings->x0, $boundings->y0), 'dir' => new ezcGraphCoordinate($boundings->x1 - $boundings->x0, 0)), array('start' => new ezcGraphCoordinate($boundings->x1, $boundings->y1), 'dir' => new ezcGraphCoordinate(0, $boundings->y0 - $boundings->y1)), array('start' => new ezcGraphCoordinate($boundings->x1, $boundings->y1), 'dir' => new ezcGraphCoordinate($boundings->x0 - $boundings->x1, 0))) as $boundingLine) {
         // Test for cutting points with bounding lines, where cutting
         // position is between 0 and 1, which means, that the line is hit
         // on the bounding box rectangle. Use these points as a start and
         // ending point for the grid lines. There should *always* be
         // exactly two points returned.
         $cuttingPosition = $this->determineLineCuttingPoint($boundingLine['start'], $boundingLine['dir'], $position, $gridDirection);
         if ($cuttingPosition === false) {
             continue;
         }
         // Round to prevent minor float incorectnesses
         $cuttingPosition = abs(round($cuttingPosition, 2));
         if ($cuttingPosition >= 0 && $cuttingPosition <= 1) {
             $cuttingPoints[] = new ezcGraphCoordinate($boundingLine['start']->x + $cuttingPosition * $boundingLine['dir']->x, $boundingLine['start']->y + $cuttingPosition * $boundingLine['dir']->y);
         }
     }
     if (count($cuttingPoints) < 2) {
         // This should not happpen
         return false;
     }
     // Finally draw grid line
     $renderer->drawGridLine($cuttingPoints[0], $cuttingPoints[1], $color);
 }
开发者ID:andikoller,项目名称:FHC-3.0-FHBGLD,代码行数:41,代码来源:axis_label_renderer.php


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