The Edward Owen Company
Open Source Technology for Business
  - Client Login -  

PSGRAPH(3)            User Contributed Perl Documentation           PSGRAPH(3)



NAME
       PSGRAPH - Perl extension for batch creation of charts and graphs

SYNOPSIS
         use PSGRAPH;
         my $psgraph = PSGRAPH->new();

         #for pie charts, setInitialdegree sets the starting point for data. The default is 120.
         $psgraph->setInitialdegree(integer);

         #label and color files must be tab delimited with a string for the label and CMYK color numbers
         #example: Salary      .23     .46     .73     0
         #for pie5 (exploded pie) include the string for the label, CMYK number and integer for the exploded section
         #example: Salary      .23     .46     .73     0       1
         #There must be a line for each data element for each record
         $psgraph->setLabelandColor(’your label and color file’);

         #data files must be tab delimited populated with the value for each data element
         #pie slice, bar, column, etc)
         #the last element in each row is the identifying index (employee number, SSN or any unique string) No spaces.
         $psgraph->setData(’your data file’);

         #must be one of the supported graphic types
         #as of May 2014 the supported types are 2Dpie, 2Dcolumn and 2Dbar
         $psgraph->setGraphic(’type of graphic’);

         #set the subtype (or take the default)
         #Valid subtypes currently are, for 2Dpie:
           #1 pie with callout lines with labels at the end of the lines (default)
           #2 pie with callout lines with percentages and labels at the end of the lines
              The percentages are calculated by the program
           #3 pie with legend
           #4 pie with percentages and legend
           #5 exploded pie
         #Valid subtypes currently are, for 2Dcolumn:
           #1 (default)
         #Valid subtypes currently are, for 2Dbar:
           #1 (default)
         $psgraph->setSubtype(subtype);

         #set the legend position for graphics with legends (or take the default)
         #valid positions are right (default), bottom and left
         $psgraph->setLegendpos(’position’);

         #set the scale of the graphic
         #all graphics are initially written in Postcript, so they may be scaled to any size without loss of detail.
         #type is not distorted when the graphic is, as in an oval shaped pie
         #the basic size of the graphics are:
           #Pie: 412 points (5.72")
           #Bar: The height is dependent on the number of bars in the data, calculated by:
               #24 + bar height (set by setColumnwidth) * 1.5 + .5 * bar height. The width is 401 points (5.57").
           #Column: The height is 220.75 points (3.07") The width is dependent on the number of columns in the data, calculated by:
                       #72 + column width * number of columns * 1.5 + .5 * column width
         #Horizontal Scale (1 is 100% of the base size):
         $psgraph->setHscale(horizontal scale)
         #Vertical Scale (1 is 100% of the base size):
         $psgraph->setVscale(vertical scale)
         #Set the explode offset in points (default is 12)
         $psgraph->setExplodeoffset(offset in points)

         #Set the column width for column charts or bar height for bar charts or take the default width of 36 points (1/2 inch)
         $psgraph->setColumnwidth

         #Set the number format for column charts or take the default (money)
         #Valid formats: money (whole dollars starting with a $) or d for the number of decimal places.
         #d0 is an integer. d3 creates three decimal places
         $psgraph->setFormat

         #Set the type size for the headers (column and bar charts)
         #The type size is not scaled with the graphic so that uneven scaling of horizontal and vertical dimensions
         #does not skew the type. The headers are in bold type. The default size is 9 point.
         $psgraph->setHeadertype(point size)

         #Set the type color for the headers. Default is black (0 0 0 1) (column and bar charts)
         ##The color is CMKY, entered as 4 numbers between zero and one, space delimited
         $psgraph->setHeadercolor(’C M Y K’)

         #Set the type size for the axis type (column and bar charts)
         #As with the headers, the type size is not scaled with the graphic
         #The default size is 8 points.
         $psgraph->setAxistype(point size)

         #Set the type size for the value type (column and bar charts) and callouts on pies.
         #As with the headers, the type size is not scaled with the graphic
         #The default size is 9 points for column and bar charts. 8 points for callouts on pies.
         $psgraph->setValuetype(point size)

         #Set the grayscale type color for values in bar charts
         #Usually black (0) for light-colored backgrounds and white (1) for dark-color backgrounds
         $psgraph->setValuecolor(grayscale value)

         #Set the background color (column and bar charts)
         #The color is CMKY, entered as 4 numbers between zero and one, space delimited
         #The default color is .3 0 .15 .09 (a light blue).
         $psgraph->setBackgroundcolor(’C M Y K’)

         #Export graphic
         #If you have
         #ImageMagick you can also generate any format that ImageMagick supports using its convert program. By default,
         #any export to a bitmap format (jpg, png, etc.) will be generated at 1200 dpi so that the rasterizaion of the
         #fonts is of good quality. To use one of these formats, set Gexport to the extension of that format:
         $psgraph->setGexport(extension)

         #write the graphic files
         #pies are written to a pies subdirectory, column charts to a column subdirectory and bar charts to a bars subdirectory
         #the subdirectories must be created before running the writeGraphic method
         #the return value is either 1 (for successful completion) or an error.
         #both eps files, and, if Gexport is set, the exported will be in the same directory
         $psgraph->writeGraphic

DESCRIPTION
       PSGRAPH is a module designed for mass creation of data charts for
       printing or on-line use.

       EXPORT

       None by default.

SEE ALSO
AUTHOR
       Ken Owen, 

COPYRIGHT AND LICENSE
       For more details, see the full text of the licenses at http://www.perl-
       foundation.org/artistic_license_2_0

       Copyright (C) 2013-2015 by Ken Owen

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself, either Perl version 5.8.8 or, at
       your option, any later version of Perl 5 you may have available.

       This program is distributed in the hope that it will be useful, but it
       is provided “as is” and without any express or implied warranties.
       For details, see the full text of the license in the file LICENSE.



perl v5.8.8                       2015-07-09                        PSGRAPH(3)


Go back to PSGRAPH page






The Edward Owen Company
529 South Undermountain Road  •  Sheffield, MA  01257