PHP Class piechart, ganglia-misc

* * The data is an array of arrays that consist the following data: *o numeric value *o value legend *o red \ *o green > the RGB values for the color of the slice/legend *o blue / *
Mostrar archivo Open project: vvuksan/ganglia-misc Class Usage Examples

Public Properties

Property Type Description
$PI * {{{ constants
$angles
$bottom
$center_x
$center_y
$colors
$data
$diameter
$fx * font sizes
$fy * font sizes
$head_space
$head_top
$height
$im * {{{ attributes
$left
$legend_left
$legend_num
$right
$sum * sum of values
$top
$width

Public Methods

Method Description
deg2rad ( $degrees ) * * The built-in trig functions use radians and there's no * function in PHP to convert between degrees and radians
display ( ) * * Make sure the legends are drawn, then output the image to the * client
draw_heading ( $head_data ) * * This function accepts an array of arrays containing (in order): * o The text of the heading as a string * o The fontsize as an integer * o The justification ("c"=center) *
draw_legends ( $fontsize ) * * Draw legends at the right side of the pie chart. This function * accepts a fontsize and gathers all the other information from * the multilevel data array
draw_margins ( ) * * Also a debugging function to show where the margins are at
draw_point ( $x, $y ) * * This function is just here for debugging purposes. It is * sometimes very useful to be able to draw an X to check * coordinates.
draw_slices ( $x, $y, $angles, $colors ) * * This function draws pieces of pie centered at x,y starting at * "from" degrees and ending at "to" degrees using the specified color.
get_xy_factors ( $degrees ) * * Calculate the directional vector for the sides of the * piece of pie.
hex2rgb ( $hex ) its decimal red, green, blue components.
init ( $w, $h, $d ) * * Initialize the object and draw the pie. This would be the * constructor in an ordinary OO scenario -- just that we haven't * got constructors in PHP, now do we? ;-) * * RB 09.03.2006: * - rearranged: please use indentation to seperate if/for blocks/statements! * - modified to use draw_slices in stead of draw_slice
roundoff ( $v ) * * PHP has no function for rounding off doubles to the nearest * integer so we have to roll our own.
set_legend_percent ( ) * utility function to set an attribute so we display percentages
set_legend_value ( ) * utility function to set an attribute so we display values

Method Details

deg2rad() public method

* * The built-in trig functions use radians and there's no * function in PHP to convert between degrees and radians
public deg2rad ( $degrees )

display() public method

* * Make sure the legends are drawn, then output the image to the * client
public display ( )

draw_heading() public method

* * This function accepts an array of arrays containing (in order): * o The text of the heading as a string * o The fontsize as an integer * o The justification ("c"=center) *
public draw_heading ( $head_data )

draw_legends() public method

* * Draw legends at the right side of the pie chart. This function * accepts a fontsize and gathers all the other information from * the multilevel data array
public draw_legends ( $fontsize )

draw_margins() public method

* * Also a debugging function to show where the margins are at
public draw_margins ( )

draw_point() public method

* * This function is just here for debugging purposes. It is * sometimes very useful to be able to draw an X to check * coordinates.
public draw_point ( $x, $y )

draw_slices() public method

* * RB 09.03.2006: * - fixed: ImageFill for pie slices broke when a very small pie was drawn, * and filled entire image with color (orange background color). * - modified draw_slice to be draw_slices and added 3D effect ;)
public draw_slices ( $x, $y, $angles, $colors )

get_xy_factors() public method

* * Calculate the directional vector for the sides of the * piece of pie.
public get_xy_factors ( $degrees )

hex2rgb() public method

its decimal red, green, blue components.
public hex2rgb ( $hex )

init() public method

* * Initialize the object and draw the pie. This would be the * constructor in an ordinary OO scenario -- just that we haven't * got constructors in PHP, now do we? ;-) * * RB 09.03.2006: * - rearranged: please use indentation to seperate if/for blocks/statements! * - modified to use draw_slices in stead of draw_slice
public init ( $w, $h, $d )

roundoff() public method

* * PHP has no function for rounding off doubles to the nearest * integer so we have to roll our own.
public roundoff ( $v )

set_legend_percent() public method

* utility function to set an attribute so we display percentages
public set_legend_percent ( )

set_legend_value() public method

* utility function to set an attribute so we display values
public set_legend_value ( )

Property Details

$PI public_oe property

* {{{ constants
public $PI

$angles public_oe property

public $angles

$bottom public_oe property

public $bottom

$center_x public_oe property

public $center_x

$center_y public_oe property

public $center_y

$colors public_oe property

public $colors

$data public_oe property

public $data

$diameter public_oe property

public $diameter

$fx public_oe property

* font sizes
public $fx

$fy public_oe property

* font sizes
public $fy

$head_space public_oe property

public $head_space

$head_top public_oe property

public $head_top

$height public_oe property

public $height

$im public_oe property

* {{{ attributes
public $im

$left public_oe property

public $left

$legend_left public_oe property

public $legend_left

$legend_num public_oe property

public $legend_num

$right public_oe property

public $right

$sum public_oe property

* sum of values
public $sum

$top public_oe property

public $top

$width public_oe property

public $width