[svn:p5ee] r9435 - p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget

[email protected]
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Wed Apr 18 09:27:52 2007
New Revision: 9435

Modified:
   p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm

Log:
Removed setAggregateLabelStyle. Date labels are now handled properly.

Modified: p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm
==============================================================================
--- p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm	(original)
+++ p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm	Wed Apr 18 09:27:52 2007
@@ -421,7 +421,7 @@
                 $layer->addDataSet($yn->[$i], -1, $y_labels->[$i]);
             }
             #Enable bar label for the whole bar
-            $layer->setAggregateLabelStyle()->setFontAngle(90);
+            #$layer->setAggregateLabelStyle()->setFontAngle(90);
             if ($spec->{"3D"}) {
                 $layer->set3D(5,0);
                 $layer->setBarGap(0.2, 0.03);
@@ -470,12 +470,8 @@
             my (@x_date);
             for (my $i = 0; $i <= $#$x; $i++) {
                 if ($x->[$i] =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
-                    if ($#$x > 2) {
-                    	$x_date[$i] = &perlchartdir::chartTime($1, $2, $3);
-                    }
-                    else {
-                    	$x_date[$i] = $2 . "/" . $3;
-                    }
+                    #$x_date[$i] = &perlchartdir::chartTime($1, $2, $3);
+                    $x_date[$i] = "$2/$3";
                 }
                 else {
                     $x_date[$i] = $perlchartdir::NoValue;
@@ -485,13 +481,12 @@
             $x_title .= "($begin_yr";
             $x_title .= "-$end_yr" if ($end_yr ne $begin_yr);
             $x_title .= ")";
-            $chart->xAxis()->setLabelFormat("{value|mm/dd}");
-            if ($#$x > 2) {
-            	$layer->setXData(\@x_date);
-            }
-            else {
-            	$chart->xAxis()->setLabels(\@x_date);
-        	}
+
+            $chart->xAxis()->setLabels(\@x_date);
+            my $r = sprintf("%.0f", $#x_date / 15);
+            my $w = sprintf("%.0f", (800 / $spec->{width}));
+            $r += $w if ($w > 1 && $r > 0);
+            $chart->xAxis()->setLabelStep($r);
         }
         elsif ($x->[0] =~ /^[0-9]+$/) {
             $layer->setXData($x);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.