NAME

Liz::Survey::Graph - module for Graph objects of the Survey


SYNOPSIS

 use Liz::Survey;
 $survey = new Liz::Survey;

 $graph = $survey->Graph( $graphID );
 $graph = $survey->Graph;
 $graph->update;


EXAMPLES


DESCRIPTION

Provide object oriented access to graphs in a Survey. Usually not accessed directly, but rather through the Liz::Survey object and its Graph method.


BASIC METHODS


new

Create a new Graph object from a Survey object.

Input Parameters

 1 Liz::Survey object
 2 ID with which to create Graph
   (default: none = new graph)
Output Parameters

 1 instantiated object
Note

It is not intended to call this method directly, but rather indirectly through the Liz::Survey module.

Example

 $survey = new Liz::Survey;
 $graph = $survey->Graph( $graphID );
 $graph = $survey->Graph;


update

Update a Graph object in the Liz::Survey database.

Output Parameters

 1 ID with which the object was updated (undef = error)
Example

 $ID = $graph->update;


delete

Delete a Liz::Survey::Graph object from the database.

Output Parameters

 1 flag: whether action was successful
Example

 $graph->delete;


OBJECT METHODS

The following methods return objects related to the Liz::Survey::Graph object.


Bar

Create a Liz::Survey::Graph::Bar object from the Graph object. Please note that Bar objects created this way, do not need to be updated seperately: whenever update is called of the Graph object, and Bar objects created will first be updated automatically.

Input Parameters

 1 textID of the choice for which to create a Bar object
 2 flag: do not keep in list with object
   (default: keep)
Output Parameters

 1 instantiated Liz::Survey::Graph::Bar object
Example

 $bar = $graph->Bar( $textID );


BarFont

Return the GD font object of the Legenda of the Bars.

Output Parameters

 1 font object associated with BarFontID
Example

 $barfont = $self->BarFont;


FinalPicture

Return the Picture object associated with the already generated final image of this Graph. If there is no final Picture yet, no object will be returned.

Use method update to update the final picture, or use method Generate to just generate the final image.

Output Parameters

 1 current final Picture object
Example

 $finalpicture = $graph->FinalPicture;


Font

Return the GD font object of the Legenda or of a specific FontID.

Input Parameters

 1 fontID of which to return the font object
    (default: fontID of legenda)
Output Parameters

 1 font object associated with FontID
Example

 $font = $self->Font;
 $font = $self->Font( $fontID );


Generate

Generate the final image for this Graph. This is usually not called by itself, but by method update.

Input Parameters

 1 additional SQL to limit the Answers to be counted
Example

 $graph->Generate;
 $graph->Generate( 'status=0' );


Picture

Return the Picture object associated with this Graph. If called when there is no Picture associated with the bar already, a new Picture object will be created automatically and associated with the Graph.

Output Parameters

 1 current/new Picture object
Example

 $picture = $graph->Picture;


Question

Return the Question object associated with this Graph.

Output Parameters

 1 current/new Picture object
Example

 $question = $graph->Question;


CONTENT METHODS

The following methods allow you to inspect and/or change certain fields of the Liz::Survey::Graph object.


Alignment

Set or return the alignment of the Bars in the Liz::Survey::Graph object.

The following values are recognized:

 0 left
 1 middle
 2 right
Input Parameters

 1 new alignment
   (default: no change)
Output Parameters

 1 current/previous alignment
Example

 $graph->Alignment( $alignment );
 $alignment = $graph->Alignment;


BarFontID

Set or return the fontID for the Legenda of the Bars in the Liz::Survey::Graph object.

Input Parameters

 1 new fontID
   (default: no change)
Output Parameters

 1 current/previous fontID
Example

 $graph->BarFontID( $barfontID );
 $barfontID = $graph->BarFontID;


Color

Set the colour of the Legenda of the Graph object.

Input Parameters

 1 new colour's alpha string indicating colour (e.g. 'FFFFF') or amount of Red
 2 new colour's amount of Green
 3 new colour's amount of Blue
Output Parameters

 1 current/prevous colour's alpha string or amount of Red
 2 amount of Green
 3 amount of Blue
