NAME

Image::OrgChart - Perl extension for writing org charts

SYNOPSIS

use Image::OrgChart;
use strict;
  
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');

my $imagedata = $org_chart->as_image();
if ($org_chart->data_type() eq 'gif') {
    ## write gif file using $imagedata
} elsif ($org_chart->data_type() eq 'png') {
    ## write png file using $imagedata
}

## or
my $GDObj = $org_chart->gd();
my $imagedata = $GDObj->png();

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 $object-add($path)>. The $path can be seperated by any charachter, but the default is a L</>. See the 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.

  • min_height - A minimum height for the output image (in pixels)

  • min_width - A minimum width for the output image (in pixels)

  • 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 GD::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 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.

0.05
  • Fixed some (more) pod errors

  • Added as_image() method as a replacment for draw(). draw() is maintained for backwards compatability, but should be considered depriciated.

  • Added GD as a prerequisite in Makefile.PL (version 1.16 of GD)

0.10
  • Fixed tests for Win32

0.15
  • Added min_height and min_width options. Added exmaple7.pl (simple min h&w example)

0.20
  • Fixed Makefile.PL

AUTHOR

Matt Sanford <mzsanford@cpan.org>

SEE ALSO

perl(1),GD

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 361:

L<> contains only '/'

Around line 444:

L<> contains only '/'

Around line 468:

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