getAxisWidth() public method

Get the axis width
public getAxisWidth ( ) : integer
return integer
Example #1
0
 public function testSetAxisOptions()
 {
     $g = new Graph($this->imageOptions);
     $g->setAxisOptions(new Rgb(128, 128, 128), 5);
     $this->assertEquals(new Rgb(128, 128, 128), $g->getAxisColor());
     $this->assertEquals(5, $g->getAxisWidth());
 }
 /**
  * Draw the Y Axis
  *
  * @param  array        $yAxis
  * @param  \ArrayObject $points
  * @param  int          $offset
  * @return void
  */
 protected function drawYAxis($yAxis, $points, $offset = 0)
 {
     $this->graph->adapter()->setStrokeWidth($this->graph->getAxisWidth());
     $this->graph->adapter()->setStrokeColor($this->graph->getAxisColor());
     $this->graph->adapter()->drawLine($points->zeroPoint['x'], $points->zeroPoint['y'], $points->endY['x'], $points->endY['y']);
     $this->graph->adapter()->setFillColor($this->graph->getFontColor());
     $i = 0;
     if ($offset != 0) {
         if ($this->graph->adapter() instanceof \Pop\Pdf\Pdf) {
             $realYDiv = ($points->yLength + $offset * 2) / (count($yAxis) - 1);
             $realZeroY = $points->zeroPoint['y'] - $realYDiv / 2;
         } else {
             $realYDiv = ($points->yLength - $offset * 2) / (count($yAxis) - 1);
             $realZeroY = $points->zeroPoint['y'] - $realYDiv / 2;
         }
     } else {
         $realYDiv = $points->yDiv;
         $realZeroY = $points->zeroPoint['y'];
     }
     foreach ($yAxis as $y) {
         $xFontOffset = $this->graph->getFontSize() * strlen($y) / 1.5 + 15;
         $yFontOffset = $this->graph->getFontSize() / 2;
         $this->graph->adapter()->drawLine($points->zeroPoint['x'], $realZeroY - $realYDiv * $i, $points->zeroPoint['x'] - 5, $realZeroY - $realYDiv * $i);
         if (null !== $this->graph->getFont()) {
             if ($this->graph->adapter() instanceof \Pop\Pdf\Pdf) {
                 $this->graph->adapter()->addText($points->zeroPoint['x'] - $xFontOffset, $realZeroY - $realYDiv * $i - $yFontOffset, $this->graph->getFontSize(), $y, $this->graph->getFonts($this->graph->getFont()));
             } else {
                 $this->graph->adapter()->text($y, $this->graph->getFontSize(), $points->zeroPoint['x'] - $xFontOffset, $realZeroY - $realYDiv * $i + $yFontOffset, $this->graph->getFonts($this->graph->getFont()));
             }
         } else {
             if ($this->graph->adapter() instanceof \Pop\Pdf\Pdf) {
                 $this->graph->adapter()->addFont('Arial');
                 $this->graph->adapter()->addText($points->zeroPoint['x'] - $xFontOffset, $realZeroY - $realYDiv * $i - $yFontOffset, $this->graph->getFontSize(), $y, 'Arial');
             } else {
                 $this->graph->adapter()->text($y, $this->graph->getFontSize(), $points->zeroPoint['x'] - $xFontOffset, $realZeroY - $realYDiv * $i + $yFontOffset);
             }
         }
         $i++;
     }
 }