Skip Menu |

This queue is for tickets about the SVGGraph-Pie CPAN distribution.

Report information
The Basics
Id: 76976
Status: resolved
Priority: 0/
Queue: SVGGraph-Pie

People
Owner: Nobody in particular
Requestors: cpan [...] punch.net
Cc:
AdminCc:

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



Subject: Unable to set borderwidth to 0
The current code does not allow setting the border to 0, attached is a patch that will allow this.
Subject: allow_zero_border.patch
diff -Naur SVGGraph-Pie-0.05.orig//lib/SVGGraph/Pie.pm SVGGraph-Pie-0.05/lib/SVGGraph/Pie.pm --- SVGGraph-Pie-0.05.orig//lib/SVGGraph/Pie.pm 2003-07-27 18:34:34.000000000 -0700 +++ SVGGraph-Pie-0.05/lib/SVGGraph/Pie.pm 2012-05-03 16:25:29.000000000 -0700 @@ -40,7 +40,7 @@ $cy = $$options{centertop} if $$options{centertop}; my $borderwidth = 4; - $borderwidth = $$options{borderwidth} if $$options{borderwidth}; + $borderwidth = $$options{borderwidth} if defined $$options{borderwidth}; ## Calc total my $total;
From: cpan [...] punch.net
On Thu May 03 19:27:04 2012, cpan@punch.net wrote: Show quoted text
> The current code does not allow setting the border to 0, attached is a > patch that will allow this.
During my testing, it looks like chrome browser will still draw a border if the stroke-width is set to zero, so this additional patch removes the setting of stroke-width if there is no borderwidth set.
Subject: no_border_chrome.patch
diff -Naur SVGGraph-Pie-0.05.orig//lib/SVGGraph/Pie.pm SVGGraph-Pie-0.05/lib/SVGGraph/Pie.pm --- SVGGraph-Pie-0.05.orig//lib/SVGGraph/Pie.pm 2003-07-27 18:34:34.000000000 -0700 +++ SVGGraph-Pie-0.05/lib/SVGGraph/Pie.pm 2012-05-03 17:11:11.000000000 -0700 @@ -89,15 +89,18 @@ } ## Draw circle + my $circlestyle = {'fill-opacity' => 0}; + if ( $borderwidth ) + { + $circlestyle->{stroke} = 'black'; + $circlestyle->{'stroke-width'} = $borderwidth; + } + $svg->circle( cx => $cx, cy => $cy, r => $radius, - style => { - 'stroke' => 'black', - 'stroke-width' => $borderwidth, - 'fill-opacity' => 0, - }, + style => $circlestyle, ); ## Draw separater @@ -107,15 +110,18 @@ my $separator_y = pop(@separator_lines); my $separator_x = pop(@separator_lines); my $g = $pie->tag('g', id => "line_$i", transform => "rotate($start)"); + my $linestyle = {}; + if ( $borderwidth ) + { + $linestyle->{stroke} = 'black'; + $linestyle->{'stroke-width'} = $borderwidth; + } $g->line( x1 => 0, y1 => 0, x2 => $separator_x, y2 => $separator_y, - style => { - 'stroke' => 'black', - 'stroke-width' => $borderwidth - }, + style => $linestyle, ); }
Thank you for your report. I applied this patch to v0.06.