Class PolarGraph

Description

Root class to generate graphs (GD based)

Do not use directly, use its parent classes instead.

Located in /class/PolarGraph.class.php (line 35)


	
			
Direct descendents
Class Description
PolarThumbGraph Class to generate small graphs (HR, speed, cadence distribution, laps)
PolarExeGraph Class to generate exercise graphs (HR, speed, cadence, altitude, ...)
Variable Summary
integer $black
integer $bottom_margin
array $geometry
integer $height
integer $left_margin
integer $right_margin
integer $top_margin
integer $width
Method Summary
void PolarGraph ()
string _close (resource $img, string $prefix, string $format, [integer $quality = 75])
void _draw_altitude_lines (resource $img, integer $min, integer $max, integer $color, integer $font_num, integer $str_x_pos, [float $ratio = 1], [float $pos = 0])
void _draw_axis (resource $img, integer $color, string $title, integer $font_num, integer $x_color, string $x_title, integer $x_font_num)
void _draw_cadence_lines (resource $img, integer $min, integer $max, integer $exe_min, integer $exe_max, integer $color, integer $font_num, integer $str_x_pos, [float $ratio = 1], [float $pos = 0])
void _draw_distance_labels (resource $img, integer $distance, integer $color, [integer $line_height = 7], [integer $font_num = 1], [boolean $draw_verticals = false], [boolean $draw_submarks = false])
void _draw_hr_lines (resource $img, integer $min, integer $max, integer $exe_min, integer $exe_max, string $unit, integer $rest_hr, integer $max_hr, integer $color, integer $font_num, integer $str_x_pos, [float $ratio = 1], [float $pos = 0])
void _draw_speed_lines (resource $img, integer $min, integer $max, integer $exe_min, integer $exe_max, integer $color, integer $font_num, integer $str_x_pos, [float $ratio = 1], [float $pos = 0])
void _draw_time_labels (resource $img, integer $elapsed, integer $color, [integer $line_height = 7], [integer $font_num = 1], [boolean $draw_verticals = false], [boolean $draw_submarks = false])
void _draw_x_axis (resource $img, integer $y, integer $color, [string $title = null], [integer $color_title = null], [integer $y_title = 0], [integer $font_num = 1])
resource _open ([ $params = null])
Variables
integer $black (line 76)

GD Black color as returned by imagecolorallocate()

integer $bottom_margin (line 71)

Graph bottom margin in pixels

array $geometry (line 41)

Default geometry for graphs (width, height, margins)

integer $height (line 51)

Graph height in pixels

integer $left_margin (line 56)

Graph left margin in pixels

integer $right_margin (line 61)

Graph right margin in pixels

integer $top_margin (line 66)

Graph top margin in pixels

integer $width (line 46)

Graph width in pixels

Methods
Constructor PolarGraph (line 83)

Class constructor

void PolarGraph ()
_close (line 120)

Close a graph and create file on file system

  • return: File name of temporary image file (to use in SRC HTML attribute)
string _close (resource $img, string $prefix, string $format, [integer $quality = 75])
  • resource $img: GD image resource, as returned by _open()
  • string $prefix: Prefix of temporary file name to create
  • string $format: Format of file to create ('jpg', 'gif')
  • integer $quality: Quality if JPEG format
_draw_altitude_lines (line 569)

Draw altitude horizontals and labels

