Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the SVG-TT-Graph CPAN distribution.

Report information
The Basics
Id: 20475
Status: resolved
Priority: 0/
Queue: SVG-TT-Graph

People
Owner: Nobody in particular
Requestors: BRYCE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.09
Fixed in: (no value)



Subject: max_scale_value (patch)
Thanks for the module! Seems to work well with Inkscape too. Attached is a patch to add a max_scale_value for bar charts. Seems to work okay for my graphs. Bryce
Subject: Bar-max-val.diff
--- Bar.pm-orig 2006-02-18 05:35:27.000000000 -0800 +++ Bar.pm-new 2006-07-15 14:54:50.000000000 -0700 @@ -62,6 +62,7 @@ 'width' => '300', 'show_data_values' => 1, + 'max_scale_value' => undef, 'min_scale_value' => '0', 'stagger_x_labels' => 0, 'rotate_x_labels' => 0, @@ -173,6 +174,11 @@ The point at which the Y axis starts, defaults to '0', if set to '' it will default to the minimum data value. +=item max_scale_value() + +The maximum value for the Y axis. If set to '', it will +default to the maximum data value. + =item show_x_labels() Whether to show labels on the X axis or not, defaults @@ -324,6 +330,7 @@ 'style_sheet' => '', 'show_data_values' => 1, + 'max_scale_value' => '', 'min_scale_value' => '0', 'scale_divisions' => '', 'bar_gap' => 1, @@ -633,17 +640,25 @@ [% min_scale_value = min_value %] [% END %] + <!-- find ending value for scale on y axis --> + [% IF config.max_scale_value || config.max_scale_value == '0' %] + [% max_scale_value = config.max_scale_value %] + [% ELSE %] + <!-- setting highest value to be max_value as no max_scale_value defined --> + [% max_scale_value = max_value %] + [% END %] + <!-- base line --> [% base_line = h + y %] <!-- how much padding between largest bar and top of graph --> - [% IF (max_value - min_scale_value) == 0 %] + [% IF (max_scale_value - min_scale_value) == 0 %] [% top_pad = 10 %] [% ELSE %] - [% top_pad = (max_value - min_scale_value) / 20 %] + [% top_pad = (max_scale_value - min_scale_value) / 20 %] [% END %] - [% scale_range = (max_value + top_pad) - min_scale_value %] + [% scale_range = (max_scale_value + top_pad) - min_scale_value %] <!-- default to 10 scale_divisions if none have been set --> [% IF config.scale_divisions %]
On Sat Jul 15 18:07:28 2006, BRYCE wrote: Show quoted text
> Thanks for the module! Seems to work well with Inkscape too. > > Attached is a patch to add a max_scale_value for bar charts. > Seems to work okay for my graphs. > > Bryce
Not sure how I missed this - anyway will be in next release - thanks!
From: henrik.pauli [...] gmail.com
On Hétf 2008. Ápr 28 16:00:48, LLAP wrote: Show quoted text
> On Sat Jul 15 18:07:28 2006, BRYCE wrote:
> > Thanks for the module! Seems to work well with Inkscape too. > > > > Attached is a patch to add a max_scale_value for bar charts. > > Seems to work okay for my graphs. > > > > Bryce
> > Not sure how I missed this - anyway will be in next release - thanks!
Is it me, or is this patch missing from 0.16?
From: henrik.pauli [...] gmail.com
On Pén 2011. Ápr 29 11:01:47, ralesk wrote: Show quoted text
> On Hétf 2008. Ápr 28 16:00:48, LLAP wrote:
> > On Sat Jul 15 18:07:28 2006, BRYCE wrote:
> > > Thanks for the module! Seems to work well with Inkscape too. > > > > > > Attached is a patch to add a max_scale_value for bar charts. > > > Seems to work okay for my graphs. > > > > > > Bryce
> > > > Not sure how I missed this - anyway will be in next release - thanks!
> > Is it me, or is this patch missing from 0.16?
I ported the patch from BRYCE to 0.16 and added Line.pm to it. Wasn't sure about BarLine and it seems TimeSlice has max_scale_value...
Subject: max_scale_value.patch
diff -Naurdp SVG-TT-Graph-0.16/lib/SVG/TT/Graph/Bar.pm SVG-TT-Graph-0.16.max_scale_value/lib/SVG/TT/Graph/Bar.pm --- SVG-TT-Graph-0.16/lib/SVG/TT/Graph/Bar.pm 2010-04-17 14:01:28.000000000 +0200 +++ SVG-TT-Graph-0.16.max_scale_value/lib/SVG/TT/Graph/Bar.pm 2011-04-29 17:13:36.128665980 +0200 @@ -62,6 +62,7 @@ title, subtitle etc. 'show_data_values' => 1, 'min_scale_value' => '0', + 'max_scale_value' => undef, 'stagger_x_labels' => 0, 'rotate_x_labels' => 0, 'bar_gap' => 1, @@ -191,6 +192,11 @@ is '1', set to '0' if you don't want gap The point at which the Y axis starts, defaults to '0', if set to '' it will default to the minimum data value. +=item max_scale_value() + +The maximum value for the Y axis. If set to '', it will +default to the maximum data value. + =item show_x_labels() Whether to show labels on the X axis or not, defaults @@ -330,6 +336,7 @@ sub _set_defaults { 'show_data_values' => 1, 'min_scale_value' => '0', + 'max_scale_value' => '', 'scale_divisions' => '', 'bar_gap' => 1, @@ -587,17 +594,25 @@ __DATA__ [% min_scale_value = min_value %] [% END %] +<!-- find ending value for scale on y axis --> +[% IF config.max_scale_value || config.max_scale_value == '0' %] + [% max_scale_value = config.max_scale_value %] +[% ELSE %] + <!-- setting highest value to be max_value as no max_scale_value defined --> + [% max_scale_value = max_value %] +[% END %] + <!-- base line --> [% base_line = h + y %] <!-- how much padding between largest bar and top of graph --> -[% IF (max_value - min_scale_value) == 0 %] +[% IF (max_scale_value - min_scale_value) == 0 %] [% top_pad = 10 %] [% ELSE %] - [% top_pad = (max_value - min_scale_value) / 20 %] + [% top_pad = (max_scale_value - min_scale_value) / 20 %] [% END %] -[% scale_range = (max_value + top_pad) - min_scale_value %] +[% scale_range = (max_scale_value + top_pad) - min_scale_value %] <!-- default to 10 scale_divisions if none have been set --> [% IF config.scale_divisions %] diff -Naurdp SVG-TT-Graph-0.16/lib/SVG/TT/Graph/Line.pm SVG-TT-Graph-0.16.max_scale_value/lib/SVG/TT/Graph/Line.pm --- SVG-TT-Graph-0.16/lib/SVG/TT/Graph/Line.pm 2010-04-17 14:01:33.000000000 +0200 +++ SVG-TT-Graph-0.16.max_scale_value/lib/SVG/TT/Graph/Line.pm 2011-04-29 17:16:32.275685414 +0200 @@ -70,6 +70,7 @@ title, subtitle etc. 'stacked' => 0, 'min_scale_value' => '0', + 'max_scale_value' => undef, 'area_fill' => 0, 'show_x_labels' => 1, 'stagger_x_labels' => 0, @@ -199,6 +200,11 @@ Accumulates each data set. (i.e. Each po The point at which the Y axis starts, defaults to '0', if set to '' it will default to the minimum data value. +=item max_scale_value() + +The maximum value for the Y axis. If set to '', it will +default to the maximum data value. + =item show_x_labels() Whether to show labels on the X axis or not, defaults @@ -340,6 +346,7 @@ sub _set_defaults { 'stacked' => 0, 'min_scale_value' => '0', + 'max_scale_value' => '', 'area_fill' => 0, 'show_x_labels' => 1, 'stagger_x_labels' => 0, @@ -615,17 +622,25 @@ __DATA__ [% min_scale_value = min_value %] [% END %] +<!-- find ending value for scale on y axis --> +[% IF config.max_scale_value || config.max_scale_value == '0' %] + [% max_scale_value = config.max_scale_value %] +[% ELSE %] + <!-- setting highest value to be max_value as no max_scale_value defined --> + [% max_scale_value = max_value %] +[% END %] + <!-- base line --> [% base_line = h + y %] <!-- how much padding between largest bar and top of graph --> -[% IF (max_value - min_scale_value) == 0 %] +[% IF (max_scale_value - min_scale_value) == 0 %] [% top_pad = 10 %] [% ELSE %] - [% top_pad = (max_value - min_scale_value) / 20 %] + [% top_pad = (max_scale_value - min_scale_value) / 20 %] [% END %] -[% scale_range = (max_value + top_pad) - min_scale_value %] +[% scale_range = (max_scale_value + top_pad) - min_scale_value %] <!-- default to 10 scale_divisions if none have been set --> [% IF config.scale_divisions %]
Thanks for the patch Bruce and Henrik! It has been applied to version 0.17.