src/sb/Graph/Point.php
private function setValues($values)
    {

        $numbers = Array();
        foreach ($values as $key => $val) {

            $value = new \stdClass();
            $value->label = trim($key);

            if (!is_numeric($val)) {
                $val = null;
            }

            $value->value = $val;
            $this->values[] = $value;
            $numbers[] = $val;
        }
        $min_max = Array();
        foreach ($numbers as $number) {
            if (!is_null($number)) {
                array_push($min_max, $number);
            }
        }
        $this->min = min($min_max);
        $this->max = max($min_max);

        $this->total_values = count($numbers);

        $separation_dist = (($this->graph_width - 40) / $this->total_values);
        $i = 0;

        $this->points = Array();

        foreach ($this->values as $value) {
            $point = new \stdClass();
            $point->x = ($i * $separation_dist) + $this->axis_offset + 40;
            $point->y = $this->plotValue($value->value);
            $point->label = $value->label;
            $point->value = $value->value;
            $this->points[] = $point;
            $i++;
        }

        return $this->points;
    }
private function setValues($values)
    {

        $numbers = Array();
        foreach ($values as $key => $val) {

            $value = new \stdClass();
            $value->label = trim($key);

            if (!is_numeric($val)) {
                $val = null;
            }

            $value->value = $val;
            $this->values[] = $value;
            $numbers[] = $val;
        }
        $min_max = Array();
        foreach ($numbers as $number) {
            if (!is_null($number)) {
                array_push($min_max, $number);
            }
        }
        $this->min = min($min_max);
        $this->max = max($min_max);

        $this->total_values = count($numbers);

        $separation_dist = (($this->graph_width - 40) / $this->total_values);
        $i = 0;

        $this->points = Array();

        foreach ($this->values as $value) {
            $point = new \stdClass();
            $point->x = ($i * $separation_dist) + $this->axis_offset + 40;
            $point->y = $this->plotValue($value->value);
            $point->label = $value->label;
            $point->value = $value->value;
            $this->points[] = $point;
            $i++;
        }

        return $this->points;
    }
private function setValues ( $ values ) { $ numbers = Array ( ) ; foreach ( $ values as $ key => $ val ) { $ value = new \ stdClass ( ) ; $ value -> label = trim ( $ key ) ; if ( ! is_numeric ( $ val ) ) { $ val = null ; } $ value -> value = $ val ; $ this -> values [ ] = $ value ; $ numbers [ ] = $ val ; } $ min_max = Array ( ) ; foreach ( $ numbers as $ number ) { if ( ! is_null ( $ number ) ) { array_push ( $ min_max , $ number ) ; } } $ this -> min = min ( $ min_max ) ; $ this -> max = max ( $ min_max ) ; $ this -> total_values = count ( $ numbers ) ; $ separation_dist = ( ( $ this -> graph_width - 40 ) / $ this -> total_values ) ; $ i = 0 ; $ this -> points = Array ( ) ; foreach ( $ this -> values as $ value ) { $ point = new \ stdClass ( ) ; $ point -> x = ( $ i * $ separation_dist ) + $ this -> axis_offset + 40 ; $ point -> y = $ this -> plotValue ( $ value -> value ) ; $ point -> label = $ value -> label ; $ point -> value = $ value -> value ; $ this -> points [ ] = $ point ; $ i ++ ; } return $ this -> points ; }
Converts the values into usable data for the drawing of the graph

@param array $values
Converts the values into usable data for the drawing of the graph