Class GanttGraph Extends Graph
(Defined in: jpgraph_gantt.php : 331)

GanttGraph | Graph

Add()
CreateSimple()
SetDateRange()
SetLabelVMarginFactor()
SetSimpleFont()
SetSimpleStyle()
SetVMarginFactor()
SetZoomFactor()
ShowHeaders()
Stroke()
StrokeTexts()
__construct()

Add()
AddBand()
AddLine()
AddText()
AddY()
AddY2()
CheckCSIMCache()
GetCSIMImgHTML()
GetHTMLImageMap()
Set3DPerspective()
Set90AndMargin()
SetAlphaBlending()
SetAngle()
SetAxisLabelBackground()
SetAxisStyle()
SetBackgroundCFlag()
SetBackgroundCountryFlag()
SetBackgroundGradient()
SetBackgroundImage()
SetBackgroundImageMix()
SetBackgroundImagePos()
SetBox()
SetClipping()
SetColor()
SetCSIMImgAlt()
SetFrame()
SetFrameBevel()
SetGridDepth()
SetIconDepth()
SetImgFormat()
SetMargin()
SetMarginColor()
SetScale()
SetShadow()
SetTextScaleAbsCenterOff()
SetTickDensity()
SetTitleBackground()
SetTitleBackgroundFillStyle()
SetUserFont()
SetUserFont1()
SetUserFont2()
SetUserFont3()
SetY2OrderBack()
SetY2Scale()
SetYDeltaDist()
SetYScale()
Stroke()
StrokeCSIM()
StrokeCSIMImage()
StrokeFrameBackground()
StrokeStore()
__construct()

Class usage and Overview
Create a Gantt graph. The Gantt graph can then be built up by adding activity bars and milestones.

See also related classes:
GanttBar, GanttVLine and MileStone

Class Methods

GanttGraph ::
Add($aObject)
Add a new Gantt object

Argument | Default | Description
--- | --- | ---
$aObject |  | Gantt plot object

Description:
Add a gantt object to the graph. A gantt object is an instance of either:

- GanttBar
- MileStone
- GanttVLine

Example:

$vline = new GanttVLine("2002-02-28");
$vline->title->Set("2002-02-28");
$vline->title->SetFont(FF_FONT1,FS_BOLD,10);
$graph->Add($vline);

GanttGraph ::
CreateSimple($data, $constrains, $progress)
A utility function to help create the Gantt charts

Argument | Default | Description
--- | --- | ---
$data |  | Gantt bar specification (See below)
$constrains | array() | Constrain specification (see below)
$progress | array() | Progress specification (see below)

Description:
For a simple Gantt graphs this will simplify it's creation. The idea is that this method accepts a number of data arrays which specifies the activities in the Gantt graph.

Description of arguments

- $data. Specifies the basic type of activity. Eac entry is an array with the following content:
  1. Row where activity whould be
  2. Type of activity, can be one of ACTYPE_NORMAL, ACTYPE_GROUP, ACTYUPE_MILESTONE
  3. Activity title
  4. Start date
  5. End date
  6. Caption text
- $constrains. Specifies potential constrain links between activities each entry is an array with the following content
  1. From activity (specified by row)
  2. To activity (specified by row)
  3. Constrain type, (e.g CONSTRAIN_ENDSTART)
- $progress. Specify a potential progress bar for each activity. Each entry is an array with the following content
  1. Activity specification (by row)
  2. Progress as a fraction in the range [0,1]

See also:

- GanttPlotObject::SetConstrain()
- Progress::Set()
- GanttGraph::SetSimpleFont()
- GanttGraph::SetSimpleStyle()

Example:

$data = array(
array(0,ACTYPE_GROUP, "Phase 1", "2001-10-26","2001-11-23",''),
array(1,ACTYPE_NORMAL, " Label 2", "2001-10-26","2001-11-16",''),
array(2,ACTYPE_NORMAL, " Label 3", "2001-11-20","2001-11-22",''),
array(3,ACTYPE_MILESTONE," Phase 1 Done", "2001-11-23",'M2') );
// The constrains between the activities
$constrains = array(array(1,2,CONSTRAIN_ENDSTART),
array(2,3,CONSTRAIN_STARTSTART));
$progress = array(array(1,0.4));
// Create the basic graph
$graph = new GanttGraph();
$graph->title->Set("Example with grouping and constrains");
// Setup scale
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
// Add the specified activities
$graph->CreateSimple($data,$constrains,$progress);
// .. and stroke the graph
$graph->Stroke();

GanttGraph ::
SetDateRange($aStart, $aEnd)
Specify date range for Gantt chart.

Argument | Default | Description
--- | --- | ---
$aStart |  | Start date
$aEnd |  | End date

Description:
Specify the date range for Gantt graphs. If this is not set it will be automtically determined from the input data.

All gantt chart objects, like bar activities, will be clipped to the spcified date range should they happen to be wider then the specified range.

