CLASS PlotLine
(Defined in: jpgraph.php : 8195)
 PlotLine 
 PlotLine() 
 SetColor() 
 SetDirection() 
 SetPosition() 
 SetWeight() 
 

Class usage and Overview
A plot line represents a horizontal or vertical line in the plot at an arbitrary position. A plot line can be added to all X-Y types of plots/graphs.

 

See also related classes:
Graph

 


Class Methods

 

 

function PlotLine($aDir,$aPos,$aColor,$aWeight)
Construct a new plot line

ArgumentDefaultDescription
$aDir HORIZONTAL Direction, HORIZONTAL or VERTICAL
$aPos 0 Position
$aColor "black" Color
$aWeight 1 Line weight

Description
Create a new horizontal or vertical line in the graph at a specific position. The graph can the be added to the graph with a call to the AddLine 

Example

// Add mark graph with static lines
$line = new PlotLine(HORIZONTAL,0,"black",2);
$graph->AddLine($line);

 

 

function SetColor($aColor)
Specify color of line

ArgumentDefaultDescription
$aColor  Color

Description
Set color for line. Note. Colors can also be set in the creation of a PlotLine  
 
See also
PlotLine::PlotLine

Example

$plotline->SetColor('red');

 

 

function SetDirection($aDir)
Specify direction of line

ArgumentDefaultDescription
$aDir  Direction, horizontal or vertical line

Description
Specify direction of line. Valid arguments are: Note: Direction can also be specified in the creation of a plot line.  
 
See also
PlotLine::PlotLine

Example

$plotline->SetDirection(VERTICAL);
$plotline->SetColor('red');
$graph->AddLine($plotline);

 

 

function SetPosition($aScalePosition)
Specify position for plot line

ArgumentDefaultDescription
$aScalePosition  Scale position

Description
Specify position for plot line. If the line is vertical the position is interpretated as the x-coordinate and if it is horizontal then the positoin is interpretatedas the Y-coordinate. Note: Position can also be specified in the creation of the line. 

Example

$plotline->SetDirection(HORIZONTAL);
$plotline->SetPosition(25);
$graph->AddLine($plotline);

 

 

function SetWeight($aWeight)
Specify line weight

ArgumentDefaultDescription
$aWeight  Line weight in pixels

Description
Specify line weight. Note. Line weight can also be specified in the creation of the line.  
 
See also
PlotLine::PlotLine

Example

$plotline->SetColor('red');
$plotline->SetDirection(VERTICAL);
$plotline->SetPosition(35);
$plotline->SetWeight(2);