ultimix
graph_utilities_1_0_0 Class Reference

Public Member Functions

 __construct ()
 fill_graph_area (&$Graph, $GraphAreaColor)
 draw_grid ($Graph, $Color=0xeeeeee)
 draw_coordinates ($Graph, $X=0, $Y=0)
 prepare_graph_area (&$Graph)

Data Fields

 $GraphCore = false
 $Security = false

Detailed Description

Working with graphs.

Author
Dodonov A.A.

Definition at line 26 of file graph_utilities.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Author
Dodonov A.A.

Definition at line 51 of file graph_utilities.php.

{
try
{
$this->GraphCore = get_package( 'graph::graph_core' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

draw_coordinates (   $Graph,
  $X = 0,
  $Y = 0 
)

Function draws coordinate grid.

Parameters
$Graph- Graph.
$X- Start of the cordinates system.
$Y- Start of the cordinates system.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 425 of file graph_utilities.php.

{
try
{
if( $Graph->Img === false )
{
$Graph->draw_client_area();
}
$Graph->CoordX = $X = intval( $X );
$Graph->CoordY = $Y = intval( $Y );
$BlackColor = imagecolorallocate( $Graph->Img , 0 , 0 , 0 );
imageline(
$Graph->Img , $Graph->ClientX , $Graph->Height - $Graph->ClientY - $Y ,
$Graph->ClientX + $Graph->ClientWidth , $Graph->Height - $Graph->ClientY - $Y , $BlackColor
);
imageline(
$Graph->Img , $Graph->ClientX + $X , $Graph->Height - $Graph->ClientY , $Graph->ClientX + $X ,
$Graph->Height - $Graph->ClientY - $Graph->ClientHeight , $BlackColor
);
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
draw_grid (   $Graph,
  $Color = 0xeeeeee 
)

Function draws grid.

Parameters
$Graph- Graph.
$Color- Grid color.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 383 of file graph_utilities.php.

{
try
{
$Color = $this->GraphCore->get_color_from_hex( $Graph->Img , $Color );
$this->draw_vertical_grid_lines( $Graph , $Color );
$this->draw_horizontal_grid_lines( $Graph , $Color );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
fill_graph_area ( $Graph,
  $GraphAreaColor 
)

Function fills graph's client area.

Parameters
$Graph- Graph.
$GraphAreaColor- Hexadecimal representation of the color.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 253 of file graph_utilities.php.

{
try
{
$GraphAreaColor = intval( $GraphAreaColor );
$GraphAreaColor = $this->GraphCore->get_color_from_hex( $Graph->Img , $GraphAreaColor );
$Res = imagefilledrectangle(
$Graph->Img , $Graph->ClientX , $Graph->Height - $Graph->ClientY ,
$Graph->ClientX + $Graph->ClientWidth , $Graph->Height - $Graph->ClientHeight - $Graph->ClientY ,
$GraphAreaColor
);
if( $Res === false )
{
throw( new Exception( 'An error occured while filling client area' ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
prepare_graph_area ( $Graph)

Component's view.

Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 469 of file graph_utilities.php.

{
try
{
$this->set_width_height( $Graph );
$this->prepare_canvas( $Graph );
$BackgroundColor = $this->Security->get_gp( 'background_color' , 'integer' , 0xeeeeee );
$this->GraphCore->fill_background( $Graph->Img , $BackgroundColor );
$this->init_client_area( $Graph );
$GraphAreaColor = $this->Security->get_gp( 'graph_area_color' , 'integer' , 0xffffff );
$this->fill_graph_area( $Graph , $GraphAreaColor );
$this->draw_grid( $Graph );
$this->draw_coordinates( $Graph );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$GraphCore = false

Cached objects.

Author
Dodonov A.A.

Definition at line 38 of file graph_utilities.php.

$Security = false

Definition at line 39 of file graph_utilities.php.


The documentation for this class was generated from the following file: