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
|
||||
- fix: purging old asset revisions on large sites never completes
|
||||
- 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: Dashboard content positioning field problem
|
||||
- fix: graphing doesn't work with GraphicsMagick
|
||||
|
|
|
|||
|
|
@ -172,33 +172,31 @@ sub drawLabels {
|
|||
my $self = shift;
|
||||
my $location = shift;
|
||||
|
||||
my %anchorPoint = %{$self->getFirstAnchorLocation};# %$location;
|
||||
my %anchorPoint = %{$self->getFirstAnchorLocation};
|
||||
|
||||
# Draw x-axis labels
|
||||
foreach (@{$self->getLabel}) {
|
||||
my $text = $self->wrapLabelToWidth($_, $self->getAnchorSpacing->{x});
|
||||
foreach my $text (@{$self->getLabel}) {
|
||||
$self->drawLabel($text, (
|
||||
alignHorizontal => 'center',
|
||||
alignVertical => 'top',
|
||||
align => 'Center',
|
||||
align => 'left',
|
||||
rotate => 90,
|
||||
x => $anchorPoint{x},
|
||||
y => $anchorPoint{y},
|
||||
));
|
||||
|
||||
$anchorPoint{x} += $self->getAnchorSpacing->{x}; #$groupWidth + $self->getGroupSpacing;
|
||||
$anchorPoint{x} += $self->getAnchorSpacing->{x};
|
||||
$anchorPoint{y} += $self->getAnchorSpacing->{y};
|
||||
}
|
||||
|
||||
# Draw y-axis labels
|
||||
$anchorPoint{x} = $self->getChartOffset->{x} - $self->getLabelOffset;
|
||||
$anchorPoint{y} = $self->getChartOffset->{y} + $self->getChartHeight;
|
||||
# for (1 .. $self->getYRange / $self->getYGranularity) {
|
||||
foreach (@{$self->getYLabels}) {
|
||||
$self->drawLabel($_, (
|
||||
alignHorizontal => 'right',
|
||||
alignVertical => 'center',
|
||||
x => $anchorPoint{x}, #$self->getChartOffset->{x} - $self->getLabelOffset,
|
||||
y => $anchorPoint{y}, #$self->getChartOffset->{y} + $self->getChartHeight - $self->getPixelsPerUnit * $_*$self->getYGranularity,
|
||||
x => $anchorPoint{x},
|
||||
y => $anchorPoint{y},
|
||||
));
|
||||
$anchorPoint{y} -= $self->getPixelsPerUnit * $self->getYGranularity
|
||||
}
|
||||
|
|
@ -244,6 +242,19 @@ sub formNamespace {
|
|||
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 ( )
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use strict;
|
|||
use WebGUI::Image::Graph::XYGraph;
|
||||
use List::Util;
|
||||
use POSIX;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(WebGUI::Image::Graph::XYGraph);
|
||||
|
||||
|
|
@ -250,7 +251,7 @@ sub getAnchorSpacing {
|
|||
|
||||
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 {
|
||||
x => $spacing,
|
||||
|
|
@ -319,7 +320,7 @@ sub getFirstAnchorLocation {
|
|||
my $self = shift;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -344,10 +345,14 @@ sub processDataSet {
|
|||
for my $currentElement (0 .. $maxElements-1) {
|
||||
my @thisSet = ();
|
||||
for my $currentDataset (0 .. $numberOfDatasets - 1) {
|
||||
my $color = $palette->getColor($currentDataset);
|
||||
if ($numberOfDatasets == 1) {
|
||||
$color = $palette->getNextColor;
|
||||
}
|
||||
push(@thisSet, {
|
||||
height => $self->{_datasets}->[$currentDataset]->[$currentElement] || 0,
|
||||
fillColor => $palette->getColor($currentDataset)->getFillColor,
|
||||
strokeColor => $palette->getColor($currentDataset)->getStrokeColor,
|
||||
fillColor => $color->getFillColor,
|
||||
strokeColor => $color->getStrokeColor,
|
||||
});
|
||||
}
|
||||
push(@{$self->{_bars}}, [ @thisSet ]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue