Class Grid
(Defined in: jpgraph.php : 3296)

Grid

SetColor()
SetFill()
SetLineStyle()
SetWeight()
Show()

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

Grid ::
SetColor($aMajColor, $aMinColor)
Set color of grid lines

Argument | Default | Description
--- | --- | ---
$aMajColor |  | Major color
$aMinColor | false | Minor color

Description:
Set color of grid lines

Example:

$graph->xgrid->SetColor('lightblue');

Grid ::
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.

Example:

// Use 50% blending
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
$graph->ygrid->Show();
$graph->xgrid->Show();

Grid ::
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()

Example:

$graph->ygrid->SetLineStyle('dashed');

Grid ::
SetWeight($aWeight)
Set line weight for grid line

Argument | Default | Description
--- | --- | ---
$aWeight |  | Line width in pixels

Description:
Set line weight for grid line

Example:

$graph->xgrid->SetWeight(2);

Grid ::
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

Example:

$graph->ygrid->Show();