[text/plain 164b]
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
[text/x-patch 1.8k]
--- 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 %]