Author: spadkins
Date: Mon Jun 19 08:13:53 2006
New Revision: 6551

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

Log:
Now have the ability to use themes, get_theme_value()

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 Mon Jun 
19 08:13:53 2006
@@ -236,6 +236,13 @@
     my $bottom_margin = $spec->{bottom_margin};
     my $right_margin  = $spec->{right_margin} || 20;
     my $top_margin    = $spec->{top_margin};
+    my $plot_bgcolor  = $self->get_theme_value("plot_bgcolor", "0xfffcf0");
+    my $bgcolor       = $self->get_theme_value("bgcolor",      "0x3f65b8");
+    my $titlecolor    = $self->get_theme_value("titlecolor",   "0xfffcf0");
+    my $x_labelcolor  = $self->get_theme_value("x_labelcolor", "0xfffcf0");
+    my $y_labelcolor  = $self->get_theme_value("y_labelcolor", "0xfffcf0");
+    my $y_titlecolor  = $self->get_theme_value("y_titlecolor", "0xfffcf0");
+
     if (!$top_margin) {
         $top_margin = 5;
         $top_margin += 20 if ($spec->{title});
@@ -265,10 +272,9 @@
         $width-$left_margin-$right_margin,
         $height-$top_margin-$bottom_margin);
 
-    # $plot_area->setBackground(0xffffc0, 0xffffe0);  # yellow
-    $plot_area->setBackground(0xd8d8ff, 0xe0e0ff);
+    $plot_area->setBackground(hex($plot_bgcolor), hex($plot_bgcolor));
 
-    $c->addTitle($spec->{title}) if ($spec->{title});
+    $c->addTitle($spec->{title}, "arialbd.ttf", 12, hex($titlecolor)) if 
($spec->{title});
 
     #Add a legend box at (55, 22) using horizontal layout, with transparent
     #background
@@ -284,9 +290,10 @@
         $legend->setMargin(5);
     }
 
-    $c->yAxis()->setTitle($spec->{y_title}) if ($spec->{y_title});
-    $c->setBackground(0xbbbbff);
-    #$c->setBackground(perlchartdir::metalColor(0xaaaaff));
+    $c->yAxis()->setTitle($spec->{y_title}, "arial.ttf", 10, 
hex($y_titlecolor)) if ($spec->{y_title});
+    $c->setBackground(hex($bgcolor));
+    $c->yAxis()->setLabelStyle("arial.ttf", 10, hex($y_labelcolor));
+    $c->xAxis()->setLabelStyle("arial.ttf", 10, hex($x_labelcolor));
 
     &App::sub_exit($c) if ($App::trace); #  print STDERR Dumper $c;
     return($c);
@@ -468,7 +475,8 @@
         }
     }
     if ($spec->{graphtype} ne "pie" && $spec->{graphtype} ne "meter") {
-        $chart->xAxis()->setTitle($x_title) if ($x_title);
+        my $x_titlecolor = $self->get_theme_value("x_titlecolor", "0xfffcf0");
+        $chart->xAxis()->setTitle($x_title, "arial.ttf", 10, 
hex($x_titlecolor)) if ($x_title);
     }
 }
 

Reply via email to