[svn:p5ee] r10733 - p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget
[email protected] Thu, 14 Feb 2008 11:03:33 -0800 (PST)
| Newsgroups | perl.cvs.p5ee |
|---|---|
| Message-ID | <[email protected]> |
Author: spadkins
Date: Thu Feb 14 11:03:32 2008
New Revision: 10733
Modified:
p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm
Log:
The x-axis does not show -1 and the graph in the report section overlaps the legend since the max value is zero
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 Thu Feb 14 11:03:32 2008
@@ -246,6 +246,7 @@
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");
+ my $y_max_zero = 1;
if (!$top_margin) {
$top_margin = 5;
@@ -264,6 +265,7 @@
my ($y_min, $y_max) = $self->get_y_limits($spec);
$y_min = int($y_min);
$y_max = int($y_max);
+ $y_max_zero = int($y_max);
my $y_label_len = length($y_max);
$y_label_len = length($y_min) if (length($y_min) > $y_label_len);
$left_margin = 20 + $y_label_len * 6;
@@ -379,6 +381,10 @@
$c->addTitle($spec->{title}, "arialbd.ttf", 12, hex($titlecolor)) if ($spec->{title});
+ if ($y_max_zero == 0) {
+ $c->yAxis()->setMargin($top_margin_adjusted + 15);
+ }
+
#Add a legend box at (55, 22) using horizontal layout, with transparent
#background
my $legend;
@@ -762,7 +768,14 @@
$chart->xAxis()->setLabelStep($r);
}
else {
+ foreach my $xlabel (@$x) {
+ if ($xlabel =~ /^-/) {
+ $xlabel = '\\' . $xlabel;
+ }
+ }
+
$chart->xAxis()->setLabels($x);
+
if ($spec->{x_label_pos}) {
$chart->xAxis()->setLabels($x)->setFontAngle(45) if ( $self->{total_x_length} > $self->{width}/8 );
$chart->xAxis()->setLabels($x)->setFontSize($self->{fontsize}, 0) if ($#$x > 30);