[ Index ] |
|
Code source de jpGraph 2.2 |
1 <?php 2 // Gantt example 3 include ("../jpgraph.php"); 4 include ("../jpgraph_gantt.php"); 5 6 $graph = new GanttGraph(); 7 8 $graph->title->Set("Only month & year scale"); 9 10 // Setup some "very" nonstandard colors 11 $graph->SetMarginColor('lightgreen@0.8'); 12 $graph->SetBox(true,'yellow:0.6',2); 13 $graph->SetFrame(true,'darkgreen',4); 14 $graph->scale->divider->SetColor('yellow:0.6'); 15 $graph->scale->dividerh->SetColor('yellow:0.6'); 16 17 // Explicitely set the date range 18 // (Autoscaling will of course also work) 19 $graph->SetDateRange('2001-10-06','2002-4-10'); 20 21 // Display month and year scale with the gridlines 22 $graph->ShowHeaders(GANTT_HMONTH | GANTT_HYEAR); 23 $graph->scale->month->grid->SetColor('gray'); 24 $graph->scale->month->grid->Show(true); 25 $graph->scale->year->grid->SetColor('gray'); 26 $graph->scale->year->grid->Show(true); 27 28 29 // Setup activity info 30 31 // For the titles we also add a minimum width of 100 pixels for the Task name column 32 $graph->scale->actinfo->SetColTitles( 33 array('Name','Duration','Start','Finish'),array(100)); 34 $graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5'); 35 $graph->scale->actinfo->SetFont(FF_ARIAL,FS_NORMAL,10); 36 $graph->scale->actinfo->vgrid->SetStyle('solid'); 37 $graph->scale->actinfo->vgrid->SetColor('gray'); 38 39 // Data for our example activities 40 $data = array( 41 array(0,array("Pre-study","102 days","23 Nov '01","1 Mar '02") 42 , "2001-11-23","2002-03-1",FF_ARIAL,FS_NORMAL,8), 43 array(1,array("Prototype","21 days","26 Oct '01","16 Nov '01"), 44 "2001-10-26","2001-11-16",FF_ARIAL,FS_NORMAL,8), 45 array(2,array("Report","12 days","1 Mar '02","13 Mar '02"), 46 "2002-03-01","2002-03-13",FF_ARIAL,FS_NORMAL,8) 47 ); 48 49 // Create the bars and add them to the gantt chart 50 for($i=0; $i<count($data); ++$i) { 51 $bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3],"[50%]",10); 52 if( count($data[$i])>4 ) 53 $bar->title->SetFont($data[$i][4],$data[$i][5],$data[$i][6]); 54 $bar->SetPattern(BAND_RDIAG,"yellow"); 55 $bar->SetFillColor("gray"); 56 $bar->progress->Set(0.5); 57 $bar->progress->SetPattern(GANTT_SOLID,"darkgreen"); 58 $graph->Add($bar); 59 } 60 61 // Output the chart 62 $graph->Stroke(); 63 64 ?> 65 66
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:27:55 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |