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

People
Owner: bwarfield [...] cpan.org
Requestors: jw [...] suse.de
Cc:
AdminCc:

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



Subject: lines: patch to trim miter
This patch is a primitive rewrite of the patch I did for GD::Graph3d:: lines3d.pm -- it is just here for compatibility. See also: http://rt.cpan.org/NoAuth/Bug.html?id=11734 I probably should have set the default to 1 there, and to 0 here. thanks, jw. +=item trim_miter + +By default this is set to '1'. If line_width is large and trim_miter is +'0', +typical zig-zag data lines may appear to exaggerated, due to the width of the +lines. When trim_miter is set to '1', then acute-angled segments are cut back +(with an additional small rectangle on top) to extend only half a line_width +beyond the data points. +
--- GDGraph-1.43/Graph/lines.pm.orig 2003-02-10 23:12:41.000000000 +0100 +++ GDGraph-1.43/Graph/lines.pm 2005-03-03 17:49:26.955087130 +0100 @@ -20,6 +20,37 @@ @GD::Graph::lines::ISA = qw( GD::Graph::axestype ); +my %Defaults = ( + trim_miter => 1, +); + +sub initialise() +{ + my $self = shift; + my $rc = $self->SUPER::initialise(); + for my $k (keys %Defaults) + { + $self->{$k} = $Defaults{$k}; + } + return $rc; +} + +sub set +{ + my $self = shift; + my %args = @_; + for my $k (keys %args) + { + if ($k eq 'trim_miter') + { + $self->{$k} = $args{$k}; + delete $args{$k}; + next; + } + } + return $self->SUPER::set(%args); +} + # PRIVATE sub draw_data_set @@ -147,14 +178,33 @@ # TODO: This loop probably should be around the datasets # for nicer results my $i; + my $lw2 = int($lw/2); for $i (1..$lw) { - my $yslw = $ys + int($lw/2) - $i; - my $yelw = $ye + int($lw/2) - $i; + my $yslw = $ys + $lw2 - $i; + my $yelw = $ye + $lw2 - $i; - # Need the setstyle to reset - $self->{graph}->setStyle(@pattern) if (@pattern); - $self->{graph}->line( $xs, $yslw, $xe, $yelw, $style ); + if ($self->{trim_miter}) + { + ## + ## Not exactly a nice implementation of trim_miter. + ## The polygon approach of lines3d is superior. + ## At least it makes the lines as fat as expected + ## and naturally does trimmed mitering (by wasting CPU cycles). + ## + for my $j (1..$lw) + { + my $xslw = $xs + $lw2 - $j; + my $xelw = $xe + $lw2 - $j; + # Need the setstyle to reset + $self->{graph}->setStyle(@pattern) if (@pattern); + $self->{graph}->line( $xslw, $yslw, $xelw, $yelw, $style ); + } + } + else + { + $self->{graph}->line( $xs, $yslw, $xe, $yelw, $style ); + } } } --- GDGraph-1.43/Graph.pm.orig 2003-07-01 07:02:10.000000000 +0200 +++ GDGraph-1.43/Graph.pm 2005-03-03 17:44:12.090345162 +0100 @@ -1290,6 +1290,14 @@ gaps, be careful when you use this. Default value: 0 +=item trim_miter + +By default this is set to '1'. If line_width is large and trim_miter is '0', +typical zig-zag data lines may appear to exaggerated, due to the width of the +lines. When trim_miter is set to '1', then acute-angled segments are cut back +(with an additional small rectangle on top) to extend only half a line_width +beyond the data points. + =back =head2 Options for graphs with points
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.