src/sb/Graph/Point.php
public function addHorizontalLine($y, $color = 'red', $label = '')
    {

        if (!array_key_exists($color, $this->ink)) {
            throw(new \Exception("Ink color must be in " . implode(",",
                    \array_keys($this->ink))));
        }

        $y = $this->plotValue($y);
        imageline($this->im, 0, $y, $this->width, $y, $this->ink[$color]);

        imagestring($this->im, 2, $this->graph_width / 2 + $this->axis_offset,
            $y, $label, $this->ink[$color]);
    }
public function addHorizontalLine($y, $color = 'red', $label = '')
    {

        if (!array_key_exists($color, $this->ink)) {
            throw(new \Exception("Ink color must be in " . implode(",",
                    \array_keys($this->ink))));
        }

        $y = $this->plotValue($y);
        imageline($this->im, 0, $y, $this->width, $y, $this->ink[$color]);

        imagestring($this->im, 2, $this->graph_width / 2 + $this->axis_offset,
            $y, $label, $this->ink[$color]);
    }
public function addHorizontalLine ( $ y , $ color = 'red' , $ label = '' ) { if ( ! array_key_exists ( $ color , $ this -> ink ) ) { throw ( new \ Exception ( "Ink color must be in " . implode ( "," , \ array_keys ( $ this -> ink ) ) ) ) ; } $ y = $ this -> plotValue ( $ y ) ; imageline ( $ this -> im , 0 , $ y , $ this -> width , $ y , $ this -> ink [ $ color ] ) ; imagestring ( $ this -> im , 2 , $ this -> graph_width / 2 + $ this -> axis_offset , $ y , $ label , $ this -> ink [ $ color ] ) ; }
Add a horizontal line

@param integer $y The y value
@param string $color red, orange, yellow, green, blue, purple
@param string $label The line label
Add a horizontal line