function CreateSimple($data, $constrains = array(), $progress = array())
 {
     $num = count($data);
     for ($i = 0; $i < $num; ++$i) {
         switch ($data[$i][1]) {
             case ACTYPE_GROUP:
                 // Create a slightly smaller height bar since the
                 // "wings" at the end will make it look taller
                 $a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 8);
                 $a->title->SetFont($this->iSimpleFont, FS_BOLD, $this->iSimpleFontSize);
                 $a->rightMark->Show();
                 $a->rightMark->SetType(MARK_RIGHTTRIANGLE);
                 $a->rightMark->SetWidth(8);
                 $a->rightMark->SetColor('black');
                 $a->rightMark->SetFillColor('black');
                 $a->leftMark->Show();
                 $a->leftMark->SetType(MARK_LEFTTRIANGLE);
                 $a->leftMark->SetWidth(8);
                 $a->leftMark->SetColor('black');
                 $a->leftMark->SetFillColor('black');
                 $a->SetPattern(BAND_SOLID, 'black');
                 $csimpos = 6;
                 break;
             case ACTYPE_NORMAL:
                 $a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 10);
                 $a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
                 $a->SetPattern($this->iSimpleStyle, $this->iSimpleColor);
                 $a->SetFillColor($this->iSimpleBkgColor);
                 // Check if this activity should have a constrain line
                 $n = count($constrains);
                 for ($j = 0; $j < $n; ++$j) {
                     if (empty($constrains[$j]) || count($constrains[$j]) != 3) {
                         JpGraphError::RaiseL(6003, $j);
                         //("Invalid format for Constrain parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Constrain-To,Constrain-Type)");
                     }
                     if ($constrains[$j][0] == $data[$i][0]) {
                         $a->SetConstrain($constrains[$j][1], $constrains[$j][2], 'black', ARROW_S2, ARROWT_SOLID);
                     }
                 }
                 // Check if this activity have a progress bar
                 $n = count($progress);
                 for ($j = 0; $j < $n; ++$j) {
                     if (empty($progress[$j]) || count($progress[$j]) != 2) {
                         JpGraphError::RaiseL(6004, $j);
                         //("Invalid format for Progress parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Progress)");
                     }
                     if ($progress[$j][0] == $data[$i][0]) {
                         $a->progress->Set($progress[$j][1]);
                         $a->progress->SetPattern($this->iSimpleProgressStyle, $this->iSimpleProgressColor);
                         $a->progress->SetFillColor($this->iSimpleProgressBkgColor);
                         //$a->progress->SetPattern($progress[$j][2],$progress[$j][3]);
                         break;
                     }
                 }
                 $csimpos = 6;
                 break;
             case ACTYPE_MILESTONE:
                 $a = new MileStone($data[$i][0], $data[$i][2], $data[$i][3]);
                 $a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
                 $a->caption->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
                 $csimpos = 5;
                 break;
             default:
                 die('Unknown activity type');
                 break;
         }
         // Setup caption
         $a->caption->Set($data[$i][$csimpos - 1]);
         // Check if this activity should have a CSIM target�?
         if (!empty($data[$i][$csimpos])) {
             $a->SetCSIMTarget($data[$i][$csimpos]);
             $a->SetCSIMAlt($data[$i][$csimpos + 1]);
         }
         if (!empty($data[$i][$csimpos + 2])) {
             $a->title->SetCSIMTarget($data[$i][$csimpos + 2]);
             $a->title->SetCSIMAlt($data[$i][$csimpos + 3]);
         }
         $this->Add($a);
     }
 }
 public function addMilestone(array $columnValues, $start, $color = '#CC0000', $identifier = 0, $captionToTheLeft = false)
 {
     $tStartObj = new w2p_Utilities_Date($start);
     $bar = new MileStone($this->rowCount++, $columnValues, $start, $tStartObj->format($this->df));
     $bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 10);
     $bar->title->SetColor($color);
     $bar->mark->SetType(MARK_DIAMOND);
     $bar->mark->SetWidth(10);
     $bar->mark->SetColor($color);
     $bar->mark->SetFillColor($color);
     if ($captionToTheLeft) {
         $bar->caption->Align("right", "center");
         $bar->SetCaptionMargin(-15);
     }
     $this->graph->Add($this->addDependencies($bar, $identifier));
 }