void _draw_altitude_lines (resource $img, integer $min, integer $max, integer $color, integer $font_num, integer $str_x_pos, [float $ratio = 1], [float $pos = 0])
  • resource $img: GD image resource, as returned by _open()
  • integer $min: Minimum displayable altitude value in meters
  • integer $max: Maximum displayable altitude value in meters
  • integer $color: GD color for labels and vertical lines, as returned by imagecolorallocate()
  • integer $font_num: GD build-in font number for labels
  • integer $str_x_pos: X position of labels in pixels
  • float $ratio: Ratio of graph height size in ]0, 1]
  • float $pos: Relative position in graph from bottom in [0, 1[
_draw_axis (line 153)

Draw graph title and X axis

void _draw_axis (resource $img, integer $color, string $title, integer $font_num, integer $x_color, string $x_title, integer $x_font_num)
  • resource $img: GD image resource, as returned by _open()
  • integer $color: GD color for title and Y axis, as returned by imagecolorallocate()
  • string $title: Graph title
  • integer $font_num: GD build-in font number for graph title
  • integer $x_color: GD color for X axis label, as returned by imagecolorallocate()
  • string $x_title: Label for X axis
  • integer $x_font_num: GD build-in font number for X axis label

Redefined in descendants as:
_draw_cadence_lines (line 617)

Draw cadence horizontals and labels

void _draw_cadence_lines (resource $img, integer $min, integer $max, integer $exe_min, integer $exe_max, integer $color, integer $font_num, integer $str_x_pos, [float $ratio = 1], [float $pos = 0])
  • resource $img: GD image resource, as returned by _open()
  • integer $min: Minimum displayable cadence value in cycles / min
  • integer $max: Maximum displayable cadence value in cycles / min
  • integer $exe_min: Minimum exercise cadence value in cycles / min
  • integer $exe_max: Maximum exercise cadence value in cycles / min
  • integer $color: GD color for labels and vertical lines, as returned by imagecolorallocate()
  • integer $font_num: GD build-in font number for labels
  • integer $str_x_pos: X position of labels in pixels
  • float $ratio: Ratio of graph height size in ]0, 1]
  • float $pos: Relative position in graph from bottom in [0, 1[
_draw_distance_labels (line 308)

Draw distance labels and associated vertical lines on X axis

Distance unit and step of labels are computed using exercise duration only.

void _draw_distance_labels (resource $img, integer $distance, integer $color, [integer $line_height = 7], [integer $font_num = 1], [boolean $draw_verticals = false], [boolean $draw_submarks = false])
  • resource $img: GD image resource, as returned by _open()
  • integer $distance: Distance of exercise in meters
  • integer $color: GD color for labels and vertical lines, as returned by imagecolorallocate()
  • integer $line_height: Height of mark in pixels (if no vertical)
  • integer $font_num: GD build-in font number for labels
  • boolean $draw_verticals: true to draw main distance verticals, else false
  • boolean $draw_submarks: true to draw secondary distance marks, else false
_draw_hr_lines (line 403)

Draw heart rate horizontals and labels

void _draw_hr_lines (resource $img, integer $min, integer $max, integer $exe_min, integer $exe_max, string $unit, integer $rest_hr, integer $max_hr, integer $color, integer $font_num, integer $str_x_pos, [float $ratio = 1], [float $pos = 0])
  • resource $img: GD image resource, as returned by _open()
  • integer $min: Minimum displayable HR value in BPM
  • integer $max: Maximum displayable HR value in BPM
  • integer $exe_min: Minimum exercise HR value in BPM
  • integer $exe_max: Maximum exercise HR value in BPM
  • string $unit: HR unit, one of :
    • 'bpm' : Absolute value in BPM
    • 'pct_max' : Percent of user maximum HR
    • 'pct_res' : Percent of user reserve HR
  • integer $rest_hr: User rest HR in BPM
  • integer $max_hr: User maximum HR in BPM
  • integer $color: GD color for labels and vertical lines, as returned by imagecolorallocate()
  • integer $font_num: GD build-in font number for labels
  • integer $str_x_pos: X position of labels in pixels
  • float $ratio: Ratio of graph height size in ]0, 1]
  • float $pos: Relative position in graph from bottom in [0, 1[
_draw_speed_lines (line 501)

Draw speed horizontals and labels

void _draw_speed_lines (resource $img, integer $min, integer $max, integer $exe_min, integer $exe_max, integer $color, integer $font_num, integer $str_x_pos, [float $ratio = 1], [float $pos = 0])
  • resource $img: GD image resource, as returned by _open()
  • integer $min: Minimum displayable speed value in km/h * 10
  • integer $max: Maximum displayable speed value in km/h * 10
  • integer $exe_min: Minimum exercise speed value in km/h * 10
  • integer $exe_max: Maximum exercise speed value in km/h * 10
  • integer $color: GD color for labels and vertical lines, as returned by imagecolorallocate()
  • integer $font_num: GD build-in font number for labels
  • integer $str_x_pos: X position of labels in pixels
  • float $ratio: Ratio of graph height size in ]0, 1]
  • float $pos: Relative position in graph from bottom in [0, 1[
_draw_time_labels (line 211)

Draw time labels and associated vertical lines on X axis

Time unit and step of labels are computed using exercise duration only.

void _draw_time_labels (resource $img, integer $elapsed, integer $color, [integer $line_height = 7], [integer $font_num = 1], [boolean $draw_verticals = false], [boolean $draw_submarks = false])
  • resource $img: GD image resource, as returned by _open()
  • integer $elapsed: Duration of exercise in seconds
  • integer $color: GD color for labels and vertical lines, as returned by imagecolorallocate()
  • integer $line_height: Height of mark in pixels (if no vertical)
  • integer $font_num: GD build-in font number for labels
  • boolean $draw_verticals: true to draw main time verticals, else false
  • boolean $draw_submarks: true to draw secondary time marks, else false
_draw_x_axis (line 180)

Draw X axis

void _draw_x_axis (resource $img, integer $y, integer $color, [string $title = null], [integer $color_title = null], [integer $y_title = 0], [integer $font_num = 1])
  • resource $img: GD image resource, as returned by _open()
  • integer $y: Y position of X axis in pixels
  • integer $color: GD color for X axis, as returned by imagecolorallocate()
  • string $title: Title to display on X axis, null if no title
  • integer $color_title: GD color for title, as returned by imagecolorallocate()
  • integer $y_title: Y position of title in pixels
  • integer $font_num: GD build-in font number for title
_open (line 92)

Open a new graph (GD image)

  • return: GD image resource
resource _open ([ $params = null])
  • $params

Documentation generated on Sat, 28 Mar 2009 23:16:35 +0000 by phpDocumentor 1.4.1