The date is specified as a normal date string according to the chosen locale.

Example:

$graph->SetDateRange('2001-11-22','2002-1-24');

GanttGraph ::
SetLabelVMarginFactor($aVal)
Set margin vertical factor.

Argument | Default | Description
--- | --- | ---
$aVal |  | Margin factor

Description:
Specify the fraction of the font height that should be added as vertical margin between the labels.

Example:

$ganttgraph->SetLabelVMarginFactor(0.7);

GanttGraph ::
SetSimpleFont($aFont, $aSize)
Specify font for simplified Gantt graph

Argument | Default | Description
--- | --- | ---
$aFont |  | Font family
$aSize |  | Font size

Description:
Specify font for simplified Gantt graph constructed with CreateSimple
See also:

- GanttGraph::CreateSimple()

Example:

$ganttgraph->SetSimpleFont(FF_FONT2);

GanttGraph ::
SetSimpleStyle($aBand, $aColor, $aBkgColor)
Specify style parameters for graphs constructed with CreateSimple

Argument | Default | Description
--- | --- | ---
$aBand |  | Patern style
$aColor |  | Pattern color
$aBkgColor |  | Pattern background color

Description:
Specify looks for bars in Gantt graph when the gantt chart is created with CreateSimple.

The pattern style can be one of

1. GANTT_RDIAG, Right diagonal lines
2. GANTT_LDIAG, Left diagonal lines
3. GANTT_SOLID, Solid one color
4. GANTT_LVERT, Vertical lines
5. GANTT_LHOR, Horizontal lines
6. GANTT_VLINE, Vertical lines
7. GANTT_HLINE, Horizontal lines
8. GANTT_3DPLANE, A 3D plane
9. GANTT_HVCROSS, Crosses
10. GANTT_DIAGCROSS, Diagonal crosses

See also:

- GanttGraph::CreateSimple()
- GanttBar::SetPattern()

Example:

$ganttgraph->SetSimpleStyle(GANTT_SOLID,'orange','orange');

GanttGraph ::
SetVMarginFactor($aVal)
Specify the margin factor for lines in the gantt graph

Argument | Default | Description
--- | --- | ---
$aVal |  | Vertical margin factor

Description:
Specify the margin factor for lines in the Gantt graph. A factor of 1 makes each line take just as much space as it needs. A factor of 1.5 makes it 1.5 linmes apart and a factor of 2 makes it double-line spacing and so on.

Hint: When using icon in titles it is usually a good idea to use a margin factor > 1

See also:

- GanttGraph::SetLabelVMarginFactor()

Example:

$graph->SetVMarginFactor(2);

GanttGraph ::
SetZoomFactor($aZoom)
// Set user specified scale zoom factor when auto sizing is used

Argument | Default | Description
--- | --- | ---
$aZoom |  | No description available

Description:
No description available.

GanttGraph ::
ShowHeaders($aFlg)
Determine what headers/scales to display.

Argument | Default | Description
--- | --- | ---
$aFlg |  | Logic OR of flags to specify what headers should be displayed.

Description:
Specify what headers should be displayed on the Gantt charts. Possible headers are:

- GANTT_HYEAR
- GANTT_HMONTH
- GANTT_HWEEK
- GANTT_HDAY
- GANTT_HHOUR
- GANTT_HMIN

To specify multiple header you just bitwise OR the wanted number of headers together.

Example:

// Show all headers
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);

GanttGraph ::
Stroke($aStrokeFileName)
Internal. Stroke the gantt chart.

Argument | Default | Description
--- | --- | ---
$aStrokeFileName | "" | Filename to stroke image to

Description:
Internal. Stroke the gantt chart. If a filename is specified then the graph will be stroked to that file and will not be sent back to the browser.

This should as usual be the last method called in your script.

See also:

- Graph::Stroke()

Example:

$ganttgraph->Stroke();

GanttGraph ::
StrokeTexts()

Description:
No description available.

GanttGraph ::
__construct($aWidth, $aHeight, $aCachedName, $aTimeOut, $aInline)
Create a new GanttGraph

Argument | Default | Description
--- | --- | ---
$aWidth | 0 | Width of graph
$aHeight | 0 | Height of graph
$aCachedName | "" | Filename to use if cache is enables
$aTimeOut | 0 | Timeout in minutes
$aInline | true | True=Stream back to browser

Description:
Construct a new GanttGraph. This differs slightly from the standard Graph or PlotGraph in that you are not required to specify width and height of the graph. Instead these can be left out and will be automatically be determined.

As a further refinement you can just specify width and have the height be automtically determined.

See also:

- Graph::__construct()

Example:

// Setup Gantt graph
$graph = new GanttGraph();
$graph->SetShadow();
$graph->SetBox();
// Only show part of the Gantt
$graph->SetDateRange('2001-11-22','2002-1-24');