1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | // Gantt example |
---|
3 | require_once ('jpgraph/jpgraph.php'); |
---|
4 | require_once ('jpgraph/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-01'); |
---|
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 | // Data for our example activities |
---|
29 | $data = array( |
---|
30 | array(0,"Group 1 Johan", "2001-11-23","2002-03-1",FF_FONT1,FS_BOLD,8), |
---|
31 | array(1," Label 2", "2001-10-26","2001-11-16")); |
---|
32 | |
---|
33 | // Create the bars and add them to the gantt chart |
---|
34 | for($i=0; $i<count($data); ++$i) { |
---|
35 | $bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3],"[50%]",10); |
---|
36 | if( count($data[$i])>4 ) |
---|
37 | $bar->title->SetFont($data[$i][4],$data[$i][5],$data[$i][6]); |
---|
38 | $bar->SetPattern(BAND_RDIAG,"yellow"); |
---|
39 | $bar->SetFillColor("red"); |
---|
40 | $bar->progress->Set(0.5); |
---|
41 | $bar->progress->SetPattern(GANTT_SOLID,"darkgreen"); |
---|
42 | $graph->Add($bar); |
---|
43 | } |
---|
44 | |
---|
45 | // Output the chart |
---|
46 | $graph->Stroke(); |
---|
47 | |
---|
48 | ?> |
---|
49 | |
---|
50 | |
---|