FreeMED. GraphNormalize

Normalizing graph for trending data points over time

Summary
Normalizing graph for trending data points over time
Method to draw the canvas background.
Draws the actual points on the graph.
Internal method to draw the “legend” box.
Draw graph title in nice box
Add data set
Determine numeric boundaries of input data for normalization
Master method to create the graph image in memory
Output graph as JPEG and exit
Output graph as PNG and exit
Internal method to produce “dashed” line style
Internal method to draw a “rounded” box

Functions

GraphNormalize

function GraphNormalize ($title,  
$options =  NULL)

Parameters

$titleTitle for graph
$options(optional) Associative array
  • dashed_grid - (bool) Set to true to have a dashed-style grid
  • interval - Number of divisions in the graph

DrawCanvas

function DrawCanvas ( )

Method to draw the canvas background.  Should be called before DrawData.

DrawData

function DrawData ( )

Draws the actual points on the graph.

DrawLegend

function DrawLegend ( )

Internal method to draw the “legend” box.

DrawTitle

function DrawTitle($title)

Draw graph title in nice box

Parameters

$titleTitle text

DataSet

function DataSet ($name,
$values)

Add data set

Parameters

$nameName of data set
$valuesArray of (key, val)

GetDataLimits

function GetDataLimits (&$minx,
&$miny,
&$maxx,
&$maxy)

Determine numeric boundaries of input data for normalization

Parameters

&$minxMinimum X value by ref
&$minyMinimum Y value by ref
&$maxxMaximum X value by ref
&$maxyMaximum Y value by ref

Process

function Process ( )

Master method to create the graph image in memory

OutputJPEG

function OutputJPEG ( )

Output graph as JPEG and exit

OutputPNG

function OutputPNG ( )

Output graph as PNG and exit

_DashedLine

function _DashedLine($x0,
$y0,
$x1,
$y1,
$fg,
$bg)

Internal method to produce “dashed” line style

Parameters

$x0Starting X coord
$y0Starting Y coord
$x1Ending X coord
$y1Ending Y coord
$fgGD color reference for foreground color
$bgGD color reference for background color

_RoundedBox

function _RoundedBox ($x1,
$y1,
$x2,
$y2,
$radius,
$color)

Internal method to draw a “rounded” box

Parameters

$x1Upper left corner, X
$y1Upper left corner, Y
$x2Lower right corner, X
$y2Lower right corner, Y
$radiusRadius of rounded part of box
$colorGD color reference for box
function GraphNormalize ($title,  
$options =  NULL)
function DrawCanvas ( )
Method to draw the canvas background.
function DrawData ( )
Draws the actual points on the graph.
function DrawLegend ( )
Internal method to draw the “legend” box.
function DrawTitle($title)
Draw graph title in nice box
function DataSet ($name,
$values)
Add data set
function GetDataLimits (&$minx,
&$miny,
&$maxx,
&$maxy)
Determine numeric boundaries of input data for normalization
function Process ( )
Master method to create the graph image in memory
function OutputJPEG ( )
Output graph as JPEG and exit
function OutputPNG ( )
Output graph as PNG and exit
function _DashedLine($x0,
$y0,
$x1,
$y1,
$fg,
$bg)
Internal method to produce “dashed” line style
function _RoundedBox ($x1,
$y1,
$x2,
$y2,
$radius,
$color)
Internal method to draw a “rounded” box