Class: Graph (0.1)

Class to create graphs. It should not be used. Instead, use extended classes like LineGraph or PieGraph.
Credits to: Jeph

Variables

array Graph::axis_bgcolor
array Graph::axis_bordercolor
int Graph::axis_deepness
boolean Graph::axis_frontgridlines
boolean Graph::axis_gridlines
int Graph::axis_maxX
int Graph::axis_maxY
int Graph::axis_minX
int Graph::axis_minY
int Graph::axis_modeX
int Graph::axis_modeY
array Graph::axis_positions
array Graph::axis_scalecolor
int Graph::axis_scalefont
int Graph::axis_stepSize
int Graph::axis_stepX
int Graph::axis_stepY
boolean Graph::axis_xscalevisible
boolean Graph::axis_yscalevisible
array Graph::data
int Graph::graph_areaheight
int Graph::graph_areawidth
array Graph::graph_bgcolor
boolean Graph::graph_bgtransparent
array Graph::graph_bordercolor
int Graph::graph_borderwidth
array Graph::graph_padding
string Graph::graph_title
array Graph::graph_titlecolor
int Graph::graph_titlefont
int Graph::graph_transparencylevel
array Graph::legend_bgcolor
array Graph::legend_bordercolor
int Graph::legend_borderwidth
array Graph::legend_color
array Graph::legend_data
boolean Graph::legend_floating
int Graph::legend_font
int Graph::legend_height
int Graph::legend_insidepadding
int Graph::legend_padding
int Graph::legend_position
boolean Graph::legend_visible
int Graph::legend_width
string Graph::scale_funX
string Graph::scale_funY
int Graph::scale_roundX
int Graph::scale_roundY

Methods

Graph::SetAxisBackgroundColor ( $red , $green , $blue )
Graph::SetAxisBorderColor ( $red , $green , $blue )
Graph::SetAxisDeepness ( $deepness )
Graph::SetAxisFrontGridlines ( $state )
Graph::SetAxisGridlines ( $state )
Graph::SetAxisModeX ( $mode )
Graph::SetAxisModeY ( $mode )
Graph::SetAxisPositions ( $positions )
Graph::SetAxisScaleColor ( $red , $green , $blue )
Graph::SetAxisScaleFont ( $font )
Graph::SetAxisScaleXVisibility ( $state )
Graph::SetAxisScaleYVisibility ( $state )
Graph::SetAxisStepSize ( $size )
Graph::SetAxisStepX ( $step )
Graph::SetAxisStepY ( $step )
Graph::SetGraphAreaHeight ( $height )
Graph::SetGraphAreaWidth ( $width )
Graph::SetGraphBackgroundColor ( $red , $green , $blue )
Graph::SetGraphBackgroundTransparent ( $addtransparency , $red , $green , $blue )
Graph::SetGraphBorderColor ( $red , $green , $blue )
Graph::SetGraphBorderWidth ( $width )
Graph::SetGraphPadding ( $left , $top , $right , $bottom )
Graph::SetGraphTitle ( $title )
Graph::SetGraphTitleColor ( $red , $green , $blue )
Graph::SetGraphTitleFont ( $font )
Graph::SetGraphTransparency ( $percent )
Graph::SetLegendBackgroundColor ( $red , $green , $blue )
Graph::SetLegendBorderColor ( $red , $green , $blue )
Graph::SetLegendBorderWidth ( $width )
Graph::SetLegendColors ( $colors )
Graph::SetLegendData ( $data )
Graph::SetLegendFloating ( $floating )
Graph::SetLegendInsidePadding ( $padding )
Graph::SetLegendPadding ( $padding )
Graph::SetLegendPosition ( $position )
Graph::SetLegendVisible ( $visible )
Graph::SetLegentFont ( $font )
Graph::SetScaleFunctionX ( $name )
Graph::SetScaleFunctionY ( $name )
Graph::SetScaleRoundX ( $number )
Graph::SetScaleRoundY ( $number )

