Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  PROJECT::GANTT (3)

.ds Aq ’


Project::Gantt - Create Gantt charts to manage project scheduling



 #!/usr/bin/perl -w
 # a fun, imaginary wednesday
 use strict;
 use Project::Gantt;
 use Project::Gantt::Skin;

 my $skin= new Project::Gantt::Skin(
        doTitle         =>      0);

 my $day = new Project::Gantt(
        file            =>      hourly.png,
        skin            =>      $skin,
        mode            =>      hours,
        description     =>      A day in the life);

 my $al = $day->addResource(
        name            =>      Alex);       

        description     =>      Finish sleep,
        resource        =>      $al,
        start           =>      2004-07-21 00:00:00,
        end             =>      2004-07-21 08:30:00);

        description     =>      Breakfast/Wakeup,
        resource        =>      $al,
        start           =>      2004-07-21 08:30:00,
        end             =>      2004-07-21 10:00:00);

 my $sub = $day->addSubProject(
        description     =>      Important Stuff);
        description     =>      Contemplate my navel,
        resource        =>      $al,
        start           =>      2004-07-21 10:00:00,
        end             =>      2004-07-21 11:00:00);

        description     =>      Lunch,
        resource        =>      $al,
        start           =>      2004-07-21 11:00:00,
        end             =>      2004-07-21 12:30:00);
        description     =>      Wonder about life,
        resource        =>      $al,
        start           =>      2004-07-21 11:00:00,
        end             =>      2004-07-21 11:22:00);

        description     =>      Code for a while,
        resource        =>      $al,
        start           =>      2004-07-21 12:30:00,
        end             =>      2004-07-21 17:00:00);

        description     =>      Sail,
        resource        =>      $al,
        start           =>      2004-07-21 17:00:00,
        end             =>      2004-07-21 20:30:00);


<B>Project::GanttB> provides the ability to easily draw Gantt charts for managing the schedules of projects and many other things. Gantt charts provide a simple, easy to comprehend visual representation of a schedule.

The code above creates a simple chart to display the hour-by-hour breakdown of a sample day. Notice the <B>Project::Gantt::SkinB> object in use. This allows the look and feel of a Gantt chart to be customized. Also note that tasks are divided into two main categories: those that fall directly under the project, and those which are members of the subproject <B>Important StuffB>. Note also that the chart itself will be written to a file in the current working directory called <B>hourly.pngB>. This filename attribute may be set to something such as <B>png:-B> to send output directly to <B>STDOUTB>.

As can be seen from the example, the methods that will be called by a user of this module include: addResource,addTask, addSubProject, and display. The names of these methods suggest their purpose, but they will be further explained.
new() new takes the following parameters: the skin object in use (if not using the default), the filename to use when writing the chart (use <B>png:-B> to write to <B>STDOUTB>), an overall description for the chart, and the time mode for output. The filename and description are fairly self explanatory. The <B>Project::Gantt::SkinB> object will be covered later in this document. The time mode selects which unit of time to use when displaying the chart. This unit can be one of the following: <B>hoursB>, <B>daysB>, and <B>monthsB>. Note that when using the months mode, small overflows of pixels may be present (i.e., one pixel more than should be). Normally these are not noticeable. They are a result of the calculation used to determine how many pixels a timespan should fill when using month more. This is because of the discrepancies between days in various months. If swim lanes are not in use (see the section on <B>Project::Gantt::SkinB>), these errors are unnoticeable.
addResource() addResource really only requires a <B>nameB> parameter at this point. The method will accept whatever you give it, but currently only the <B>nameB> parameter has any impact on the resulting chart.
addTask() addTask attaches a <B>Project::Gantt::TaskB> object to the <B>Project::GanttB> instance that called it. The calling instance may be the root project, or any subproject. The task will be anchored directly underneath it. Parameters that must be passed to this method are as follows: a description of the task, the resource assigned to its undertaking, the starting date of the task and its end date.
addSubProject() addSubProject returns an instance of <B>Project::GanttB> anchored underneath the instance that called it. Thanks to Peter Weatherdon, you can now create nested sub-projects using this method on an existing sub-project object. This reference may then be used to call addTask and create a container relationship with <B>Project::Gantt::TaskB> objects. Currently, the only necesarry parameter is a description of the sub-project.
display() Oddly enough, display writes the chart to a file.


<B>Project::Gantt::SkinB> objects allow users to customize the color scheme of a chart. The skin object is passed to <B>Project::GanttB> during construction. All aspects of the skin are set during its construction as well. The following facets of the chart may be modified:
primaryText <B>primaryTextB> controls the font fill color for all but the sub-project description. The default is black.
secondaryText <B>secondaryTextB> controls the font fill for sub-projects. It defaults to a grey color (#969696).
primaryFill <B>primaryFillB> is the color that fills the information boxes for rows representing tasks. The default is a blue color (#c4dbed).
secondaryFill <B>secondaryFillB> is the color used by sub-project rows for informational boxes, as well as the fill for the calendar header. The default is a grey color (#e5e5e5).
infoStroke <B>infoStrokeB> is the stroke color for the informational boxes. This defaults to black.
containerStroke <B>containerStrokeB> is the stroke color for sub-projects on the chart. This defaults to black.
containerFill <B>containerFillB> is the fill color for sub-project items. This defaults to grey (as defined by <B>Image::MagickB>).
itemFill <B>itemFillB> is the fill color for task items on the chart. This defaults to blue. Note that there is no stroke color for tasks (it is set to the fill).
background <B>backgroundB> is quite obviously the background color. This defaults to white.
font <B>fontB> is the name of the font file as it is passed to <B>Image::MagickB>. See the docs for that module for more information. The default value for this property is determined by searching @INC for the directory of your Project::Gantt installation, and is set to the copy of Bitstream Vera included in the distribution.
doTitle <B>doTitleB> is a boolean that determines whether the title of the chart is drawn on it.
doSwimLanes <B>doSwimLanesB> is a boolean that determines whether lines should be drawn seperating each time interval from the header to the end of the graph. This makes it easy to see the exact values.


Alexander Christian Westholm, <awestholm AT>


August, 2004: Original Version

January 2005: Modifications made by Peter Weatherdon (peter.weatherdon AT, including various bug fixes, and nested sub-projects.


Image::Magick, Class::Date


Copyright 2005, Alexander Christian Westholm.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 115: You forgot a ’=back’ before ’=head2’
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 GANTT (3) 2005-03-18

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.