<?php |
<?php |
/*======================================================================= |
/*======================================================================= |
// File: JPGRAPH_GANTT.PHP |
// File: JPGRAPH_GANTT.PHP |
// Description: JpGraph Gantt plot extension |
// Description: JpGraph Gantt plot extension |
// Created: 2001-11-12 |
// Created: 2001-11-12 |
// Ver: $Id: jpgraph_gantt.php 1809 2009-09-09 13:07:33Z ljp $ |
// Ver: $Id: jpgraph_gantt.php 1809 2009-09-09 13:07:33Z ljp $ |
// |
// |
// Copyright (c) Aditus Consulting. All rights reserved. |
// Copyright (c) Aditus Consulting. All rights reserved. |
//======================================================================== |
//======================================================================== |
*/ |
*/ |
|
|
require_once('jpgraph_plotband.php'); |
require_once('jpgraph_plotband.php'); |
require_once('jpgraph_iconplot.php'); |
require_once('jpgraph_iconplot.php'); |
require_once('jpgraph_plotmark.inc.php'); |
require_once('jpgraph_plotmark.inc.php'); |
|
|
// Maximum size for Automatic Gantt chart |
// Maximum size for Automatic Gantt chart |
define('MAX_GANTTIMG_SIZE_W',8000); |
define('MAX_GANTTIMG_SIZE_W',8000); |
define('MAX_GANTTIMG_SIZE_H',5000); |
define('MAX_GANTTIMG_SIZE_H',5000); |
|
|
// Scale Header types |
// Scale Header types |
define("GANTT_HDAY",1); |
define("GANTT_HDAY",1); |
define("GANTT_HWEEK",2); |
define("GANTT_HWEEK",2); |
define("GANTT_HMONTH",4); |
define("GANTT_HMONTH",4); |
define("GANTT_HYEAR",8); |
define("GANTT_HYEAR",8); |
define("GANTT_HHOUR",16); |
define("GANTT_HHOUR",16); |
define("GANTT_HMIN",32); |
define("GANTT_HMIN",32); |
|
|
// Bar patterns |
// Bar patterns |
define("GANTT_RDIAG",BAND_RDIAG); // Right diagonal lines |
define("GANTT_RDIAG",BAND_RDIAG); // Right diagonal lines |
define("GANTT_LDIAG",BAND_LDIAG); // Left diagonal lines |
define("GANTT_LDIAG",BAND_LDIAG); // Left diagonal lines |
define("GANTT_SOLID",BAND_SOLID); // Solid one color |
define("GANTT_SOLID",BAND_SOLID); // Solid one color |
define("GANTT_VLINE",BAND_VLINE); // Vertical lines |
define("GANTT_VLINE",BAND_VLINE); // Vertical lines |
define("GANTT_HLINE",BAND_HLINE); // Horizontal lines |
define("GANTT_HLINE",BAND_HLINE); // Horizontal lines |
define("GANTT_3DPLANE",BAND_3DPLANE); // "3D" Plane |
define("GANTT_3DPLANE",BAND_3DPLANE); // "3D" Plane |
define("GANTT_HVCROSS",BAND_HVCROSS); // Vertical/Hor crosses |
define("GANTT_HVCROSS",BAND_HVCROSS); // Vertical/Hor crosses |
define("GANTT_DIAGCROSS",BAND_DIAGCROSS); // Diagonal crosses |
define("GANTT_DIAGCROSS",BAND_DIAGCROSS); // Diagonal crosses |
|
|
// Conversion constant |
// Conversion constant |
define("SECPERDAY",3600*24); |
define("SECPERDAY",3600*24); |
|
|
// Locales. ONLY KEPT FOR BACKWARDS COMPATIBILITY |
// Locales. ONLY KEPT FOR BACKWARDS COMPATIBILITY |
// You should use the proper locale strings directly |
// You should use the proper locale strings directly |
// from now on. |
// from now on. |
define("LOCALE_EN","en_UK"); |
define("LOCALE_EN","en_UK"); |
define("LOCALE_SV","sv_SE"); |
define("LOCALE_SV","sv_SE"); |
|
|
// Layout of bars |
// Layout of bars |
define("GANTT_EVEN",1); |
define("GANTT_EVEN",1); |
define("GANTT_FROMTOP",2); |
define("GANTT_FROMTOP",2); |
|
|
// Style for minute header |
// Style for minute header |
define("MINUTESTYLE_MM",0); // 15 |
define("MINUTESTYLE_MM",0); // 15 |
define("MINUTESTYLE_CUSTOM",2); // Custom format |
define("MINUTESTYLE_CUSTOM",2); // Custom format |
|
|
|
|
// Style for hour header |
// Style for hour header |
define("HOURSTYLE_HM24",0); // 13:10 |
define("HOURSTYLE_HM24",0); // 13:10 |
define("HOURSTYLE_HMAMPM",1); // 1:10pm |
define("HOURSTYLE_HMAMPM",1); // 1:10pm |
define("HOURSTYLE_H24",2); // 13 |
define("HOURSTYLE_H24",2); // 13 |
define("HOURSTYLE_HAMPM",3); // 1pm |
define("HOURSTYLE_HAMPM",3); // 1pm |
define("HOURSTYLE_CUSTOM",4); // User defined |
define("HOURSTYLE_CUSTOM",4); // User defined |
|
|
// Style for day header |
// Style for day header |
define("DAYSTYLE_ONELETTER",0); // "M" |
define("DAYSTYLE_ONELETTER",0); // "M" |
define("DAYSTYLE_LONG",1); // "Monday" |
define("DAYSTYLE_LONG",1); // "Monday" |
define("DAYSTYLE_LONGDAYDATE1",2); // "Monday 23 Jun" |
define("DAYSTYLE_LONGDAYDATE1",2); // "Monday 23 Jun" |
define("DAYSTYLE_LONGDAYDATE2",3); // "Monday 23 Jun 2003" |
define("DAYSTYLE_LONGDAYDATE2",3); // "Monday 23 Jun 2003" |
define("DAYSTYLE_SHORT",4); // "Mon" |
define("DAYSTYLE_SHORT",4); // "Mon" |
define("DAYSTYLE_SHORTDAYDATE1",5); // "Mon 23/6" |
define("DAYSTYLE_SHORTDAYDATE1",5); // "Mon 23/6" |
define("DAYSTYLE_SHORTDAYDATE2",6); // "Mon 23 Jun" |
define("DAYSTYLE_SHORTDAYDATE2",6); // "Mon 23 Jun" |
define("DAYSTYLE_SHORTDAYDATE3",7); // "Mon 23" |
define("DAYSTYLE_SHORTDAYDATE3",7); // "Mon 23" |
define("DAYSTYLE_SHORTDATE1",8); // "23/6" |
define("DAYSTYLE_SHORTDATE1",8); // "23/6" |
define("DAYSTYLE_SHORTDATE2",9); // "23 Jun" |
define("DAYSTYLE_SHORTDATE2",9); // "23 Jun" |
define("DAYSTYLE_SHORTDATE3",10); // "Mon 23" |
define("DAYSTYLE_SHORTDATE3",10); // "Mon 23" |
define("DAYSTYLE_SHORTDATE4",11); // "23" |
define("DAYSTYLE_SHORTDATE4",11); // "23" |
define("DAYSTYLE_CUSTOM",12); // "M" |
define("DAYSTYLE_CUSTOM",12); // "M" |
|
|
// Styles for week header |
// Styles for week header |
define("WEEKSTYLE_WNBR",0); |
define("WEEKSTYLE_WNBR",0); |
define("WEEKSTYLE_FIRSTDAY",1); |
define("WEEKSTYLE_FIRSTDAY",1); |
define("WEEKSTYLE_FIRSTDAY2",2); |
define("WEEKSTYLE_FIRSTDAY2",2); |
define("WEEKSTYLE_FIRSTDAYWNBR",3); |
define("WEEKSTYLE_FIRSTDAYWNBR",3); |
define("WEEKSTYLE_FIRSTDAY2WNBR",4); |
define("WEEKSTYLE_FIRSTDAY2WNBR",4); |
|
|
// Styles for month header |
// Styles for month header |
define("MONTHSTYLE_SHORTNAME",0); |
define("MONTHSTYLE_SHORTNAME",0); |
define("MONTHSTYLE_LONGNAME",1); |
define("MONTHSTYLE_LONGNAME",1); |
define("MONTHSTYLE_LONGNAMEYEAR2",2); |
define("MONTHSTYLE_LONGNAMEYEAR2",2); |
define("MONTHSTYLE_SHORTNAMEYEAR2",3); |
define("MONTHSTYLE_SHORTNAMEYEAR2",3); |
define("MONTHSTYLE_LONGNAMEYEAR4",4); |
define("MONTHSTYLE_LONGNAMEYEAR4",4); |
define("MONTHSTYLE_SHORTNAMEYEAR4",5); |
define("MONTHSTYLE_SHORTNAMEYEAR4",5); |
define("MONTHSTYLE_FIRSTLETTER",6); |
define("MONTHSTYLE_FIRSTLETTER",6); |
|
|
|
|
// Types of constrain links |
// Types of constrain links |
define('CONSTRAIN_STARTSTART',0); |
define('CONSTRAIN_STARTSTART',0); |
define('CONSTRAIN_STARTEND',1); |
define('CONSTRAIN_STARTEND',1); |
define('CONSTRAIN_ENDSTART',2); |
define('CONSTRAIN_ENDSTART',2); |
define('CONSTRAIN_ENDEND',3); |
define('CONSTRAIN_ENDEND',3); |
|
|
// Arrow direction for constrain links |
// Arrow direction for constrain links |
define('ARROW_DOWN',0); |
define('ARROW_DOWN',0); |
define('ARROW_UP',1); |
define('ARROW_UP',1); |
define('ARROW_LEFT',2); |
define('ARROW_LEFT',2); |
define('ARROW_RIGHT',3); |
define('ARROW_RIGHT',3); |
|
|
// Arrow type for constrain type |
// Arrow type for constrain type |
define('ARROWT_SOLID',0); |
define('ARROWT_SOLID',0); |
define('ARROWT_OPEN',1); |
define('ARROWT_OPEN',1); |
|
|
// Arrow size for constrain lines |
// Arrow size for constrain lines |
define('ARROW_S1',0); |
define('ARROW_S1',0); |
define('ARROW_S2',1); |
define('ARROW_S2',1); |
define('ARROW_S3',2); |
define('ARROW_S3',2); |
define('ARROW_S4',3); |
define('ARROW_S4',3); |
define('ARROW_S5',4); |
define('ARROW_S5',4); |
|
|
// Activity types for use with utility method CreateSimple() |
// Activity types for use with utility method CreateSimple() |
define('ACTYPE_NORMAL',0); |
define('ACTYPE_NORMAL',0); |
define('ACTYPE_GROUP',1); |
define('ACTYPE_GROUP',1); |
define('ACTYPE_MILESTONE',2); |
define('ACTYPE_MILESTONE',2); |
|
|
define('ACTINFO_3D',1); |
define('ACTINFO_3D',1); |
define('ACTINFO_2D',0); |
define('ACTINFO_2D',0); |
|
|
|
|
// Check if array_fill() exists |
// Check if array_fill() exists |
if (!function_exists('array_fill')) { |
if (!function_exists('array_fill')) { |
function array_fill($iStart, $iLen, $vValue) { |
function array_fill($iStart, $iLen, $vValue) { |
$aResult = array(); |
$aResult = array(); |
for ($iCount = $iStart; $iCount < $iLen + $iStart; $iCount++) { |
for ($iCount = $iStart; $iCount < $iLen + $iStart; $iCount++) { |
$aResult[$iCount] = $vValue; |
$aResult[$iCount] = $vValue; |
} |
} |
return $aResult; |
return $aResult; |
} |
} |
} |
} |
|
|
//=================================================== |
//=================================================== |
// CLASS GanttActivityInfo |
// CLASS GanttActivityInfo |
// Description: |
// Description: |
//=================================================== |
//=================================================== |
class GanttActivityInfo { |
class GanttActivityInfo { |
public $iShow=true; |
public $iShow=true; |
public $iLeftColMargin=4,$iRightColMargin=1,$iTopColMargin=1,$iBottomColMargin=3; |
public $iLeftColMargin=4,$iRightColMargin=1,$iTopColMargin=1,$iBottomColMargin=3; |
public $vgrid = null; |
public $vgrid = null; |
private $iColor='black'; |
private $iColor='black'; |
private $iBackgroundColor='lightgray'; |
private $iBackgroundColor='lightgray'; |
private $iFFamily=FF_FONT1,$iFStyle=FS_NORMAL,$iFSize=10,$iFontColor='black'; |
private $iFFamily=FF_FONT1,$iFStyle=FS_NORMAL,$iFSize=10,$iFontColor='black'; |
private $iTitles=array(); |
private $iTitles=array(); |
private $iWidth=array(),$iHeight=-1; |
private $iWidth=array(),$iHeight=-1; |
private $iTopHeaderMargin = 4; |
private $iTopHeaderMargin = 4; |
private $iStyle=1; |
private $iStyle=1; |
private $iHeaderAlign='center'; |
private $iHeaderAlign='center'; |
|
|
function __construct() { |
function __construct() { |
$this->vgrid = new LineProperty(); |
$this->vgrid = new LineProperty(); |
} |
} |
|
|
function Hide($aF=true) { |
function Hide($aF=true) { |
$this->iShow=!$aF; |
$this->iShow=!$aF; |
} |
} |
|
|
function Show($aF=true) { |
function Show($aF=true) { |
$this->iShow=$aF; |
$this->iShow=$aF; |
} |
} |
|
|
// Specify font |
// Specify font |
function SetFont($aFFamily,$aFStyle=FS_NORMAL,$aFSize=10) { |
function SetFont($aFFamily,$aFStyle=FS_NORMAL,$aFSize=10) { |
$this->iFFamily = $aFFamily; |
$this->iFFamily = $aFFamily; |
$this->iFStyle = $aFStyle; |
$this->iFStyle = $aFStyle; |
$this->iFSize = $aFSize; |
$this->iFSize = $aFSize; |
} |
} |
|
|
function SetStyle($aStyle) { |
function SetStyle($aStyle) { |
$this->iStyle = $aStyle; |
$this->iStyle = $aStyle; |
} |
} |
|
|
function SetColumnMargin($aLeft,$aRight) { |
function SetColumnMargin($aLeft,$aRight) { |
$this->iLeftColMargin = $aLeft; |
$this->iLeftColMargin = $aLeft; |
$this->iRightColMargin = $aRight; |
$this->iRightColMargin = $aRight; |
} |
} |
|
|
function SetFontColor($aFontColor) { |
function SetFontColor($aFontColor) { |
$this->iFontColor = $aFontColor; |
$this->iFontColor = $aFontColor; |
} |
} |
|
|
function SetColor($aColor) { |
function SetColor($aColor) { |
$this->iColor = $aColor; |
$this->iColor = $aColor; |
} |
} |
|
|
function SetBackgroundColor($aColor) { |
function SetBackgroundColor($aColor) { |
$this->iBackgroundColor = $aColor; |
$this->iBackgroundColor = $aColor; |
} |
} |
|
|
function SetColTitles($aTitles,$aWidth=null) { |
function SetColTitles($aTitles,$aWidth=null) { |
$this->iTitles = $aTitles; |
$this->iTitles = $aTitles; |
$this->iWidth = $aWidth; |
$this->iWidth = $aWidth; |
} |
} |
|
|
function SetMinColWidth($aWidths) { |
function SetMinColWidth($aWidths) { |
$n = min(count($this->iTitles),count($aWidths)); |
$n = min(count($this->iTitles),count($aWidths)); |
for($i=0; $i < $n; ++$i ) { |
for($i=0; $i < $n; ++$i ) { |
if( !empty($aWidths[$i]) ) { |
if( !empty($aWidths[$i]) ) { |
if( empty($this->iWidth[$i]) ) { |
if( empty($this->iWidth[$i]) ) { |
$this->iWidth[$i] = $aWidths[$i]; |
$this->iWidth[$i] = $aWidths[$i]; |
} |
} |
else { |
else { |
$this->iWidth[$i] = max($this->iWidth[$i],$aWidths[$i]); |
$this->iWidth[$i] = max($this->iWidth[$i],$aWidths[$i]); |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
function GetWidth($aImg) { |
function GetWidth($aImg) { |
$txt = new TextProperty(); |
$txt = new TextProperty(); |
$txt->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize); |
$txt->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize); |
$n = count($this->iTitles) ; |
$n = count($this->iTitles) ; |
$rm=$this->iRightColMargin; |
$rm=$this->iRightColMargin; |
$w = 0; |
$w = 0; |
for($h=0, $i=0; $i < $n; ++$i ) { |
for($h=0, $i=0; $i < $n; ++$i ) { |
$w += $this->iLeftColMargin; |
$w += $this->iLeftColMargin; |
$txt->Set($this->iTitles[$i]); |
$txt->Set($this->iTitles[$i]); |
if( !empty($this->iWidth[$i]) ) { |
if( !empty($this->iWidth[$i]) ) { |
$w1 = max($txt->GetWidth($aImg)+$rm,$this->iWidth[$i]); |
$w1 = max($txt->GetWidth($aImg)+$rm,$this->iWidth[$i]); |
} |
} |
else { |
else { |
$w1 = $txt->GetWidth($aImg)+$rm; |
$w1 = $txt->GetWidth($aImg)+$rm; |
} |
} |
$this->iWidth[$i] = $w1; |
$this->iWidth[$i] = $w1; |
$w += $w1; |
$w += $w1; |
$h = max($h,$txt->GetHeight($aImg)); |
$h = max($h,$txt->GetHeight($aImg)); |
} |
} |
$this->iHeight = $h+$this->iTopHeaderMargin; |
$this->iHeight = $h+$this->iTopHeaderMargin; |
$txt=''; |
$txt=''; |
return $w; |
return $w; |
} |
} |
|
|
function GetColStart($aImg,&$aStart,$aAddLeftMargin=false) { |
function GetColStart($aImg,&$aStart,$aAddLeftMargin=false) { |
$n = count($this->iTitles) ; |
$n = count($this->iTitles) ; |
$adj = $aAddLeftMargin ? $this->iLeftColMargin : 0; |
$adj = $aAddLeftMargin ? $this->iLeftColMargin : 0; |
$aStart=array($aImg->left_margin+$adj); |
$aStart=array($aImg->left_margin+$adj); |
for( $i=1; $i < $n; ++$i ) { |
for( $i=1; $i < $n; ++$i ) { |
$aStart[$i] = $aStart[$i-1]+$this->iLeftColMargin+$this->iWidth[$i-1]; |
$aStart[$i] = $aStart[$i-1]+$this->iLeftColMargin+$this->iWidth[$i-1]; |
} |
} |
} |
} |
|
|
// Adjust headers left, right or centered |
// Adjust headers left, right or centered |
function SetHeaderAlign($aAlign) { |
function SetHeaderAlign($aAlign) { |
$this->iHeaderAlign=$aAlign; |
$this->iHeaderAlign=$aAlign; |
} |
} |
|
|
function Stroke($aImg,$aXLeft,$aYTop,$aXRight,$aYBottom,$aUseTextHeight=false) { |
function Stroke($aImg,$aXLeft,$aYTop,$aXRight,$aYBottom,$aUseTextHeight=false) { |
|
|
if( !$this->iShow ) return; |
if( !$this->iShow ) return; |
|
|
$txt = new TextProperty(); |
$txt = new TextProperty(); |
$txt->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize); |
$txt->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize); |
$txt->SetColor($this->iFontColor); |
$txt->SetColor($this->iFontColor); |
$txt->SetAlign($this->iHeaderAlign,'top'); |
$txt->SetAlign($this->iHeaderAlign,'top'); |
$n=count($this->iTitles); |
$n=count($this->iTitles); |
|
|
if( $n == 0 ) |
if( $n == 0 ) |
return; |
return; |
|
|
$x = $aXLeft; |
$x = $aXLeft; |
$h = $this->iHeight; |
$h = $this->iHeight; |
$yTop = $aUseTextHeight ? $aYBottom-$h-$this->iTopColMargin-$this->iBottomColMargin : $aYTop ; |
$yTop = $aUseTextHeight ? $aYBottom-$h-$this->iTopColMargin-$this->iBottomColMargin : $aYTop ; |
|
|
if( $h < 0 ) { |
if( $h < 0 ) { |
JpGraphError::RaiseL(6001); |
JpGraphError::RaiseL(6001); |
//('Internal error. Height for ActivityTitles is < 0'); |
//('Internal error. Height for ActivityTitles is < 0'); |
} |
} |
|
|
$aImg->SetLineWeight(1); |
$aImg->SetLineWeight(1); |
// Set background color |
// Set background color |
$aImg->SetColor($this->iBackgroundColor); |
$aImg->SetColor($this->iBackgroundColor); |
$aImg->FilledRectangle($aXLeft,$yTop,$aXRight,$aYBottom-1); |
$aImg->FilledRectangle($aXLeft,$yTop,$aXRight,$aYBottom-1); |
|
|
if( $this->iStyle == 1 ) { |
if( $this->iStyle == 1 ) { |
// Make a 3D effect |
// Make a 3D effect |
$aImg->SetColor('white'); |
$aImg->SetColor('white'); |
$aImg->Line($aXLeft,$yTop+1,$aXRight,$yTop+1); |
$aImg->Line($aXLeft,$yTop+1,$aXRight,$yTop+1); |
} |
} |
|
|
for($i=0; $i < $n; ++$i ) { |
for($i=0; $i < $n; ++$i ) { |
if( $this->iStyle == 1 ) { |
if( $this->iStyle == 1 ) { |
// Make a 3D effect |
// Make a 3D effect |
$aImg->SetColor('white'); |
$aImg->SetColor('white'); |
$aImg->Line($x+1,$yTop,$x+1,$aYBottom); |
$aImg->Line($x+1,$yTop,$x+1,$aYBottom); |
} |
} |
$x += $this->iLeftColMargin; |
$x += $this->iLeftColMargin; |
$txt->Set($this->iTitles[$i]); |
$txt->Set($this->iTitles[$i]); |
|
|
// Adjust the text anchor position according to the choosen alignment |
// Adjust the text anchor position according to the choosen alignment |
$xp = $x; |
$xp = $x; |
if( $this->iHeaderAlign == 'center' ) { |
if( $this->iHeaderAlign == 'center' ) { |
$xp = (($x-$this->iLeftColMargin)+($x+$this->iWidth[$i]))/2; |
$xp = (($x-$this->iLeftColMargin)+($x+$this->iWidth[$i]))/2; |
} |
} |
elseif( $this->iHeaderAlign == 'right' ) { |
elseif( $this->iHeaderAlign == 'right' ) { |
$xp = $x +$this->iWidth[$i]-$this->iRightColMargin; |
$xp = $x +$this->iWidth[$i]-$this->iRightColMargin; |
} |
} |
|
|
$txt->Stroke($aImg,$xp,$yTop+$this->iTopHeaderMargin); |
$txt->Stroke($aImg,$xp,$yTop+$this->iTopHeaderMargin); |
$x += $this->iWidth[$i]; |
$x += $this->iWidth[$i]; |
if( $i < $n-1 ) { |
if( $i < $n-1 ) { |
$aImg->SetColor($this->iColor); |
$aImg->SetColor($this->iColor); |
$aImg->Line($x,$yTop,$x,$aYBottom); |
$aImg->Line($x,$yTop,$x,$aYBottom); |
} |
} |
} |
} |
|
|
$aImg->SetColor($this->iColor); |
$aImg->SetColor($this->iColor); |
$aImg->Line($aXLeft,$yTop, $aXRight,$yTop); |
$aImg->Line($aXLeft,$yTop, $aXRight,$yTop); |
|
|
// Stroke vertical column dividers |
// Stroke vertical column dividers |
$cols=array(); |
$cols=array(); |
$this->GetColStart($aImg,$cols); |
$this->GetColStart($aImg,$cols); |
$n=count($cols); |
$n=count($cols); |
for( $i=1; $i < $n; ++$i ) { |
for( $i=1; $i < $n; ++$i ) { |
$this->vgrid->Stroke($aImg,$cols[$i],$aYBottom,$cols[$i], |
$this->vgrid->Stroke($aImg,$cols[$i],$aYBottom,$cols[$i], |
$aImg->height - $aImg->bottom_margin); |
$aImg->height - $aImg->bottom_margin); |
} |
} |
} |
} |
} |
} |
|
|
|
|
//=================================================== |
//=================================================== |
// CLASS GanttGraph |
// CLASS GanttGraph |
// Description: Main class to handle gantt graphs |
// Description: Main class to handle gantt graphs |
//=================================================== |
//=================================================== |
class GanttGraph extends Graph { |
class GanttGraph extends Graph { |
public $scale; // Public accessible |
public $scale; // Public accessible |
public $hgrid=null; |
public $hgrid=null; |
private $iObj=array(); // Gantt objects |
private $iObj=array(); // Gantt objects |
private $iLabelHMarginFactor=0.2; // 10% margin on each side of the labels |
private $iLabelHMarginFactor=0.2; // 10% margin on each side of the labels |
private $iLabelVMarginFactor=0.4; // 40% margin on top and bottom of label |
private $iLabelVMarginFactor=0.4; // 40% margin on top and bottom of label |
private $iLayout=GANTT_FROMTOP; // Could also be GANTT_EVEN |
private $iLayout=GANTT_FROMTOP; // Could also be GANTT_EVEN |
private $iSimpleFont = FF_FONT1,$iSimpleFontSize=11; |
private $iSimpleFont = FF_FONT1,$iSimpleFontSize=11; |
private $iSimpleStyle=GANTT_RDIAG,$iSimpleColor='yellow',$iSimpleBkgColor='red'; |
private $iSimpleStyle=GANTT_RDIAG,$iSimpleColor='yellow',$iSimpleBkgColor='red'; |
private $iSimpleProgressBkgColor='gray',$iSimpleProgressColor='darkgreen'; |
private $iSimpleProgressBkgColor='gray',$iSimpleProgressColor='darkgreen'; |
private $iSimpleProgressStyle=GANTT_SOLID; |
private $iSimpleProgressStyle=GANTT_SOLID; |
private $iZoomFactor = 1.0; |
private $iZoomFactor = 1.0; |
//--------------- |
//--------------- |
// CONSTRUCTOR |
// CONSTRUCTOR |
// Create a new gantt graph |
// Create a new gantt graph |
function __construct($aWidth=0,$aHeight=0,$aCachedName="",$aTimeOut=0,$aInline=true) { |
function __construct($aWidth=0,$aHeight=0,$aCachedName="",$aTimeOut=0,$aInline=true) { |
|
|
// Backward compatibility |
// Backward compatibility |
if( $aWidth == -1 ) $aWidth=0; |
if( $aWidth == -1 ) $aWidth=0; |
if( $aHeight == -1 ) $aHeight=0; |
if( $aHeight == -1 ) $aHeight=0; |
|
|
if( $aWidth< 0 || $aHeight < 0 ) { |
if( $aWidth< 0 || $aHeight < 0 ) { |
JpgraphError::RaiseL(6002); |
JpgraphError::RaiseL(6002); |
//("You can't specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension."); |
//("You can't specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension."); |
} |
} |
parent::__construct($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline); |
parent::__construct($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline); |
$this->scale = new GanttScale($this->img); |
$this->scale = new GanttScale($this->img); |