Liz::Survey::Graph - module for Graph objects of the Survey
use Liz::Survey; $survey = new Liz::Survey;
$graph = $survey->Graph( $graphID ); $graph = $survey->Graph; $graph->update;
Provide object oriented access to graphs in a Survey. Usually not accessed directly, but rather through the Liz::Survey object and its Graph method.
Create a new Graph object from a Survey object.
1 Liz::Survey object 2 ID with which to create Graph (default: none = new graph)
1 instantiated object
It is not intended to call this method directly, but rather indirectly through the Liz::Survey module.
$survey = new Liz::Survey; $graph = $survey->Graph( $graphID ); $graph = $survey->Graph;
Update a Graph object in the Liz::Survey database.
1 ID with which the object was updated (undef = error)
$ID = $graph->update;
Delete a Liz::Survey::Graph object from the database.
1 flag: whether action was successful
$graph->delete;
The following methods return objects related to the Liz::Survey::Graph object.
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.
1 textID of the choice for which to create a Bar object 2 flag: do not keep in list with object (default: keep)
1 instantiated Liz::Survey::Graph::Bar object
$bar = $graph->Bar( $textID );
Return the GD font object of the Legenda of the Bars.
1 font object associated with BarFontID
$barfont = $self->BarFont;
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.
1 current final Picture object
$finalpicture = $graph->FinalPicture;
Return the GD font object of the Legenda or of a specific FontID.
1 fontID of which to return the font object
(default: fontID of legenda)
1 font object associated with FontID
$font = $self->Font; $font = $self->Font( $fontID );
Generate the final image for this Graph. This is usually not called by itself, but by method update.
1 additional SQL to limit the Answers to be counted
$graph->Generate; $graph->Generate( 'status=0' );
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.
1 current/new Picture object
$picture = $graph->Picture;
Return the Question object associated with this Graph.
1 current/new Picture object
$question = $graph->Question;
The following methods allow you to inspect and/or change certain fields of the Liz::Survey::Graph object.
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
1 new alignment (default: no change)
1 current/previous alignment
$graph->Alignment( $alignment ); $alignment = $graph->Alignment;
Set or return the fontID for the Legenda of the Bars in the Liz::Survey::Graph object.
1 new fontID (default: no change)
1 current/previous fontID
$graph->BarFontID( $barfontID ); $barfontID = $graph->BarFontID;
Set the colour of the Legenda of the Graph object.
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
1 current/prevous colour's alpha string or amount of Red 2 amount of Green 3 amount of Blue
$graph->Color( 'FF00FF' ); $graph->Color( 255,0,255 );
($color) = $graph->Color; ($red,$green,$blue) = $graph->Color;
Return the Created timestamp of the Liz::Survey::Graph object.
1 current timestamp value of the Created date
$created = $graph->Created;
Set or return the direction of the Bars in the Liz::Survey::Graph object.
The following values are recognized:
0 horizontal 1 vertical
1 new direction (default: no change)
1 current/previous direction
$graph->Direction( $direction ); $direction = $graph->Direction;
Return the pictureID of the final picture of the Liz::Survey::Graph object.
1 current/previous final pictureID
$finalpictureID = $graph->FinalPictureID;
Set or return the fontID for the Legenda in the Liz::Survey::Graph object.
1 new fontID (default: no change)
1 current/previous fontID
$graph->FontID( $fontID ); $fontID = $graph->FontID;
Return the ID of the Liz::Survey::Graph object.
1 current ID of the object
$ID = $graph->ID;
Set or return the Legenda of the Liz::Survey::Graph object.
1 new legenda (default: no change)
1 current/previous legenda
$graph->Legenda( $legenda ); $legenda = $graph->Legenda;
Set or return the questionID of the Liz::Survey::Graph object.
1 new questionID (default: no change)
1 current/previous questionID
$graph->QuestionID( $questionID ); $questionID = $graph->QuestionID;
Return the pictureID of the base picture of the Liz::Survey::Graph object.
1 current base pictureID
$pictureID = $graph->PictureID;
Set or return the alignment of the Bars in the Liz::Survey::Graph object.
The following values are recognized:
0 crop 1 shift
1 new sizing (default: no change)
1 current/previous sizing
$graph->Sizing( $sizing ); $sizing = $graph->Sizing;
Return the Updated timestamp of the Liz::Survey::Graph object.
1 current timestamp value of the Updated date
$updated = $graph->Updated;
The following methods return lists of different types.
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
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)
1 SQL statement handle (on which method "fetchrow" can be applied)
The following methods return HTML codes for variuous handy things.
Return the HTML for a Pulldown menu of fonts.
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)
1 HTML for the pulldown menu
<PRINT "$pictureset->FontPulldown( 'fontID' );
Elizabeth Mattijsen ( lizperl@INC.nl )
(C) 1999 International Network Consultants
Put module name between quotes to fix obscure bug in Perl 5.005x under ModPerl in method Bar.
First version of this true Perl module.