CLASS Grid
(Defined in: jpgraph.php : 3331) Class usage and Overview
This class is used to hold all properties of the gridline for a specific axis. The grid setting is accessed through the xgrid and ygrid properties of graph.
By default JpGraph has grid lines for Y-lines turned on and gridlines for X-axis turned off.
Class Methods
function SetColor($aMajColor,$aMinColor)
Set color of grid lines
Argument | Default | Description |
$aMajColor
| | Major color |
$aMinColor
|
false
| Minor color |
Description
Set color of grid lines
$graph->xgrid->SetColor('lightblue');
function SetFill($aFlg,$aColor1,$aColor2)
Specify fill style for grid
Argument | Default | Description |
$aFlg
|
true
| Flag, True=enable fill |
$aColor1
|
'lightgray'
| Fill color 1 |
$aColor2
|
'lightblue'
| Fill color 2 |
Description
The area between the gridline can be filled with two alternating colors. This method specifies this style. See 'filledgridex1.php' for an example of this. By using this feature with alpha-blending you can achieve very nice layouts.
// Use 50% blending
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
$graph->ygrid->Show();
$graph->xgrid->Show();
function SetLineStyle($aType)
Specify if grid line should be dashed, dotted or solid
Argument | Default | Description |
$aType
| | String to specify line type |
Description
Specify if grid should be dashed, dotted or solid. The type is specified with a string which can be either "solid", "dashed" or "dotted".
See also
Image::SetLineStyle
$graph->ygrid->SetLineStyle('dashed');
function SetWeight($aWeight)
Set line weight for grid line
Argument | Default | Description |
$aWeight
| | Line width in pixels |
Description
Set line weight for grid line
$graph->xgrid->SetWeight(2);
function Show($aShowMajor,$aShowMinor)
Specify if both major and minor grid should be displayed
Argument | Default | Description |
$aShowMajor
|
true
| True=Show major grid lines |
$aShowMinor
|
false
| True=Show minor grid lines |
Description
Specify if both major and minor grid should be displayed
$graph->ygrid->Show();