NAME

Image::OrgChart - Perl extension for writing org charts

SYNOPSIS

use Image::OrgChart;
use strict; # every job should, eh ?

my $org_chart = Image::OrgChart->new();
$org_chart->add('/manager/middle-manager/employee1');
$org_chart->add('/manager/middle-manager/employee2');
$org_chart->add('/manager/middle-manager/employee3');
$org_chart->add('/manager/middle-manager/employee4');

$data = $org_chart->draw();
if ($org_chart->data_type() eq 'gif') {
    ## write gif file
} elsif ($org_chart->data_type() eq 'png') {
    ## write png file
}

DESCRIPTION

Image::OrgChart, uses the perl GD module to create OrgChart style images in gif or png format, depending on which is available from your version of GD.
There are several ways to add data to the object, but the most common is the C<$object->add($path)>. The C<$path> can be seperated by any charachter, but the default is a L</>. See the C<new()> method for that and other configuration options.

FUNCTIONS

new([OPTIONS])
Created a new Image::OrgChart object. Takes a hash-like list of configuration options. See list below.
  • box_color - box border color in arrref triplet. default [0,0,0]
  • box_fill_color - box fill color in arrref triplet. default [75,75,75] 
  • connect_color - line color in arrref triplet. default [0,0,0]
  • text_color - text color in arrref triplet. default [0,0,0]
  • bg_color - bg color in arrref triplet. default [255,255,255]
  • shadow_color - shadow color in arrref triplet. default [50,50,50]
  • arrow_heads - 1/0, adds arrow heads to ends of lines
  • fill_boxes - 1/0, fills boxes with box_fill_color prior to adding text
  • shadow - 1/0, draw 'shadows' for boxes. use shadow_color for color
  • h_spacing - horizontal spacing in (in pixels)
  • v_spacing - vertical spacing in (in pixels)
  • indent - indent when new section of boxes is started. measured in characters.
  • font - font to use. must be a vlid FD::Font name (gdTinyFont [default],gdMediumBoldFont, gdGiantFont, etc)
  • path_seperator - Seperator to use for paths provided by the add() command.

add(PATH)
Add data to the object using a seperated scalar. The seperator can be set in the C<new()> constructor, but defaults to L</>.
set_hashref(HASH_REF)
This allows assignment of a hash-of-hashes as the data element of the object. People who have not persons underneath them should have an empty hash-reference as the value. e.g.
    $hash{'root'}{'foo'} = {
                            'bar'      => {},
                            'more foo' => {},
                            'kung-foo' => {},
                           };
                           
draw()
this plots all of the data from the object and returns the image data.
data_type()
returns the data type used by the version of GD in use.
 

EXPORT

None by default.

HISTORY

0.01

Original version; created by h2xs with options

-AXC -v 0.01 -n Image::OrgChart
0.02

Development version, unreleased

0.03
  • Added new() options : arrow_heads,file_boxes,indent,shadow,shadow_color

  • Re-wrote image height and width calculations.

  • Corrected problem connector lines

  • Resturctured internal code to better handle changes.

  • Added font support, including dynamic font attributes.

0.04
  • Fixed some pod errors

  • Fixed error with connecting line of multiple first level boxes.

  • added gd() method. returns gd object.

AUTHOR

Matt Sanford <mzsanford@cpan.org>

SEE ALSO

perl(1),GD

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 449:

You forgot a '=back' before '=head2'

Around line 513:

You forgot a '=back' before '=head1'