source: trunk/xgraph/jpgraph/Examples/ganttex13-zoom2.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 2.0 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_gantt.php');
4
5$graph = new GanttGraph();
6$graph->SetShadow();
7
8// Add title and subtitle
9$graph->title->Set("Zooming a graph");
10$graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
11$graph->subtitle->Set("(zoom=1.5)");
12
13// Show day, week and month scale
14$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
15
16// Instead of week number show the date for the first day in the week
17// on the week scale
18$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
19
20// Make the week scale font smaller than the default
21$graph->scale->week->SetFont(FF_FONT0);
22
23// Use the short name of the month together with a 2 digit year
24// on the month scale
25$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
26$graph->scale->month->SetFontColor("white");
27$graph->scale->month->SetBackgroundColor("blue");
28
29// 0 % vertical label margin
30$graph->SetLabelVMarginFactor(1.0); // 1=default value
31
32// Set zoom factor
33$graph->SetZoomFactor(1.5);
34
35// Format the bar for the first activity
36// ($row,$title,$startdate,$enddate)
37$activity1 = new GanttBar(0,"Activity 1","2001-12-21","2002-01-07","[ER,TR]");
38
39// Yellow diagonal line pattern on a red background
40$activity1->SetPattern(BAND_RDIAG,"yellow");
41$activity1->SetFillColor("red");
42
43// Set absolute height of activity
44$activity1->SetHeight(16);
45
46// Format the bar for the second activity
47// ($row,$title,$startdate,$enddate)
48$activity2 = new GanttBar(1,"Activity 2","2001-12-21","2002-01-01","[BO,SW,JC]");
49
50// ADjust font for caption
51$activity2->caption->SetFont(FF_ARIAL,FS_BOLD);
52$activity2->caption->SetColor("darkred");
53
54// Yellow diagonal line pattern on a red background
55$activity2->SetPattern(BAND_RDIAG,"yellow");
56$activity2->SetFillColor("red");
57
58// Set absolute height of activity
59$activity2->SetHeight(16);
60
61// Finally add the bar to the graph
62$graph->Add($activity1);
63$graph->Add($activity2);
64
65// ... and display it
66$graph->Stroke();
67?>
Note: See TracBrowser for help on using the repository browser.