Index: trunk/tools/czartool/Czarplot.pm
===================================================================
--- trunk/tools/czartool/Czarplot.pm	(revision 28922)
+++ trunk/tools/czartool/Czarplot.pm	(revision 28923)
@@ -154,4 +154,12 @@
     my ($self, $minY, $maxY) = @_;
 
+    my $tmp;
+    if (${$maxY} < ${$minY}) {
+
+        $tmp = ${$maxY};
+        ${$maxY} = ${$minY};
+        ${$minY} = $tmp;
+    }
+
     my $border = (${$maxY} - ${$minY})/10;
 
@@ -234,4 +242,5 @@
         "set xdata time;" .
         "set timefmt \"$self->{_dateFormat}\";" .
+    #    "set yrange [\"$minY\":\"$maxY\"];" .
         "set xrange [\"$minX\":\"$maxX\"];" .
         "set format x \"$timeFormat\";" .
@@ -307,5 +316,5 @@
         "'$gnuplotFile' using 1:2 title \"Available\" with lines lt 2\n";
 
-        print GP "\n";
+    print GP "\n";
     close GP;
 }
@@ -349,5 +358,5 @@
 
     my $prefix = $self->{_outputPath} ? $self->{_outputPath} : "."; # TODO should be function for this
-    my $outputFile = "$prefix/czarplot_hosts_space.png";
+        my $outputFile = "$prefix/czarplot_hosts_space.png";
     my $limit = 97.0;
     my $inputFile = $self->{_czarDb}->createHostsData($limit);
@@ -355,5 +364,5 @@
     my $totalUsed = $self->{_czarDb}->getTotalClusterStorageAsPercentage();
 
-my $totalPercent = sprintf("%.1f%%", $totalUsed);
+    my $totalPercent = sprintf("%.1f%%", $totalUsed);
 
     open (GP, "|/usr/bin/gnuplot -persist") or die "no gnuplot";
