src/sb/Graph/Point.php
public function draw()
    {

        $this->drawYaxis();

        if ($this->connect_points == 1) {
            $this->connectPoints();
        }

        foreach ($this->points as $point) {

            if ($this->y_axis_hints == 1) {
                imagedashedline($this->im, $point->x, $this->height, $point->x,
                    0, $this->ink['axis']);
            } else {

                //add axis line
                imageline($this->im, $point->x, $this->graph_height, $point->x,
                    $this->graph_height + 10, $this->ink['axis']);
            }

            //add axis label
            imagestring($this->im, 1, $point->x + 5, $this->graph_height + 10,
                $point->label, $this->ink['text']);

            //don't plot actual point if it is null
            if (is_null($point->value)) {
                continue;
            }

            //plot point
            imagefilledellipse($this->im, $point->x, $point->y, 7, 7,
                $this->ink['point']);

            //add point label
            if ($point->y <= 5) {
                $posy = $point->y + 5;
            } elseif ($point->y >= $this->graph_height - 5) {
                $posy = $point->y - 20;
            } else {
                $posy = $point->y - 15;
            }

            imagestring($this->im, 3, $point->x + 10, $posy, $point->value,
                $this->ink['point']);
        }
    }
public function draw()
    {

        $this->drawYaxis();

        if ($this->connect_points == 1) {
            $this->connectPoints();
        }

        foreach ($this->points as $point) {

            if ($this->y_axis_hints == 1) {
                imagedashedline($this->im, $point->x, $this->height, $point->x,
                    0, $this->ink['axis']);
            } else {

                //add axis line
                imageline($this->im, $point->x, $this->graph_height, $point->x,
                    $this->graph_height + 10, $this->ink['axis']);
            }

            //add axis label
            imagestring($this->im, 1, $point->x + 5, $this->graph_height + 10,
                $point->label, $this->ink['text']);

            //don't plot actual point if it is null
            if (is_null($point->value)) {
                continue;
            }

            //plot point
            imagefilledellipse($this->im, $point->x, $point->y, 7, 7,
                $this->ink['point']);

            //add point label
            if ($point->y <= 5) {
                $posy = $point->y + 5;
            } elseif ($point->y >= $this->graph_height - 5) {
                $posy = $point->y - 20;
            } else {
                $posy = $point->y - 15;
            }

            imagestring($this->im, 3, $point->x + 10, $posy, $point->value,
                $this->ink['point']);
        }
    }
public function draw ( ) { $ this -> drawYaxis ( ) ; if ( $ this -> connect_points == 1 ) { $ this -> connectPoints ( ) ; } foreach ( $ this -> points as $ point ) { if ( $ this -> y_axis_hints == 1 ) { imagedashedline ( $ this -> im , $ point -> x , $ this -> height , $ point -> x , 0 , $ this -> ink [ 'axis' ] ) ; } else { //add axis line imageline ( $ this -> im , $ point -> x , $ this -> graph_height , $ point -> x , $ this -> graph_height + 10 , $ this -> ink [ 'axis' ] ) ; } //add axis label imagestring ( $ this -> im , 1 , $ point -> x + 5 , $ this -> graph_height + 10 , $ point -> label , $ this -> ink [ 'text' ] ) ; //don't plot actual point if it is null if ( is_null ( $ point -> value ) ) { continue ; } //plot point imagefilledellipse ( $ this -> im , $ point -> x , $ point -> y , 7 , 7 , $ this -> ink [ 'point' ] ) ; //add point label if ( $ point -> y <= 5 ) { $ posy = $ point -> y + 5 ; } elseif ( $ point -> y >= $ this -> graph_height - 5 ) { $ posy = $ point -> y - 20 ; } else { $ posy = $ point -> y - 15 ; } imagestring ( $ this -> im , 3 , $ point -> x + 10 , $ posy , $ point -> value , $ this -> ink [ 'point' ] ) ; } }
Draw the basic graph and plot the points
Draw the basic graph and plot the points