CLASS
GanttGraph EXTENDS
Graph
(Defined in: jpgraph_gantt.php : 61) 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
function Add(&$aObject)
Add a new Gantt object
Argument | Default | Description |
&$aObject
| | Gantt object to add |
Description
Add a gantt object to the graph. A gantt object is an instance of either:
- GanttBar
- MileStone
- GanttVLine
$vline = new GanttVLine("2002-02-28");
$vline->title->Set("2002-02-28");
$vline->title->SetFont(FF_FONT1,FS_BOLD,10);
$graph->Add($vline);
function GanttGraph($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::Graph
// Setup Gantt graph
$graph = new GanttGraph();
$graph->SetShadow();
$graph->SetBox();
// Only show part of the Gantt
$graph->SetDateRange('2001-11-22','2002-1-24');
function 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.
$graph->SetDateRange('2001-11-22','2002-1-24');
function 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.
$ganttgraph->SetLabelVMarginFactor(0.7);
function 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
-
To specify multiple header you just bitwise OR the wanted number of headers together.
// Show all headers
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
function 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
$ganttgraph->Stroke();