Example

 $graph->Color( 'FF00FF' );
 $graph->Color( 255,0,255 );

 ($color) = $graph->Color;
 ($red,$green,$blue) = $graph->Color;


Created

Return the Created timestamp of the Liz::Survey::Graph object.

Output Parameters

 1 current timestamp value of the Created date
Example

 $created = $graph->Created;


Direction

Set or return the direction of the Bars in the Liz::Survey::Graph object.

The following values are recognized:

 0 horizontal
 1 vertical
Input Parameters

 1 new direction
   (default: no change)
Output Parameters

 1 current/previous direction
Example

 $graph->Direction( $direction );
 $direction = $graph->Direction;


FinalPictureID

Return the pictureID of the final picture of the Liz::Survey::Graph object.

Output Parameters

 1 current/previous final pictureID
Example

 $finalpictureID = $graph->FinalPictureID;


FontID

Set or return the fontID for the Legenda in the Liz::Survey::Graph object.

Input Parameters

 1 new fontID
   (default: no change)
Output Parameters

 1 current/previous fontID
Example

 $graph->FontID( $fontID );
 $fontID = $graph->FontID;


ID

Return the ID of the Liz::Survey::Graph object.

Output Parameters

 1 current ID of the object
Example

 $ID = $graph->ID;


Legenda

Set or return the Legenda of the Liz::Survey::Graph object.

Input Parameters

 1 new legenda
   (default: no change)
Output Parameters

 1 current/previous legenda
Example

 $graph->Legenda( $legenda );
 $legenda = $graph->Legenda;


QuestionID

Set or return the questionID of the Liz::Survey::Graph object.

Input Parameters

 1 new questionID
   (default: no change)
Output Parameters

 1 current/previous questionID
Example

 $graph->QuestionID( $questionID );
 $questionID = $graph->QuestionID;


PictureID

Return the pictureID of the base picture of the Liz::Survey::Graph object.

Output Parameters

 1 current base pictureID
Example

 $pictureID = $graph->PictureID;


Sizing

Set or return the alignment of the Bars in the Liz::Survey::Graph object.

The following values are recognized:

 0 crop
 1 shift
Input Parameters

 1 new sizing
   (default: no change)
Output Parameters

 1 current/previous sizing
Example

 $graph->Sizing( $sizing );
 $sizing = $graph->Sizing;


Updated

Return the Updated timestamp of the Liz::Survey::Graph object.

Output Parameters

 1 current timestamp value of the Updated date
Example

 $updated = $graph->Updated;


LIST METHODS

The following methods return lists of different types.


Bars

Return an SQL statement handle for the list of bars of this Graphic object.

The following fields may be specified with the first parameter:

 ID
 The textID of the bar

 legenda
 The legenda (title) of this graph

 pictureID
 The pictureID of the base image for the bar

 width
 The width of the bar in the graph

 height
 The height of the bar in the graph

 sizing
 The sizing of the bars in the graph

 fontID
 The fontID of the font of the legenda
Input Parameters

 1 fields to return (comma delimited)
   (default: 'ID,legenda,pictureID,width,height,sizing,fontID' );
 2 fieldname on which to order the result
   (default: order of choices)
 3 extra condition to be applied
   (default: none)
Output Parameters

 1 SQL statement handle (on which method "fetchrow" can be applied)


HTML METHODS

The following methods return HTML codes for variuous handy things.


FontPulldown

Return the HTML for a Pulldown menu of fonts.

Input Parameters

 1 name of variable in the caller's namespace to match
 2 extra HTML to be added at the beginning
   (default: none)
 3 flag: return pseudo HTML in <PULLDOWN...> form
   (default: real HTML)
 4 flag: do not add empty field at beginning
   (default: add empty field at beginning)
 5 extra condition to be used
   (default: none)
Output Parameters

 1 HTML for the pulldown menu
Example

 <PRINT "$pictureset->FontPulldown( 'fontID' );


AUTHOR

Elizabeth Mattijsen ( lizperl@INC.nl )


COPYRIGHT

(C) 1999 International Network Consultants


HISTORY

Version 0.11, 25 November 1999

Put module name between quotes to fix obscure bug in Perl 5.005x under ModPerl in method Bar.

Version 0.1, 30 September 1999

First version of this true Perl module.