Matt Sanford

NAME

Imager::TimelineDiagram - Perl extension for creating Timeline Diagrams (designed to show system interaction over time)

SYNOPSIS

  use Imager::TimelineDiagram;
  use Imager::Font;

  my $tg = Imager::TimelineDiagram->new(
                                      #maxTime => 10,
                                      #dataLabelSide => 'left',
                                      labelFont => Imager::Font->new(file => 't/ImUgly.ttf'),
                                     );

  $tg->set_milestones(qw(A B C D E));

  my @points = (
     # From, To, AtTime
     ['A','B',1.0],
     ['B','C',2.0],
     ['C','D',3.3],
     ['D','C',4.3],
     ['C','A',5.0],
  );

  $tg->add_points(@points);

  $tg->write('foo.png');

ABSTRACT

  Module for creating Timeline Diagrams.

DESCRIPTION

Module for creating Timeline Diagrams.

OPTIONS

      Create a new object. Returns undef on error. Takes the following options (listed with defaults) :
        imageHeight => 440,
        imageWidth => 440,
    
        gridWidth => 401,
        gridHeight => 401,
        gridSpacing => 10,
        gridXOffset => 20,
        gridYOffset => 10,
        gridColor => Imager::Color->new(200,200,200),  # grey
    
        dataColor => Imager::Color->new(255,100,100),  # red-ish
        dataFormat => '%0.2f', # sprintf() format string
        dataLabelSide => 'right',
        showArrowheads => 1,
    
        labelColor => Imager::Color->new(0,0,0),
        labelSize => 12,
        labelFont => Imager::Font->new(file => 'ImUgly.ttf'),

    set_milestones

      Set the names of the stop-lines on the diagram. In the original usage these represented processes and the module was used to show the message processing time.

    add_points

      Add the data. This method takes an array of arrays with data in the form of :
    
       @array = (
         ['processFrom','processTo','time'],
         .
         .
         .
       )
    
      Where the 'time' is the amount of time since the beginig of the timeline. (So, it should be greater than all previoud values)

    write

      This method takes a single argument of file name and outputs the image. The format of the image is decided by the file extention using Imager's internal logic.

EXPORT

None by default.

TODO

If you have the time to spend, feel free to work on these and send me patches.

  • Add ability to pass DateTime objects in add_points

  • Make the module auto-populate the milestones if not provided

  • Provide API access to Imager object

  • Add more formatting options.

HISTORY

0.15

Documentation added (pod).

0.10

Original version

SEE ALSO

perl, Imager

AUTHOR

Matt Sanford <mzsanford@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2004 by Matt Sanford

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

1 POD Error

The following errors were encountered while parsing the POD:

Around line 267:

=over should be: '=over' or '=over positive_number'

You can't have =items (as at line 290) unless the first thing after the =over is an =item