From 45de557795b997eadf8562a34283f982810d1322 Mon Sep 17 00:00:00 2001 From: pmichaud Date: Thu, 5 Nov 2009 23:38:58 +0000 Subject: [PATCH 1/1] Changes the area drawing, so it still uses the full width if there are columns. For lines it made more sense to center them in the columns, for areas that just looks weird. --- lib/Imager/Graph/Vertical.pm | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/Imager/Graph/Vertical.pm b/lib/Imager/Graph/Vertical.pm index 13b1a61..4ebad65 100644 --- a/lib/Imager/Graph/Vertical.pm +++ b/lib/Imager/Graph/Vertical.pm @@ -623,8 +623,6 @@ sub _draw_area { my $area_series = $self->_get_data_series()->{'area'}; my $series_counter = $self->_get_series_counter() || 0; - my $has_columns = (defined $self->_get_data_series()->{'column'} || $self->_get_data_series->{'stacked_column'}) ? 1 : 0; - my $col_width = int($graph_width / $column_count) -1; my $graph_box = $self->_get_graph_box(); @@ -640,13 +638,8 @@ sub _draw_area { my @data = @{$series->{'data'}}; my $data_size = scalar @data; - my $interval; - if ($has_columns) { - $interval = $graph_width / ($data_size); - } - else { - $interval = $graph_width / ($data_size - 1); - } + my $interval = $graph_width / ($data_size - 1); + my $color = $self->_data_color($series_counter); # We need to add these last, otherwise the next line segment will overwrite half of the marker @@ -655,8 +648,6 @@ sub _draw_area { for (my $i = 0; $i < $data_size - 1; $i++) { my $x1 = $left + $i * $interval; - $x1 += $has_columns * $interval / 2; - my $y1 = $bottom + ($value_range - $data[$i] + $min_value)/$value_range * $graph_height; if ($i == 0) { @@ -668,7 +659,6 @@ sub _draw_area { } my $x2 = $left + ($data_size - 1) * $interval; - $x2 += $has_columns * $interval / 2; my $y2 = $bottom + ($value_range - $data[$data_size - 1] + $min_value)/$value_range * $graph_height; push @polygon_points, [$x2, $y2]; -- 2.39.2