Graph::axis_bgcolor ^ Top | ^ Variables | ^ Methods
Axis background color (not important when deepness = 0)

  Type:
        Array(int, int, int)

  Default:
        Array(152, 137, 124)


Graph::axis_bordercolor ^ Top | ^ Variables | ^ Methods
Axis border color (it's line color when deepness = 0)

  Type:
        Array(int, int, int)

  Default:
        Array(99, 88, 78)


Graph::axis_deepness ^ Top | ^ Variables | ^ Methods
Axis deepness (z-axis size)

  Type:
        int

  Default:
        0


Graph::axis_frontgridlines ^ Top | ^ Variables | ^ Methods
Front gridlines visibility (not importante when deepness = 0)

  Type:
        boolean

  Default:
        true


Graph::axis_gridlines ^ Top | ^ Variables | ^ Methods
Gridlines visibility

  Type:
        boolean

  Default:
        true


Graph::axis_maxX ^ Top | ^ Variables | ^ Methods
Axis maximum x (calculated when drawing)

  Type:
        int

  Default:
        0


Graph::axis_maxY ^ Top | ^ Variables | ^ Methods
Axis maximum y (calculated when drawing)

  Type:
        int

  Default:
        0


Graph::axis_minX ^ Top | ^ Variables | ^ Methods
Axis minimum x (calculated when drawing)

  Type:
        int

  Default:
        0


Graph::axis_minY ^ Top | ^ Variables | ^ Methods
Axis minimum x (calculated when drawing)

  Type:
        int

  Default:
        0


Graph::axis_modeX ^ Top | ^ Variables | ^ Methods
Axis x scale mode (0=normal, 1=dynamic, 2=pixel)

  Type:
        int

  Default:
        0


Graph::axis_modeY ^ Top | ^ Variables | ^ Methods
Axis y scale mode (0=normal, 1=dynamic, 2=pixel)

  Type:
        int

  Default:
        0


Graph::axis_positions ^ Top | ^ Variables | ^ Methods
Axis 4 positions visibility (left,top,right,bottom)

  Type:
        Array(boolean, boolean, boolean, boolean)

  Default:
        Array(true, false, false, true)


Graph::axis_scalecolor ^ Top | ^ Variables | ^ Methods
Axis scale color (RGB)

  Type:
        Array(int, int, int)

  Default:
        Array(0, 0, 255)


Graph::axis_scalefont ^ Top | ^ Variables | ^ Methods
Axis scale font

  Type:
        int

  Default:
        2


Graph::axis_stepSize ^ Top | ^ Variables | ^ Methods
Axis step size (how long is the line in each scale step)

  Type:
        int

  Default:
        3


Graph::axis_stepX ^ Top | ^ Variables | ^ Methods
Axis x step

  Type:
        int

  Default:
        1


Graph::axis_stepY ^ Top | ^ Variables | ^ Methods
Axis y step

  Type:
        int

  Default:
        1


Graph::axis_xscalevisible ^ Top | ^ Variables | ^ Methods
X scale visibility

  Type:
        boolean

  Default:
        true


Graph::axis_yscalevisible ^ Top | ^ Variables | ^ Methods
Y scale visibility

  Type:
        boolean

  Default:
        true


Graph::data ^ Top | ^ Variables | ^ Methods
Graph data

  Type:
        Array()


Graph::graph_areaheight ^ Top | ^ Variables | ^ Methods
Area height where graph is constructed

  Type:
        int

  Default:
        100


Graph::graph_areawidth ^ Top | ^ Variables | ^ Methods
Area height where graph is constructed

  Type:
        int

  Default:
        50


Graph::graph_bgcolor ^ Top | ^ Variables | ^ Methods
Graph background color (RGB)

  Type:
        Array(int, int, int)

  Default:
        Array(255, 255, 255)


Graph::graph_bgtransparent ^ Top | ^ Variables | ^ Methods
Graph background transparent

  Type:
        boolean

  Default:
        false


Graph::graph_bordercolor ^ Top | ^ Variables | ^ Methods
Graph border color (RGB)

  Type:
        Array(int, int, int)

  Default:
        Array(218, 218, 239)


Graph::graph_borderwidth ^ Top | ^ Variables | ^ Methods
Graph border size

  Type:
        int

  Default:
        1


Graph::graph_padding ^ Top | ^ Variables | ^ Methods
Padding of graph (distance between graph and the borders of the image graph

  Type:
        Array(string, string, string, string)

  Default:
        Array(50, 20, 20, 20)


Graph::graph_title ^ Top | ^ Variables | ^ Methods
Graph title

  Type:
        string

  Default:
       


Graph::graph_titlecolor ^ Top | ^ Variables | ^ Methods
Graph title color (RGB)

  Type:
        Array(int, int, int)

  Default:
        Array(99, 88, 78)


Graph::graph_titlefont ^ Top | ^ Variables | ^ Methods
Graph title font

  Type:
        int

  Default:
        3


Graph::graph_transparencylevel ^ Top | ^ Variables | ^ Methods
Graph transparency level [ 0 (opaque) to 127 (transparent) ]

  Type:
        int

  Default:
        0


Graph::legend_bgcolor ^ Top | ^ Variables | ^ Methods
Legend background color (RGB)

  Type:
        Array(int, int, int)

  Default:
        Array(255, 255, 255)


Graph::legend_bordercolor ^ Top | ^ Variables | ^ Methods
Legend border color (RGB)

  Type:
        Array(int, int, int)

  Default:
        Array(0, 0, 0)


Graph::legend_borderwidth ^ Top | ^ Variables | ^ Methods
Legend border size

  Type:
        int

  Default:
        1


Graph::legend_color ^ Top | ^ Variables | ^ Methods
Legend colors (1 for each item on legend data)

  Type:
        Array(Array(int, int, int))

  Default:
        Array(Array(0, 0, 255))


Graph::legend_data ^ Top | ^ Variables | ^ Methods
Legend data

  Type:
        Array(Item 1)


Graph::legend_floating ^ Top | ^ Variables | ^ Methods
Legend floating (if true, legend will be over graph)

  Type:
        boolean

  Default:
        false


Graph::legend_font ^ Top | ^ Variables | ^ Methods
Legend font

  Type:
        int

  Default:
        1


Graph::legend_height ^ Top | ^ Variables | ^ Methods
Legend height (calculated when drawing)

  Type:
        int

  Default:
        0


Graph::legend_insidepadding ^ Top | ^ Variables | ^ Methods
Legend inside padding (distance between elements inside the legend)

  Type:
        int

  Default:
        3


Graph::legend_padding ^ Top | ^ Variables | ^ Methods
Legend distance to image borders (if floating=true, it's distance to graph borders)

  Type:
        int

  Default:
        30


Graph::legend_position ^ Top | ^ Variables | ^ Methods
Legend position (1=bottom left, 2=top left, 3=top right, 4=bottom right)

  Type:
        int

  Default:
        3


Graph::legend_visible ^ Top | ^ Variables | ^ Methods
Legend visibility

  Type:
        boolean

  Default:
        false


Graph::legend_width ^ Top | ^ Variables | ^ Methods
Legend width (calculated when drawing)

  Type:
        int

  Default:
        0


Graph::scale_funX ^ Top | ^ Variables | ^ Methods
X scale function [ you can set this to int2month(%d) if you want to transform the scale into a month string ;) ]

  Type:
        string


Graph::scale_funY ^ Top | ^ Variables | ^ Methods
Y scale function (see scale_funX)

  Type:
        string


Graph::scale_roundX ^ Top | ^ Variables | ^ Methods
X scale decimal places

  Type:
        int

  Default:
        1


Graph::scale_roundY ^ Top | ^ Variables | ^ Methods
Y scale decimal places

  Type:
        int

  Default:
        1


Graph::SetAxisBackgroundColor() ^ Top | ^ Variables | ^ Methods
Set axis background color (RGB)

  Arguments:
        ( int ) $red
        ( int ) $green
        ( int ) $blue


Graph::SetAxisBorderColor() ^ Top | ^ Variables | ^ Methods
Set axis border color (RGB)

  Arguments:
        ( int ) $red
        ( int ) $green
        ( int ) $blue


Graph::SetAxisDeepness() ^ Top | ^ Variables | ^ Methods
Set axis deepness (z axis size)

  Arguments:
        ( int ) $deepness


Graph::SetAxisFrontGridlines() ^ Top | ^ Variables | ^ Methods
Set axis front gridlines visibility (not important when deepness = 0)

  Arguments:
        ( boolean ) $state


Graph::SetAxisGridlines() ^ Top | ^ Variables | ^ Methods
Set axis gridlines visibility

  Arguments:
        ( boolean ) $state


Graph::SetAxisModeX() ^ Top | ^ Variables | ^ Methods
Set x step mode

  Arguments:
        ( int ) $mode


Graph::SetAxisModeY() ^ Top | ^ Variables | ^ Methods
Set y step mode

  Arguments:
        ( int ) $mode


Graph::SetAxisPositions() ^ Top | ^ Variables | ^ Methods
Set axis positions visibility (4 directions)

  Arguments:
        ( array ) $positions


Graph::SetAxisScaleColor() ^ Top | ^ Variables | ^ Methods
Set axis scale color (RGB)

  Arguments:
        ( int ) $red
        ( int ) $green
        ( int ) $blue


Graph::SetAxisScaleFont() ^ Top | ^ Variables | ^ Methods
Set axis scale font
You can use these strings instead of int:
  1=x-small
  2=small
  3=normal
  4=large
  5=x-large

  Arguments:
        ( string | int ) $font


Graph::SetAxisScaleXVisibility() ^ Top | ^ Variables | ^ Methods
Set axis x scale visibility

  Arguments:
        ( boolean ) $state


Graph::SetAxisScaleYVisibility() ^ Top | ^ Variables | ^ Methods
Set axis y scale visibility

  Arguments:
        ( boolean ) $state


Graph::SetAxisStepSize() ^ Top | ^ Variables | ^ Methods
Set axis step size

  Arguments:
        ( int ) $size


Graph::SetAxisStepX() ^ Top | ^ Variables | ^ Methods
Set x scale step

  Arguments:
        ( int ) $step


Graph::SetAxisStepY() ^ Top | ^ Variables | ^ Methods
Set y scale step

  Arguments:
        ( int ) $step


Graph::SetGraphAreaHeight() ^ Top | ^ Variables | ^ Methods
Set graph area height

  Arguments:
        ( int ) $height


Graph::SetGraphAreaWidth() ^ Top | ^ Variables | ^ Methods
Set graph area width

  Arguments:
        ( int ) $width


Graph::SetGraphBackgroundColor() ^ Top | ^ Variables | ^ Methods
Set graph background color

  Arguments:
        ( int ) $red
        ( int ) $green
        ( int ) $blue


Graph::SetGraphBackgroundTransparent() ^ Top | ^ Variables | ^ Methods
Set graph background transparent (default is RGB(255,0,255) but you can change it to a color you won' use in graph)

  Arguments:
        ( boolean ) $addtransparency
        ( int ) $red
        ( int ) $green
        ( int ) $blue

  Default:
       $addtransparency = true
       $red = 255
       $green = 0
       $blue = 255


Graph::SetGraphBorderColor() ^ Top | ^ Variables | ^ Methods
Set graph border color (RGB)

  Arguments:
        ( int ) $red
        ( int ) $green
        ( int ) $blue


Graph::SetGraphBorderWidth() ^ Top | ^ Variables | ^ Methods
Set graph border size

  Arguments:
        ( int ) $width

  Default:
       $width = 0


Graph::SetGraphPadding() ^ Top | ^ Variables | ^ Methods
Set graph paddings

  Arguments:
        ( int ) $left
        ( int ) $top
        ( int ) $right
        ( int ) $bottom


Graph::SetGraphTitle() ^ Top | ^ Variables | ^ Methods
Set graph title text

  Arguments:
        ( int ) $title


Graph::SetGraphTitleColor() ^ Top | ^ Variables | ^ Methods
Set graph title color (RGB)

  Arguments:
        ( int ) $red
        ( int ) $green
        ( int ) $blue


Graph::SetGraphTitleFont() ^ Top | ^ Variables | ^ Methods
Set graph title font (1 to 5 are loaded by default on GD2, if you want others, you have to load them)
You can use these strings instead of int:
  1=x-small
  2=small
  3=normal
  4=large
  5=x-large

  Arguments:
        ( string | int ) $font


Graph::SetGraphTransparency() ^ Top | ^ Variables | ^ Methods
Set graph transparency level [ 0 (opaque) to 100 (transparent) ]

  Arguments:
        ( int ) $percent


Graph::SetLegendBackgroundColor() ^ Top | ^ Variables | ^ Methods
Set legend background color (RGB)

  Arguments:
        ( int ) $red
        ( int ) $green
        ( int ) $blue


Graph::SetLegendBorderColor() ^ Top | ^ Variables | ^ Methods
Set legend border color (RGB)

  Arguments:
        ( int ) $red
        ( int ) $green
        ( int ) $blue


Graph::SetLegendBorderWidth() ^ Top | ^ Variables | ^ Methods
Set legend border size

  Arguments:
        ( int ) $width

  Default:
       $width = 0


Graph::SetLegendColors() ^ Top | ^ Variables | ^ Methods
Set colors to the diferent items of legend data (this argument should be an array where each item is another array of 3 items corresponding to Red, Green and Blue of each color)

  Arguments:
        ( array ) $colors


Graph::SetLegendData() ^ Top | ^ Variables | ^ Methods
Legend data (array containing the names or any other string you want to name each element)

  Arguments:
        ( array ) $data


Graph::SetLegendFloating() ^ Top | ^ Variables | ^ Methods
Set legend floating (designed over graph)

  Arguments:
        ( boolean ) $floating


Graph::SetLegendInsidePadding() ^ Top | ^ Variables | ^ Methods
Legend inside padding (distance between elements inside the legend)

  Arguments:
        ( int ) $padding

  Default:
       $padding = 0


Graph::SetLegendPadding() ^ Top | ^ Variables | ^ Methods
Set legend distance to image borders (if floating=true, it's distance to graph borders)

  Arguments:
        ( int ) $padding

  Default:
       $padding = 0


Graph::SetLegendPosition() ^ Top | ^ Variables | ^ Methods
Legend position (1=bottom left, 2=top left, 3=top right, 4=bottom right)

  Arguments:
        ( string | int ) $position


Graph::SetLegendVisible() ^ Top | ^ Variables | ^ Methods
Set legend visibility

  Arguments:
        ( boolean ) $visible


Graph::SetLegentFont() ^ Top | ^ Variables | ^ Methods
Set legend font
You can use these strings instead of int:
  1=x-small
  2=small
  3=normal
  4=large
  5=x-large

  Arguments:
        ( string | int ) $font


Graph::SetScaleFunctionX() ^ Top | ^ Variables | ^ Methods
Set x scale function (usefull to change x scale for example: int2date(%d) where int2date() changes an int to the apropriate string)

  Arguments:
        ( string ) $name


Graph::SetScaleFunctionY() ^ Top | ^ Variables | ^ Methods
Set y scale function (see SetScaleFunctionX)

  Arguments:
        ( string ) $name


Graph::SetScaleRoundX() ^ Top | ^ Variables | ^ Methods
Set x scale decimal places

  Arguments:
        ( int ) $number


Graph::SetScaleRoundY() ^ Top | ^ Variables | ^ Methods
Set y scale decimal places

  Arguments:
        ( int ) $number