Skip Menu |

This queue is for tickets about the GDGraph CPAN distribution.

Maintainer(s)' notes

There are plenty of good ideas of what people can do published here on the queue. Turning a patch from the tracker into a pull request is not one of them. In order to get maintainers' attention way more quickier, PR should have at least a sample included. We know it's hard to test images generating software, but it doesn't mean we can not test numbers produced by intermediate algorithms used to generate these images, so either a test or a sample.

Report information
The Basics
Id: 6751
Status: open
Priority: 0/
Queue: GDGraph

People
Owner: bwarfield [...] cpan.org
Requestors: cantzler [...] uiuc.edu
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.43
Fixed in: (no value)



Subject: Make bars displayed at specified x value
This is basically what this fix does: Old bar graph of values (1, 3, 4, 7), (1, 3, 3, 1) would look like this | | || | || ||||| +---------- After the patch it should look like: | | || | || | | || | +---------- I'm basically wondering if a flag can be added somehow to switch between the old functionality and this new one. Here's the code change in bars.pm: # get coordinates of top and center of bar - my ($xp, $t) = $self->val_to_pixel($i + 1, $value, $ds); +# my ($xp, $t) = $self->val_to_pixel($i + 1, $value, $ds); + my ($xp, $t) = $self->val_to_pixel($self->{_data}->get_x($i), $value, $ds); Thanks
--- /tmp/old/bars.pm Thu Jun 24 20:35:12 2004 +++ /tmp/new/bars.pm Thu Jun 24 20:26:19 2004 @@ -251,7 +251,8 @@ if $self->{cycle_clrs} > 1; # get coordinates of top and center of bar - my ($xp, $t) = $self->val_to_pixel($i + 1, $value, $ds); +# my ($xp, $t) = $self->val_to_pixel($i + 1, $value, $ds); + my ($xp, $t) = $self->val_to_pixel($self->{_data}->get_x($i), $value, $ds); # calculate left and right of bar my ($l, $r);
Subject: Adjusted bar width when using numerical axis
Distribution: RedHat 7.3, package installed via CPAN Perl version: 5.6.1 This patch includes a better fix from Bug 6751 http://rt.cpan.org/NoAuth/Bug.html?id=6751 If x_tick_number is set, this patch helps draw bars more numerically. The Problem: Try drawing bars on a 600x300 (w x h) image x_values (176,184,192,200,208,216,232,240) y_values ( 1, 2, 3, 1, 2, 2, 2, 1) set (x_min, x_max) = (0, 400); The bars will either be one pixel thick or not display at all. With an (x_min, x_max) of (0, 1000) bars are rarely displayed The Fix: Before drawing the bars, calculate the minimum difference between the bars. x_step is multiplied by this min_diff to correct the bar width. In the case above, the minimum difference is 8. So the bars will be adjusted 4 points left/right. I've tried to preserve this fix from causing any problems for non-numerical graphs, but I have not tested this change with any non-numerical graphs.
--- GDGraph-1.43/Graph/bars.pm Tue Jun 10 19:43:49 2003 +++ /usr/lib/perl5/site_perl/5.6.1/GD/Graph/bars.pm Sat Aug 7 13:38:52 2004 @@ -232,6 +232,28 @@ my $topvalues = $self->_top_values; + # FIX BAR WIDTH + my $adj_x_step = $self->{x_step}; + + if (defined $self->{x_tick_number}) { + my @x_values = $self->{_data}->x_values($ds) or + return $self->_set_error("Impossible illegal data set: $ds", + $self->{_data}->error); + + @x_values = sort { $b <=> $a } @x_values; + + my $min_diff = undef; + for (my $i = 1; $i < @x_values; $i++) + { + my $diff = ($x_values[$i-1] - $x_values[$i]); + $min_diff = $diff if (!(defined $min_diff) || + (($diff < $min_diff) && ($diff > 0))); + } + + $adj_x_step = $adj_x_step * $min_diff; + } + # END FIX BAR WIDTH + for (my $i = 0; $i < @values; $i++) { my $value = $values[$i]; @@ -251,25 +273,31 @@ if $self->{cycle_clrs} > 1; # get coordinates of top and center of bar - my ($xp, $t) = $self->val_to_pixel($i + 1, $value, $ds); + # use x_value if x_tick_number is defined + my ($xp, $t); + if (defined $self->{x_tick_number}) { + ($xp, $t) = $self->val_to_pixel($self->{_data}->get_x($i), $value, $ds); + } else { + ($xp, $t) = $self->val_to_pixel($i + 1, $value, $ds); + } # calculate left and right of bar my ($l, $r); if (ref $self eq 'GD::Graph::mixed' || $self->{overwrite}) { - $l = $xp - $self->{x_step}/2 + $bar_s + 1; - $r = $xp + $self->{x_step}/2 - $bar_s; + $l = $xp - $adj_x_step/2 + $bar_s + 1; + $r = $xp + $adj_x_step/2 - $bar_s; } else { $l = $xp - - $self->{x_step}/2 - + ($ds - 1) * $self->{x_step}/$self->{_data}->num_sets + - $adj_x_step/2 + + ($ds - 1) * $adj_x_step/$self->{_data}->num_sets + $bar_s + 1; $r = $xp - - $self->{x_step}/2 - + $ds * $self->{x_step}/$self->{_data}->num_sets + - $adj_x_step/2 + + $ds * $adj_x_step/$self->{_data}->num_sets - $bar_s; }
Subject: New GD::Graph co-maintainer and new release on CPAN
Hello, You recieved this message as you filed a bug report or feature request against GD::Graph module on CPAN. My name is Ruslan and I'm new co-maintainer of the module. I've updated the module to 1.45 with doc changes and released it to CPAN. See distribution status [1]. I have TODO list for several releases, so if your ticket was a patch then turning it into a nice pull request may expedite inclusion :) [1] http://search.cpan.org/~ruz/GDGraph-1.45/Graph.pm#DISTRIBUTION_STATUS -- Best regards, Ruslan.