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: 27160
Status: open
Priority: 0/
Queue: GDGraph

People
Owner: bwarfield [...] cpan.org
Requestors: porterde [...] cs.utexas.edu
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in:
  • 1.43
  • 1.4305
  • 1.4306
  • 1.4307
  • 1.4308
  • 1.44
Fixed in: (no value)



Subject: PATCH - reverse legend order in cumulative graphs
Hi, I recently used GD::Graph to create a cumulative (stacked) bar graph and got the feedback that the legend appeared in the opposite order of the bars, which readers find visually disturbing. This makes sense to me that it is better to see the legend fields in the same order they appear in the stack of bars. Attached is a patch that changes this behavior for if the cumulate attribute is true. It may make sense to just have this as a parameter instead. I have also attached a simple script that generates a graph that illustrates my point. Let me know what you think about this feature, and thanks in advance for your time and consideration, Don --- System info, for completeness ----- This seems to be present in all versions of GD::Graph that support cumulate. The patch is against 1.44. I tested this on perl, v5.8.8 built for i486-linux-gnu-thread-multi on an x86 Ubuntu (edgy) system running the 2.6.17-11-generic kernel.
Subject: graph-test.pl
#!/usr/bin/perl use strict; use warnings; use lib '.'; use GD; use GD::Graph::bars; # Make the graph ################## my $graph = GD::Graph::bars->new(400,300); # Reorganize the data my @data = ( ["A", "B"], [2, 4], [4, 2] ); # Set the options $graph->set( x_label => 'Benchmark', y_label => 'Time(s)', y_max_value => 6, bar_spacing => 5, box_axis => 0, y_long_ticks => 1, x_ticks => 0, # No bargroup spacing in dapper, boo! #bargroup_spacing => 5, legend_placement => 'RT', x_labels_vertical => 1, cumulate => 1, legendclr => "black", textclr => "black", fgclr => "black", x_label_position => .5, ) or die $graph->error; $graph->set_text_clr("black"); $graph->set_legend("spins", "retries"); my $fontfile = '/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf'; my $fontsize = 14; $graph->set_legend_font($fontfile, $fontsize); $graph->set_title_font($fontfile, $fontsize); $graph->set_x_label_font($fontfile, $fontsize); $graph->set_x_axis_font($fontfile, $fontsize); $graph->set_y_label_font($fontfile, $fontsize); $graph->set_y_axis_font($fontfile, $fontsize); # Plot that bad boy my $gd = $graph->plot(\@data) or die $graph->error; open(IMG, '>test.png') or die $!; binmode IMG; print IMG $gd->png; close IMG;
Subject: legend-reverse.patch
diff -ur GDGraph-1.44/Graph/axestype.pm GD/Graph/axestype.pm --- GDGraph-1.44/Graph/axestype.pm 2007-04-25 22:16:09.000000000 -0500 +++ GD/Graph/axestype.pm 2007-05-16 11:30:13.047800000 -0500 @@ -2057,7 +2057,11 @@ my $row = 1; my $x = $xl; # start position of current element - foreach my $legend (@{$self->{legend}}) + # Reverse the legend order for cumulative graphs + my @legend_list = $self->{cumulate} ? + reverse @{$self->{legend}} : @{$self->{legend}}; + + foreach my $legend (@legend_list) { $i++; last if $i > $self->{_data}->num_sets; @@ -2066,7 +2070,9 @@ next unless defined($legend) && $legend ne ""; - $self->draw_legend_marker($i, $xe, $y); + $self->{cumulate} + ? $self->draw_legend_marker($self->{_data}->num_sets + 1 - $i, $xe, $y) + : $self->draw_legend_marker($i, $xe, $y); $xe += $self->{legend_marker_width} + $self->{legend_spacing}; my $ys = int($y + $self->{lg_el_height}/2 - $self->{lgfh}/2);
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.