PHP Class GridGraph, GotCms

Inheritance: extends Graph
Mostrar archivo Open project: gotcms/gotcms Class Usage Examples

Protected Properties

Property Type Description
$axes_calc_done
$bar_unit_width
$flip_axes Set to true for horizontal graphs
$g_height
$g_width
$guidelines
$label_adjust_done
$label_centre Set to true for block-based labelling
$max_guide
$min_guide
$sub_x
$sub_y
$uneven_x
$uneven_y
$x0
$x_points
$y0
$y_points

Protected Methods

Method Description
Axes ( ) Draws bar or line graph axes
BuildGuideline ( &$line, &$lines, &$text, &$path, &$d ) Adds a single guideline and its title to content
CalcAxes ( ) Calculates the effect of axes, applying to padding
CalcGrid ( ) Calculates the position of grid lines
CalcGuidelines ( $g = null ) Converts guideline options to more useful member variables
ClampHorizontal ( $val )
ClampVertical ( $val ) clamps a value to the grid boundaries
ClipGrid ( &$attr ) Returns a clipping path for the grid
DOverlap ( $style, $size ) Calculates the overlap of a division or subdivision
DivisionOverlap ( ) Returns the amount of overlap the divisions and subdivisions use
DivisionsPositions ( $style, $style_default, $size, $size_default, $fullsize, $start, $axis_offset ) Returns the position and size of divisions
FindLongestAxisLabel ( $length_x, $length_y ) Determines the longest axis labels for the given axis lengths
FindSubdiv ( $grid_div, $u, $min, $min_unit, $fixed ) Find the subdivision size
GetAxes ( $ends, &$x_len, &$y_len ) Returns the X and Y axis class instances as a list
GetAxisEnds ( ) Returns an array containing the value and key axis min and max
GetGridPoints ( $length, $spacing, $start, $direction, $zero, $unit_size, $uneven ) Returns the grid points as an associative array: array($value => $position)
GetGridSubdivisions ( &$points, $spacing, $direction ) Returns the grid subdivision points as an array
GetHorizontalCount ( ) Subclasses can override this for non-linear graphs
GetLongestKey ( ) Returns the key that takes up the most space
Grid ( ) Draws the grid behind the bar / line graph
GridLines ( $path, $colour, $dash, $fill = null ) Returns a set of gridlines
GridPosition ( $key, $ikey ) Returns the grid position for a bar or point, or NULL if not on grid $key = actual value array index $ikey = integer position in array
GuidelinePath ( $axis, $value, $depth, &$x, &$y, &$w, &$h ) Creates the path data for a guideline and sets the dimensions
Guidelines ( $depth ) Returns the elements to draw the guidelines
HLabel ( &$attribs ) Returns the horizontal axis label
LabelAdjustment ( $longest_v = 1000, $longest_h = 100 ) Modifies the graph padding to allow room for labels
Labels ( $axis_text = '' ) Returns the labels grouped with the provided axis division labels
NumString ( $n ) Converts number to string
SetGridDimensions ( ) Sets up grid width and height to fill padded area
UpdateAndUnset ( &$var, &$array, $key ) Updates $var with $array[$key] and removes it from array
VLabel ( &$attribs ) Returns the vertical axis label
XAxis ( $yoff ) Returns the X axis SVG fragment
XAxisDivisions ( &$points, $style, $style_default, $size, $size_default, $yoff ) Returns X-axis divisions as a path
XAxisText ( &$points, $xoff, $yoff, $angle ) Returns the X-axis text fragment
YAxis ( $xoff ) Returns the Y axis SVG fragment
YAxisDivisions ( &$points, $style, $style_default, $size, $size_default, $xoff ) Returns Y-axis divisions as a path
YAxisText ( &$points, $xoff, $yoff, $angle ) Returns the Y-axis text fragment

Method Details

Axes() protected method

Draws bar or line graph axes
protected Axes ( )

BuildGuideline() protected method

Adds a single guideline and its title to content
protected BuildGuideline ( &$line, &$lines, &$text, &$path, &$d )

CalcAxes() protected method

Calculates the effect of axes, applying to padding
protected CalcAxes ( )

CalcGrid() protected method

Calculates the position of grid lines
protected CalcGrid ( )

CalcGuidelines() protected method

Converts guideline options to more useful member variables
protected CalcGuidelines ( $g = null )

ClampHorizontal() protected method

protected ClampHorizontal ( $val )

ClampVertical() protected method

clamps a value to the grid boundaries
protected ClampVertical ( $val )

ClipGrid() protected method

Returns a clipping path for the grid
protected ClipGrid ( &$attr )

DOverlap() protected method

