[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GT] SVN Commit r582 - trunk/GT/Graphics



GeniusTrader SVN wrote:
Author: thomas
Date: 2008-03-21 00:32:53 +0100 (Fri, 21 Mar 2008)
New Revision: 582

Modified:
   trunk/GT/Graphics/Tools.pm
Log:
Add handling of space parameter when building axis.

Modified: trunk/GT/Graphics/Tools.pm
===================================================================
--- trunk/GT/Graphics/Tools.pm	2008-03-20 19:30:45 UTC (rev 581)
+++ trunk/GT/Graphics/Tools.pm	2008-03-20 23:32:53 UTC (rev 582)
@@ -66,7 +66,7 @@
=cut
 sub build_axis_for_timeframe {
-    my ($prices, $timeframe, $put_label, $period) = @_;
+    my ($prices, $timeframe, $put_label, $period, $space) = @_;

this is a newly added capability? i don't find any calls that pass a
value for $space in the (older) repo (or in my working environment)

the additional parameter isn't included in the pod for this method?
are the units pixels or ????

i think i like what it might be doing, but it needs something to use it ...
maybe an explanatory note say hey look at this neato improvement with
a before and after picture? or an example of how to use it ...

or did i miss all the above someplace else?

ras

     $period    = 1 if (! defined($period));
     $put_label = 1 if (! defined($put_label));
@@ -98,6 +98,16 @@ # Remove the labels if we don't want labels
     if (! $put_label) { foreach (@axis) { $_->[1] = ""; } }
+    my $skip = 0;
+    if ( $space ) {
+      if ($space < 15) {
+	foreach (@axis) { $_->[1] = "" if ($skip%6); $skip++;  }
+      } elsif ($space < 20) {
+	foreach (@axis) { $_->[1] = "" if ($skip%3); $skip++;  }
+ } elsif ($space < 30) { + foreach (@axis) { $_->[1] = "" if ($skip%2); $skip++; }
+      }
+    }


nit picky picky picky -- standard (kindofsorta but not really) gt
indenting is 4 spaces (and usually done with four, then tab, then
four, then tab, arrrgh) and lines should never be less than 123
characters unless they can be longer (my feeble attempt at humor) -- ras


     return \
AT
axis;
 }
@@ -141,6 +151,7 @@
     } else {
 	$interval = ($max - $min) / 4;
     }
+    # Due to rounding small interval may show up negative?
     my $log = ($interval != 0) ? log($interval) / log(10) : 0;
     my $power = int($log - (($log < 0) ? 1.5 : 0.5));
     my $inc = 10 ** $power;