Colors in bar graph now cycle through the palette like pie chart.
- fix: Graphing with Graphics Magick Bungled ( fixed line and bar problems, not pie problems)
This commit is contained in:
parent
458167b34c
commit
e6eb07565b
3 changed files with 32 additions and 13 deletions
|
|
@ -4,6 +4,9 @@
|
||||||
- Clean up orphaned grouping
|
- Clean up orphaned grouping
|
||||||
- fix: purging old asset revisions on large sites never completes
|
- fix: purging old asset revisions on large sites never completes
|
||||||
- fix: Can't add assets when not using preload.perl.
|
- fix: Can't add assets when not using preload.perl.
|
||||||
|
- Colors in bar graph now cycle through the palette like pie chart.
|
||||||
|
- fix: Graphing with Graphics Magick Bungled ( fixed line and bar problems,
|
||||||
|
not pie problems)
|
||||||
- fix: wiki recent
|
- fix: wiki recent
|
||||||
- fix: Dashboard content positioning field problem
|
- fix: Dashboard content positioning field problem
|
||||||
- fix: graphing doesn't work with GraphicsMagick
|
- fix: graphing doesn't work with GraphicsMagick
|
||||||
|
|
|
||||||
|
|
@ -172,33 +172,31 @@ sub drawLabels {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $location = shift;
|
my $location = shift;
|
||||||
|
|
||||||
my %anchorPoint = %{$self->getFirstAnchorLocation};# %$location;
|
my %anchorPoint = %{$self->getFirstAnchorLocation};
|
||||||
|
|
||||||
# Draw x-axis labels
|
# Draw x-axis labels
|
||||||
foreach (@{$self->getLabel}) {
|
foreach my $text (@{$self->getLabel}) {
|
||||||
my $text = $self->wrapLabelToWidth($_, $self->getAnchorSpacing->{x});
|
|
||||||
$self->drawLabel($text, (
|
$self->drawLabel($text, (
|
||||||
alignHorizontal => 'center',
|
|
||||||
alignVertical => 'top',
|
alignVertical => 'top',
|
||||||
align => 'Center',
|
align => 'left',
|
||||||
|
rotate => 90,
|
||||||
x => $anchorPoint{x},
|
x => $anchorPoint{x},
|
||||||
y => $anchorPoint{y},
|
y => $anchorPoint{y},
|
||||||
));
|
));
|
||||||
|
|
||||||
$anchorPoint{x} += $self->getAnchorSpacing->{x}; #$groupWidth + $self->getGroupSpacing;
|
$anchorPoint{x} += $self->getAnchorSpacing->{x};
|
||||||
$anchorPoint{y} += $self->getAnchorSpacing->{y};
|
$anchorPoint{y} += $self->getAnchorSpacing->{y};
|
||||||
}
|
}
|
||||||
|
|
||||||
# Draw y-axis labels
|
# Draw y-axis labels
|
||||||
$anchorPoint{x} = $self->getChartOffset->{x} - $self->getLabelOffset;
|
$anchorPoint{x} = $self->getChartOffset->{x} - $self->getLabelOffset;
|
||||||
$anchorPoint{y} = $self->getChartOffset->{y} + $self->getChartHeight;
|
$anchorPoint{y} = $self->getChartOffset->{y} + $self->getChartHeight;
|
||||||
# for (1 .. $self->getYRange / $self->getYGranularity) {
|
|
||||||
foreach (@{$self->getYLabels}) {
|
foreach (@{$self->getYLabels}) {
|
||||||
$self->drawLabel($_, (
|
$self->drawLabel($_, (
|
||||||
alignHorizontal => 'right',
|
alignHorizontal => 'right',
|
||||||
alignVertical => 'center',
|
alignVertical => 'center',
|
||||||
x => $anchorPoint{x}, #$self->getChartOffset->{x} - $self->getLabelOffset,
|
x => $anchorPoint{x},
|
||||||
y => $anchorPoint{y}, #$self->getChartOffset->{y} + $self->getChartHeight - $self->getPixelsPerUnit * $_*$self->getYGranularity,
|
y => $anchorPoint{y},
|
||||||
));
|
));
|
||||||
$anchorPoint{y} -= $self->getPixelsPerUnit * $self->getYGranularity
|
$anchorPoint{y} -= $self->getPixelsPerUnit * $self->getYGranularity
|
||||||
}
|
}
|
||||||
|
|
@ -244,6 +242,19 @@ sub formNamespace {
|
||||||
return $self->SUPER::formNamespace.'_XYGraph';
|
return $self->SUPER::formNamespace.'_XYGraph';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 getAnchorSpacing ()
|
||||||
|
|
||||||
|
This method MUST be overridden by all sub classes.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub getAnchorSpacing {
|
||||||
|
die "You were supposed to override this method in the sub class.";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getAxisColor ( )
|
=head2 getAxisColor ( )
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ use strict;
|
||||||
use WebGUI::Image::Graph::XYGraph;
|
use WebGUI::Image::Graph::XYGraph;
|
||||||
use List::Util;
|
use List::Util;
|
||||||
use POSIX;
|
use POSIX;
|
||||||
|
use WebGUI::Utility;
|
||||||
|
|
||||||
our @ISA = qw(WebGUI::Image::Graph::XYGraph);
|
our @ISA = qw(WebGUI::Image::Graph::XYGraph);
|
||||||
|
|
||||||
|
|
@ -250,7 +251,7 @@ sub getAnchorSpacing {
|
||||||
|
|
||||||
my $numberOfGroups = List::Util::max(map {scalar @$_} @{$self->getDataset});
|
my $numberOfGroups = List::Util::max(map {scalar @$_} @{$self->getDataset});
|
||||||
|
|
||||||
my $spacing = ($self->getChartWidth - ($numberOfGroups-1) * $self->getGroupSpacing) / $numberOfGroups + $self->getGroupSpacing;
|
my $spacing = round(($self->getChartWidth - ($numberOfGroups-1) * $self->getGroupSpacing) / $numberOfGroups + $self->getGroupSpacing);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
x => $spacing,
|
x => $spacing,
|
||||||
|
|
@ -319,7 +320,7 @@ sub getFirstAnchorLocation {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
x => $self->getChartOffset->{x} + ($self->getAnchorSpacing->{x} - $self->getGroupSpacing) / 2,
|
x => round($self->getChartOffset->{x} + ($self->getAnchorSpacing->{x} - $self->getGroupSpacing) / 2),
|
||||||
y => $self->getChartOffset->{y} + $self->getChartHeight
|
y => $self->getChartOffset->{y} + $self->getChartHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -344,10 +345,14 @@ sub processDataSet {
|
||||||
for my $currentElement (0 .. $maxElements-1) {
|
for my $currentElement (0 .. $maxElements-1) {
|
||||||
my @thisSet = ();
|
my @thisSet = ();
|
||||||
for my $currentDataset (0 .. $numberOfDatasets - 1) {
|
for my $currentDataset (0 .. $numberOfDatasets - 1) {
|
||||||
|
my $color = $palette->getColor($currentDataset);
|
||||||
|
if ($numberOfDatasets == 1) {
|
||||||
|
$color = $palette->getNextColor;
|
||||||
|
}
|
||||||
push(@thisSet, {
|
push(@thisSet, {
|
||||||
height => $self->{_datasets}->[$currentDataset]->[$currentElement] || 0,
|
height => $self->{_datasets}->[$currentDataset]->[$currentElement] || 0,
|
||||||
fillColor => $palette->getColor($currentDataset)->getFillColor,
|
fillColor => $color->getFillColor,
|
||||||
strokeColor => $palette->getColor($currentDataset)->getStrokeColor,
|
strokeColor => $color->getStrokeColor,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
push(@{$self->{_bars}}, [ @thisSet ]);
|
push(@{$self->{_bars}}, [ @thisSet ]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue