Zeile 69 | Zeile 69 |
---|
/** * The corresponding x labels for the graph *
|
/** * The corresponding x labels for the graph *
|
* @var integer
| * @var array
|
*/ public $x_labels = array();
| */ public $x_labels = array();
|
Zeile 82 | Zeile 82 |
---|
/** * Constructor of class. Initializes the barebore graph.
|
/** * Constructor of class. Initializes the barebore graph.
|
* * @return Graph
| |
*/ public function __construct() { // Setup initial graph layout
// Check for GD >= 2, create base image
|
*/ public function __construct() { // Setup initial graph layout
// Check for GD >= 2, create base image
|
if(gd_version() >= 2)
| $gd_version = gd_version(); if($gd_version >= 2)
|
{ $this->im = imagecreatetruecolor($this->img_width, $this->img_height);
|
{ $this->im = imagecreatetruecolor($this->img_width, $this->img_height);
|
} else
| } elseif (!empty($gd_version))
|
{ $this->im = imagecreate($this->img_width, $this->img_height); }
// No GD support, die. if(!$this->im)
|
{ $this->im = imagecreate($this->img_width, $this->img_height); }
// No GD support, die. if(!$this->im)
|
{ return false; }
| { throw new Exception('No GD support'); }
|
if(function_exists("imageantialias")) { imageantialias($this->im, true);
|
if(function_exists("imageantialias")) { imageantialias($this->im, true);
|
}
| }
|
// Fill the background imagefill($this->im, 0, 0, $this->color(239, 239, 239));
| // Fill the background imagefill($this->im, 0, 0, $this->color(239, 239, 239));
|
Zeile 124 | Zeile 123 |
---|
$y_value = $this->inside_y+(($this->inside_height/4)*$i); imageline($this->im, $this->inside_x, $y_value, $inside_end_x, $y_value, $this->color(185, 185, 185)); }
|
$y_value = $this->inside_y+(($this->inside_height/4)*$i); imageline($this->im, $this->inside_x, $y_value, $inside_end_x, $y_value, $this->color(185, 185, 185)); }
|
| }
/** * Check if GD support is enabled and this class can be used. * * @return bool True if the class can be used. */ public static function can_use() { $gd_version = gd_version();
return !empty($gd_version);
|
}
/** * Select and allocate a color to the internal image resource *
|
}
/** * Select and allocate a color to the internal image resource *
|
* @param integer The red value * @param integer The green value * @param integer The blue value
| * @param integer $red The red value * @param integer $green The green value * @param integer $blue The blue value
|
* @return integer A color identifier */ private function color($red, $green, $blue)
| * @return integer A color identifier */ private function color($red, $green, $blue)
|
Zeile 142 | Zeile 153 |
---|
/** * Creates a filled rectangle with optional rounded corners *
|
/** * Creates a filled rectangle with optional rounded corners *
|
* @param integer The initial x value * @param integer The initial y value * @param integer The ending x value * @param integer The ending y value * @param integer The optional radius * @param integer The optional rectangle color (defaults to black)
| * @param integer $x1 The initial x value * @param integer $y1 The initial y value * @param integer $x2 The ending x value * @param integer $y2 The ending y value * @param integer $radius The optional radius * @param integer $color The optional rectangle color (defaults to black)
|
*/ private function image_create_rectangle($x1, $y1, $x2, $y2, $radius=1, $color=null) {
| */ private function image_create_rectangle($x1, $y1, $x2, $y2, $radius=1, $color=null) {
|
Zeile 175 | Zeile 186 |
---|
/** * Creates a nicer thick line for angled lines *
|
/** * Creates a nicer thick line for angled lines *
|
* @param integer The initial x value * @param integer The initial y value * @param integer The ending x value * @param integer The ending y value * @param integer The optional rectangle color (defaults to black) * @param integer The optional thickness (defaults to 1)
| * @param integer $x1 The initial x value * @param integer $y1 The initial y value * @param integer $x2 The ending x value * @param integer $y2 The ending y value * @param integer $color The optional rectangle color (defaults to black) * @param integer $thick The optional thickness (defaults to 1) * @return int
|
*/ private function imagelinethick($x1, $y1, $x2, $y2, $color, $thick = 1) {
| */ private function imagelinethick($x1, $y1, $x2, $y2, $color, $thick = 1) {
|
Zeile 211 | Zeile 223 |
---|
/** * Adds an array of x, y points to the internal points array *
|
/** * Adds an array of x, y points to the internal points array *
|
* @param array The array of x, y points to add
| * @param array $points The array of x, y points to add
|
*/ public function add_points($points) {
| */ public function add_points($points) {
|
Zeile 221 | Zeile 233 |
---|
/** * Adds an array of x labels to the internal labels array *
|
/** * Adds an array of x labels to the internal labels array *
|
* @param array The array of x labels to add
| * @param array $labels The array of x labels to add
|
*/ public function add_x_labels($labels) {
| */ public function add_x_labels($labels) {
|
Zeile 231 | Zeile 243 |
---|
/** * Sets a bottom label *
|
/** * Sets a bottom label *
|
* @param string The bottom label to set
| * @param string $label The bottom label to set
|
*/ public function set_bottom_label($label) {
| */ public function set_bottom_label($label) {
|
Zeile 262 | Zeile 274 |
---|
// Get our scale for finding our points of reference to place our x axis labels $x_label_scale = ceil(count($this->points)/20); $x_label_points = array();
|
// Get our scale for finding our points of reference to place our x axis labels $x_label_scale = ceil(count($this->points)/20); $x_label_points = array();
|
| $next_y_scaled = 0;
|
foreach($this->points as $x => $y) {
| foreach($this->points as $x => $y) {
|