Ejemplo n.º 3
0
 function CreateSimple($data, $constrains = array(), $progress = array())
 {
     $num = count($data);
     for ($i = 0; $i < $num; ++$i) {
         switch ($data[$i][1]) {
             case ACTYPE_GROUP:
                 $a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 8);
                 $a->title->SetFont($this->iSimpleFont, FS_BOLD, $this->iSimpleFontSize);
                 $a->rightMark->Show();
                 $a->rightMark->SetType(MARK_RIGHTTRIANGLE);
                 $a->rightMark->SetWidth(8);
                 $a->rightMark->SetColor('black');
                 $a->rightMark->SetFillColor('black');
                 $a->leftMark->Show();
                 $a->leftMark->SetType(MARK_LEFTTRIANGLE);
                 $a->leftMark->SetWidth(8);
                 $a->leftMark->SetColor('black');
                 $a->leftMark->SetFillColor('black');
                 $a->SetPattern(BAND_SOLID, 'black');
                 $csimpos = 6;
                 break;
             case ACTYPE_NORMAL:
                 $a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 10);
                 $a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
                 $a->SetPattern($this->iSimpleStyle, $this->iSimpleColor);
                 $a->SetFillColor($this->iSimpleBkgColor);
                 $n = count($constrains);
                 for ($j = 0; $j < $n; ++$j) {
                     if (empty($constrains[$j]) || count($constrains[$j]) != 3) {
                         JpGraphError::RaiseL(6003, $j);
                     }
                     if ($constrains[$j][0] == $data[$i][0]) {
                         $a->SetConstrain($constrains[$j][1], $constrains[$j][2], 'black', ARROW_S2, ARROWT_SOLID);
                     }
                 }
                 $n = count($progress);
                 for ($j = 0; $j < $n; ++$j) {
                     if (empty($progress[$j]) || count($progress[$j]) != 2) {
                         JpGraphError::RaiseL(6004, $j);
                     }
                     if ($progress[$j][0] == $data[$i][0]) {
                         $a->progress->Set($progress[$j][1]);
                         $a->progress->SetHeight(0.5);
                         $a->progress->SetPattern($this->iSimpleProgressStyle, $this->iSimpleProgressColor);
                         $a->progress->SetFillColor($this->iSimpleProgressBkgColor);
                         break;
                     }
                 }
                 $csimpos = 6;
                 break;
             case ACTYPE_MILESTONE:
                 $a = new MileStone($data[$i][0], $data[$i][2], $data[$i][3]);
                 $a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
                 $a->caption->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
                 $csimpos = 5;
                 break;
             default:
                 die('Unknown activity type');
                 break;
         }
         $a->caption->Set($data[$i][$csimpos - 1]);
         if (!empty($data[$i][$csimpos])) {
             $a->SetCSIMTarget($data[$i][$csimpos]);
             $a->SetCSIMAlt($data[$i][$csimpos + 1]);
         }
         if (!empty($data[$i][$csimpos + 2])) {
             $a->title->SetCSIMTarget($data[$i][$csimpos + 2]);
             $a->title->SetCSIMAlt($data[$i][$csimpos + 3]);
         }
         $this->Add($a);
     }
 }
Ejemplo n.º 4
0
 /**
  * @param $task Task
  * @param $start_date string
  * @param $position int
  * @return Milestone
  *
  * Creates a Milestone object (JPGraph), set to the start_date
  * $start_date should be YYYY-MM-DD formatted dates
  */
 private function makeMilestone(Task $task, $start_date, $position)
 {
     $ms = new MileStone($position, $task->name, $task->start_date, $task->start_date);
     $ms->setLabelLeftMargin(20);
     return $ms;
 }