Calculates the overlap of a division or subdivision
protected DOverlap ( $style, $size )

DivisionOverlap() protected method

Returns the amount of overlap the divisions and subdivisions use
protected DivisionOverlap ( )

DivisionsPositions() protected method

Returns the position and size of divisions
protected DivisionsPositions ( $style, $style_default, $size, $size_default, $fullsize, $start, $axis_offset )

FindLongestAxisLabel() protected method

Determines the longest axis labels for the given axis lengths
protected FindLongestAxisLabel ( $length_x, $length_y )

FindSubdiv() protected method

Find the subdivision size
protected FindSubdiv ( $grid_div, $u, $min, $min_unit, $fixed )

GetAxes() protected method

Returns the X and Y axis class instances as a list
protected GetAxes ( $ends, &$x_len, &$y_len )

GetAxisEnds() protected method

Returns an array containing the value and key axis min and max
protected GetAxisEnds ( )

GetGridPoints() protected method

Returns the grid points as an associative array: array($value => $position)
protected GetGridPoints ( $length, $spacing, $start, $direction, $zero, $unit_size, $uneven )

GetGridSubdivisions() protected method

Returns the grid subdivision points as an array
protected GetGridSubdivisions ( &$points, $spacing, $direction )

GetHorizontalCount() protected method

Subclasses can override this for non-linear graphs
protected GetHorizontalCount ( )

GetLongestKey() protected method

Returns the key that takes up the most space
protected GetLongestKey ( )

Grid() protected method

Draws the grid behind the bar / line graph
protected Grid ( )

GridLines() protected method

Returns a set of gridlines
protected GridLines ( $path, $colour, $dash, $fill = null )

GridPosition() protected method

Returns the grid position for a bar or point, or NULL if not on grid $key = actual value array index $ikey = integer position in array
protected GridPosition ( $key, $ikey )

GuidelinePath() protected method

Creates the path data for a guideline and sets the dimensions
protected GuidelinePath ( $axis, $value, $depth, &$x, &$y, &$w, &$h )

Guidelines() protected method

Returns the elements to draw the guidelines
protected Guidelines ( $depth )

HLabel() protected method

Returns the horizontal axis label
protected HLabel ( &$attribs )

LabelAdjustment() protected method

Modifies the graph padding to allow room for labels
protected LabelAdjustment ( $longest_v = 1000, $longest_h = 100 )

Labels() protected method

Returns the labels grouped with the provided axis division labels
protected Labels ( $axis_text = '' )

NumString() protected method

Converts number to string
protected NumString ( $n )

SetGridDimensions() protected method

Sets up grid width and height to fill padded area
protected SetGridDimensions ( )

UpdateAndUnset() protected method

Updates $var with $array[$key] and removes it from array
protected UpdateAndUnset ( &$var, &$array, $key )

VLabel() protected method

Returns the vertical axis label
protected VLabel ( &$attribs )

XAxis() protected method

Returns the X axis SVG fragment
protected XAxis ( $yoff )

XAxisDivisions() protected method

Returns X-axis divisions as a path
protected XAxisDivisions ( &$points, $style, $style_default, $size, $size_default, $yoff )

XAxisText() protected method

Returns the X-axis text fragment
protected XAxisText ( &$points, $xoff, $yoff, $angle )

YAxis() protected method

Returns the Y axis SVG fragment
protected YAxis ( $xoff )

YAxisDivisions() protected method

Returns Y-axis divisions as a path
protected YAxisDivisions ( &$points, $style, $style_default, $size, $size_default, $xoff )

YAxisText() protected method

Returns the Y-axis text fragment
protected YAxisText ( &$points, $xoff, $yoff, $angle )

Property Details

$axes_calc_done protected_oe property

protected $axes_calc_done

$bar_unit_width protected_oe property

protected $bar_unit_width

$flip_axes protected_oe property

Set to true for horizontal graphs
protected $flip_axes

$g_height protected_oe property

protected $g_height

$g_width protected_oe property

protected $g_width

$guidelines protected_oe property

protected $guidelines

$label_adjust_done protected_oe property

protected $label_adjust_done

$label_centre protected_oe property

Set to true for block-based labelling
protected $label_centre

$max_guide protected_oe property

protected $max_guide

$min_guide protected_oe property

protected $min_guide

$sub_x protected_oe property

protected $sub_x

$sub_y protected_oe property

protected $sub_y

$uneven_x protected_oe property

protected $uneven_x

$uneven_y protected_oe property

protected $uneven_y

$x0 protected_oe property

protected $x0

$x_points protected_oe property

protected $x_points

$y0 protected_oe property

protected $y0

$y_points protected_oe property

protected $y_points