POD whitespace fixes
This commit is contained in:
parent
684f08649d
commit
5cb101af44
8 changed files with 228 additions and 170 deletions
|
|
@ -32,6 +32,7 @@ These methods are available from this class:
|
|||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 configurationForm
|
||||
|
||||
The configuration form part for this object. See WebGUI::Image::Graph for
|
||||
|
|
@ -44,9 +45,9 @@ sub configurationForm {
|
|||
my $self = shift;
|
||||
|
||||
my $i18n = WebGUI::International->new($self->session, 'Image_Graph_XYGraph');
|
||||
|
||||
|
||||
$configForms = $self->SUPER::configurationForm;
|
||||
|
||||
|
||||
$f = WebGUI::HTMLForm->new($self->session);
|
||||
$f->trClass('Graph_XYGraph');
|
||||
$f->integer(
|
||||
|
|
@ -108,12 +109,13 @@ sub configurationForm {
|
|||
label => $i18n->get('y granularity'),
|
||||
hoverHelp => $i18n->get('y granularity description'),
|
||||
);
|
||||
|
||||
|
||||
$configForms->{'graph_xygraph'} = $f->printRowsOnly;
|
||||
return $configForms;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 draw
|
||||
|
||||
Draws the graph.
|
||||
|
|
@ -129,7 +131,7 @@ sub draw {
|
|||
x=> $maxYLabelWidth + 2*$self->getLabelOffset,
|
||||
y=> $self->getLabelOffset
|
||||
});
|
||||
|
||||
|
||||
$self->drawRulers if ($self->showRulers);
|
||||
$self->drawGraph;
|
||||
$self->drawAxis if ($self->showAxis);
|
||||
|
|
@ -137,6 +139,7 @@ sub draw {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawAxis
|
||||
|
||||
Draws the axis.
|
||||
|
|
@ -158,6 +161,7 @@ sub drawAxis {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawLabels
|
||||
|
||||
Draws the labels.
|
||||
|
|
@ -201,6 +205,7 @@ sub drawLabels {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head drawRulers
|
||||
|
||||
Draws the rulers.
|
||||
|
|
@ -225,6 +230,7 @@ sub drawRulers {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 formNamespace
|
||||
|
||||
Extends the form namespace for this object. See WebGUI::Image::Graph for
|
||||
|
|
@ -239,6 +245,7 @@ sub formNamespace {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAxisColor
|
||||
|
||||
Returns the color triplet for the axis. Defaults to '#222222'.
|
||||
|
|
@ -250,8 +257,9 @@ sub getAxisColor {
|
|||
|
||||
return $self->{_axisProperties}->{axisColor} || '#222222';
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getChartHeight
|
||||
|
||||
Returns the height of the chart. Defaults to 200.
|
||||
|
|
@ -265,6 +273,7 @@ sub getChartHeight {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getChartOffset
|
||||
|
||||
Returns the coordinates of the top-left corner of the chart. he coordinates are
|
||||
|
|
@ -279,6 +288,7 @@ sub getChartOffset {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getChartWidth
|
||||
|
||||
Returns the width of the chart. Defaults to 200.
|
||||
|
|
@ -292,6 +302,7 @@ sub getChartWidth {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getConfiguration
|
||||
|
||||
Returns a configuration hashref. See WebGUI::Image::Graph for documentation.
|
||||
|
|
@ -310,11 +321,12 @@ sub getConfiguration {
|
|||
$config->{xyGraph_drawRulers} = $self->showRulers;
|
||||
$config->{xyGraph_drawMode} = $self->getDrawMode;
|
||||
$config->{xyGraph_yGranularity} = $self->getYGranularity;
|
||||
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDrawMode
|
||||
|
||||
Returns the drawmode. Currently supported are 'stacked' and 'sideBySide'.
|
||||
|
|
@ -329,6 +341,7 @@ sub getDrawMode {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPixelsPerUnit
|
||||
|
||||
Returns the number of pixels that correspond with one unit of the dataset
|
||||
|
|
@ -338,11 +351,12 @@ values.
|
|||
|
||||
sub getPixelsPerUnit {
|
||||
my $self = shift;
|
||||
|
||||
|
||||
return $self->getChartHeight / $self->getYRange;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getRulerColor
|
||||
|
||||
Returns the color triplet of the rulers in the graph. Defaults to '#777777'.
|
||||
|
|
@ -356,6 +370,7 @@ sub getRulerColor {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getYGranularity
|
||||
|
||||
Returns the granularity of the labels and rulers in the Y direction. Defaults to
|
||||
|
|
@ -371,6 +386,7 @@ sub getYGranularity {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getYLabels
|
||||
|
||||
Returns an arrayref containing the labels for the Y axis.
|
||||
|
|
@ -389,6 +405,7 @@ sub getYLabels {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getYRange
|
||||
|
||||
Returns the maxmimal value of the range that contains a whole number of times
|
||||
|
|
@ -403,6 +420,7 @@ sub getYRange {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setAxisColor ( color )
|
||||
|
||||
Sets the color of the axis to the supplied value.
|
||||
|
|
@ -417,11 +435,12 @@ form: #ffffff.
|
|||
sub setAxisColor {
|
||||
my $self = shift;
|
||||
my $color = shift;
|
||||
|
||||
|
||||
$self->{_axisProperties}->{axisColor} = $color;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setChartHeight ( height )
|
||||
|
||||
Sets the height of the chart to the specified value.
|
||||
|
|
@ -440,6 +459,7 @@ sub setChartHeight {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setChartOffset ( location )
|
||||
|
||||
Sets the location of the top-left corner of the graph within the image.
|
||||
|
|
@ -459,6 +479,7 @@ sub setChartOffset {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setChartHeight ( width )
|
||||
|
||||
Sets the width of the chart to the specified value.
|
||||
|
|
@ -477,6 +498,7 @@ sub setChartWidth {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setConfiguration ( config )
|
||||
|
||||
Applies the settings in the given configuration hash. See WebGUI::Image::Graph
|
||||
|
|
@ -503,11 +525,12 @@ sub setConfiguration {
|
|||
$self->setYGranularity($config->{xyGraph_yGranularity});
|
||||
$self->setAxisColor($config->{xyGraph_axisColor});
|
||||
$self->setRulerColor($config->{xyGraph_rulerColor});
|
||||
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setDrawMode ( mode )
|
||||
|
||||
Set the way the datasets are drawn. Currently supported are 'stacked' and
|
||||
|
|
@ -532,6 +555,7 @@ sub setDrawMode {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setRulerColor ( color )
|
||||
|
||||
Set the color of the rulers.
|
||||
|
|
@ -546,11 +570,12 @@ The triplet of the desired ruler color. Must be in the following format:
|
|||
sub setRulerColor {
|
||||
my $self = shift;
|
||||
my $color = shift;
|
||||
|
||||
|
||||
$self->{_axisProperties}->{rulerColor} = $color;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setShowAxis ( boolean )
|
||||
|
||||
Set whether or not to draw the axis.
|
||||
|
|
@ -569,6 +594,7 @@ sub setShowAxis {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setShowLabels ( boolean )
|
||||
|
||||
Set whether or not to draw the labels.
|
||||
|
|
@ -587,6 +613,7 @@ sub setShowLabels {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setShowRulers ( boolean )
|
||||
|
||||
Set whether or not to draw the rulers.
|
||||
|
|
@ -605,6 +632,7 @@ sub setShowRulers {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setYGranularity ( value )
|
||||
|
||||
Sets the y granularity. See getYGranularity for explanation of this concept.
|
||||
|
|
@ -618,11 +646,12 @@ The granularity in dataset units, not pixels.
|
|||
sub setYGranularity {
|
||||
my $self = shift;
|
||||
my $granularity = shift;
|
||||
|
||||
|
||||
$self->{_properties}->{yGranularity} = $granularity;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 showAxis
|
||||
|
||||
Returns a boolean indicating whether to draw the axis.
|
||||
|
|
@ -637,6 +666,7 @@ sub showAxis {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 showLabels
|
||||
|
||||
Returns a boolean indicating whether to draw the labels.
|
||||
|
|
@ -651,6 +681,7 @@ sub showLabels {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 showRulers
|
||||
|
||||
Returns a boolean indicating whether to draw the rulers.
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ These methods are available from this class:
|
|||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 configurationForm
|
||||
|
||||
Creates the configuration form for this plugin. See WebGUI::Image::Graph for
|
||||
|
|
@ -48,7 +49,7 @@ sub configurationForm {
|
|||
my $self = shift;
|
||||
|
||||
my $i18n = WebGUI::International->new($self->session, 'Image_Graph_XYGraph_Bar');
|
||||
|
||||
|
||||
my $configForms = $self->SUPER::configurationForm;
|
||||
my $f = WebGUI::HTMLForm->new($self->session);
|
||||
$f->trClass('Graph_XYGraph_Bar');
|
||||
|
|
@ -66,11 +67,12 @@ my $f = WebGUI::HTMLForm->new($self->session);
|
|||
);
|
||||
|
||||
$configForms->{'graph_xygraph_bar'} = $f->printRowsOnly;
|
||||
|
||||
|
||||
return $configForms;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawBar ( bar, location, barWidth )
|
||||
|
||||
Draws a bar defined by bar and with width barWidth at location.
|
||||
|
|
@ -98,7 +100,7 @@ sub drawBar {
|
|||
my $barWidth = shift;
|
||||
|
||||
my $barHeight = $bar->{height} * $self->getPixelsPerUnit;
|
||||
|
||||
|
||||
$self->image->Draw(
|
||||
primitive => 'Path',
|
||||
stroke => $bar->{strokeColor},
|
||||
|
|
@ -112,6 +114,7 @@ sub drawBar {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawGraph
|
||||
|
||||
Draws all the bars.
|
||||
|
|
@ -130,7 +133,7 @@ sub drawGraph {
|
|||
|
||||
my $barWidth = $groupWidth;
|
||||
$barWidth = ($groupWidth - ($numberOfDatasets - 1) * $self->getBarSpacing) / $numberOfDatasets if ($self->getDrawMode eq 'sideBySide');
|
||||
|
||||
|
||||
$location{x} = $self->getChartOffset->{x} ;
|
||||
$location{y} = $self->getChartOffset->{y} + $self->getChartHeight;
|
||||
foreach $currentBar (@{$self->{_bars}}) {
|
||||
|
|
@ -139,12 +142,13 @@ sub drawGraph {
|
|||
} else {
|
||||
$self->drawSideBySideBar($currentBar, \%location, $barWidth);
|
||||
}
|
||||
|
||||
|
||||
$location{x} += $groupWidth + $self->getGroupSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawSideBySide ( bars, location, barWidth )
|
||||
|
||||
Draws the bars in side by side mode. Meaning that per datsetindex the bars
|
||||
|
|
@ -172,7 +176,7 @@ sub drawSideBySideBar {
|
|||
my $barWidth = shift;
|
||||
|
||||
my %thisLocation = %$location;
|
||||
|
||||
|
||||
foreach (@$bars) {
|
||||
$self->drawBar($_, \%thisLocation, $barWidth);
|
||||
$thisLocation{x} += $barWidth + $self->getBarSpacing;
|
||||
|
|
@ -180,6 +184,7 @@ sub drawSideBySideBar {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawStacked ( bars, location, barWidth )
|
||||
|
||||
Draws the bars in side by side mode. Meaning that per datset-index the bars
|
||||
|
|
@ -213,10 +218,11 @@ sub drawStackedBar {
|
|||
$self->drawBar($_, \%thisLocation, $barWidth);
|
||||
$thisLocation{y} -= $_->{height} * $self->getPixelsPerUnit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 formNamespace
|
||||
|
||||
Returns the form namespace of this plugin. See WegBUI::Image::Graph for
|
||||
|
|
@ -231,6 +237,7 @@ sub formNamespace {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAnchorSpacing
|
||||
|
||||
Returns the distance in pixels between two anchors on the x axis that define teh
|
||||
|
|
@ -252,6 +259,7 @@ sub getAnchorSpacing {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getBarSpacing
|
||||
|
||||
Returns the width of the gap between two bars within a group in pixels.
|
||||
|
|
@ -265,6 +273,7 @@ sub getBarSpacing {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getConfiguration
|
||||
|
||||
Returns the configuration hashref for this plugin. Refer to WebGUI::IMage::Graph
|
||||
|
|
@ -279,11 +288,12 @@ sub getConfiguration {
|
|||
|
||||
$config->{xyGraph_bar_barSpacing} = $self->getBarSpacing;
|
||||
$config->{xyGraph_bar_groupSpacing} = $self->getGroupSpacing;
|
||||
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getGroupSpacing
|
||||
|
||||
Returns the width of the gap between two groups of bars in pixels.
|
||||
|
|
@ -297,6 +307,7 @@ sub getGroupSpacing {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFirstAnchorLocation
|
||||
|
||||
Returns a hashref containing the location of the leftmost x-axis anchor.
|
||||
|
|
@ -314,6 +325,7 @@ sub getFirstAnchorLocation {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 processDataset
|
||||
|
||||
Processes the dataset. Used by drawGraph.
|
||||
|
|
@ -325,7 +337,7 @@ sub processDataSet {
|
|||
my $self = shift;
|
||||
|
||||
my $palette = $self->getPalette;
|
||||
|
||||
|
||||
my $maxElements = List::Util::max(map {scalar @$_} @{$self->{_datasets}});
|
||||
my $numberOfDatasets = scalar @{$self->{_datasets}};
|
||||
|
||||
|
|
@ -343,6 +355,7 @@ sub processDataSet {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setBarSpacing ( gap )
|
||||
|
||||
Sets the distance between two bars in a group in pixels.
|
||||
|
|
@ -356,11 +369,12 @@ The distance in pixels.
|
|||
sub setBarSpacing {
|
||||
my $self = shift;
|
||||
my $gap = shift;
|
||||
|
||||
|
||||
$self->{_barProperties}->{barSpacing} = $gap;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setConfiguration ( config )
|
||||
|
||||
Applies the given configuration hash to this plugin. See WebGUI::Image::Graph
|
||||
|
|
@ -380,11 +394,12 @@ sub setConfiguration {
|
|||
|
||||
$self->setBarSpacing($config->{xyGraph_bar_barSpacing});
|
||||
$self->setGroupSpacing($config->{xyGraph_bar_groupSpacing});
|
||||
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setGroupSpacing ( gap )
|
||||
|
||||
Sets the distance between two groups of bars in pixels.
|
||||
|
|
@ -398,7 +413,7 @@ The distance in pixels.
|
|||
sub setGroupSpacing {
|
||||
my $self = shift;
|
||||
my $gap = shift;
|
||||
|
||||
|
||||
$self->{_barProperties}->{groupSpacing} = $gap;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ These methods are available from this class:
|
|||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawGraph
|
||||
|
||||
Draws all the lines.
|
||||
|
|
@ -43,7 +44,7 @@ sub drawGraph {
|
|||
|
||||
my $numberOfGroups = List::Util::max(map {scalar @$_} @{$self->{_datasets}});
|
||||
my $interval = $self->getChartWidth / ($numberOfGroups - 1);
|
||||
|
||||
|
||||
%location = %{$self->getChartOffset};
|
||||
$location{y} += $self->getChartHeight;
|
||||
|
||||
|
|
@ -53,6 +54,7 @@ sub drawGraph {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawLine ( line, location, interval )
|
||||
|
||||
Draws a bar defined by bar and with width barWidth at location.
|
||||
|
|
@ -89,10 +91,10 @@ sub drawLine {
|
|||
foreach (@{$line->{dataset}}) {
|
||||
$path .= ($dataCounter++) ? " L " : " M ";
|
||||
$path .= $currentLocation{x}.",".($currentLocation{y} - $_*$self->getPixelsPerUnit);
|
||||
|
||||
|
||||
$currentLocation{x} += $interval;
|
||||
}
|
||||
|
||||
|
||||
$self->image->Draw(
|
||||
primitive => 'Path',
|
||||
stroke => $line->{strokeColor},
|
||||
|
|
@ -102,6 +104,7 @@ sub drawLine {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 formNamespace
|
||||
|
||||
Returns the form namespace of this plugin. See WegBUI::Image::Graph for
|
||||
|
|
@ -116,6 +119,7 @@ sub formNamespace {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAnchorSpacing
|
||||
|
||||
Returns the distance in pixels between two anchors on the x axis that define teh
|
||||
|
|
@ -137,6 +141,7 @@ sub getAnchorSpacing {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFirstAnchorLocation
|
||||
|
||||
Returns a hashref containing the location of the leftmost x-axis anchor.
|
||||
|
|
@ -154,6 +159,7 @@ sub getFirstAnchorLocation {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 processDataset
|
||||
|
||||
Processes the dataset. Used by drawGraph.
|
||||
|
|
@ -163,7 +169,7 @@ Processes the dataset. Used by drawGraph.
|
|||
sub processDataSet {
|
||||
my ($barProperties);
|
||||
my $self = shift;
|
||||
|
||||
|
||||
my $palette = $self->getPalette;
|
||||
foreach (@{$self->{_datasets}}) {
|
||||
push (@{$self->{_lines}}, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue