Index: trunk/tools/czarplot.pl
===================================================================
--- trunk/tools/czarplot.pl	(revision 29118)
+++ trunk/tools/czarplot.pl	(revision 29119)
@@ -8,5 +8,5 @@
 
 use czartool::CzarDb;
-use czartool::Czarplot;
+use czartool::Plotter;
 
 my $czarDbName = "czardb";
@@ -85,6 +85,6 @@
 
 
-# GENE PLOTS my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png size 1280,960 font \"/usr/share/fonts/corefonts/arial.ttf\" 12" : "X11", $path, $save_temps);
-my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", $path, $save_temps);
+# GENE PLOTS my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png size 1280,960 font \"/usr/share/fonts/corefonts/arial.ttf\" 12" : "X11", $path, $save_temps);
+my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", $path, $save_temps);
 
 # sort out times
@@ -92,12 +92,12 @@
 if (!$begin) {
     if ($interval) {$begin = $czarDb->subtractInterval($end, $interval);}
-    else {$begin =  strftime('%Y-%m-%d 06:30',localtime);}
+    else {$begin =  strftime('%Y-%m-%d 06:35',localtime);}
 }
 
 my $diskUsage = 1; # TODO
 
-if (!$nebulous && $timeSeries) {$czarplot->createTimeSeries($label, $stage, $begin, $end, !$log, $log);}
-if ($histogram) {$czarplot->createHistogram($label, $begin, $end);}
-if ($nebulous && $timeSeries) {$czarplot->plotStorageTimeSeries($begin, $end);}
-elsif ($nebulous) {$czarplot->plotDiskUsageHistogram();}
+if (!$nebulous && $timeSeries) {$plotter->createTimeSeries($label, $stage, $begin, $end, $log);}
+if ($histogram) {$plotter->createHistogram($label, $begin, $end);}
+if ($nebulous && $timeSeries) {$plotter->plotStorageTimeSeries($begin, $end);}
+elsif ($nebulous) {$plotter->plotDiskUsageHistogram();}
 
Index: trunk/tools/czartool/CzarDb.pm
===================================================================
--- trunk/tools/czartool/CzarDb.pm	(revision 29118)
+++ trunk/tools/czartool/CzarDb.pm	(revision 29119)
@@ -242,10 +242,9 @@
 ###########################################################################
 sub createTimeSeriesData {
-    my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff, $dataFileLin, $dataFileLog) = @_;
-
-    ${$dataFileLin} = "/tmp/czarplot_gnuplot_lin_".$label."_".$stage."_t.dat";
-    ${$dataFileLog} = "/tmp/czarplot_gnuplot_log_".$label."_".$stage."_t.dat";
-    open (GNUDATLIN, ">${$dataFileLin}");
-    open (GNUDATLOG, ">${$dataFileLog}");
+    my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff, $dataFile, $isLog) = @_;
+
+    ${$dataFile} = "/tmp/czarplot_gnuplot_".$label."_".$stage."_t.dat";
+
+    open (GNUDAT, ">${$dataFile}") or print "* Problem opening gnuplot data file for plot for '$label' '$stage'\n";
 
     my $query = $self->{_db}->prepare(<<SQL);
@@ -264,6 +263,10 @@
 
     my $minProcessed = undef;
-
-    ($minProcessed, ${$maxY}, ${$minY}, ${$maxX}, ${$minX}, ${$timeDiff}) = $query->fetchrow_array();
+    my ($_maxY, $_minY, $_timeDiff);
+    ($minProcessed, $_maxY, $_minY, ${$maxX}, ${$minX}, $_timeDiff) = $query->fetchrow_array();
+
+    if ($_maxY > ${$maxY}) {${$maxY} = $_maxY;}
+    if ($_minY < ${$minY}) {${$minY} = $_minY;}
+    if ($_timeDiff > ${$timeDiff}) {${$timeDiff} = $timeDiff;}
 
     if (!defined $minProcessed) {return 0;}
@@ -284,15 +287,15 @@
         my ($timestamp, $pending, $faults, $processed) = @row;
 
-        my $processedLog = log($processed + 1);
-        my $pendingLog = log($pending + 1);
-        my $faultsLog = log($faults + 1);
-
-    #    print  "'$timestamp' '$pending' '$faults' '$processed'\n";
-        print GNUDATLIN "$timestamp $pending $faults $processed\n";
-        print GNUDATLOG "$timestamp $pendingLog $faultsLog $processedLog\n";
-    }
-
-    close(GNUDATLIN);
-    close(GNUDATLOG);
+        if ($isLog) {
+
+            $processed = log($processed + 1);
+            $pending = log($pending + 1);
+            $faults = log($faults + 1);
+        }
+
+        print GNUDAT "$timestamp $pending $faults $processed\n";
+    }
+
+    close(GNUDAT) or print "* Problem closing gnuplot data file for plot for '$label' '$stage'\n";
 
     return 1;
Index: trunk/tools/czartool/Plotter.pm
===================================================================
--- trunk/tools/czartool/Plotter.pm	(revision 29118)
+++ trunk/tools/czartool/Plotter.pm	(revision 29119)
@@ -288,4 +288,5 @@
         # when plotting multiple stages, show only processed
         else {
+
             print GP "'" . $gnuplotFiles->{$stage} . "' using 1:4 title \"$stage\" with lines lw 2";
         }
Index: trunk/tools/roboczar.pl
===================================================================
--- trunk/tools/roboczar.pl	(revision 29118)
+++ trunk/tools/roboczar.pl	(revision 29119)
@@ -11,5 +11,5 @@
 use czartool::Pantasks;
 use czartool::Nebulous;
-use czartool::Czarplot;
+use czartool::Plotter;
 use czartool::Burntool;
 
@@ -27,5 +27,5 @@
 my $nebulous = new czartool::Nebulous($czarDb);
 my $pantasks = new czartool::Pantasks();
-my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8", "/tmp", $save_temps); # TODO hardcoded font path
+my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8", "/tmp", $save_temps); # TODO hardcoded font path
 my $burntool = new czartool::Burntool();
 
@@ -109,5 +109,5 @@
 
         # sort out times
-        $begin =  strftime('%Y-%m-%d 06:30',localtime);
+        $begin =  strftime('%Y-%m-%d 06:35',localtime);
         $end = $czarDb->getNowTimestamp();
 
@@ -125,5 +125,5 @@
         print "* Checking Nebulous\n";
         $nebulous->updateClusterSpaceInfo();
-        $czarplot->plotDiskUsageHistogram();
+        $plotter->plotDiskUsageHistogram();
         updateServerStatus();
 
@@ -186,5 +186,5 @@
 
             chomp($label);
-            $czarplot->createTimeSeries($label,  $stage, $begin, $end, 1, 1);
+            $plotter->createLogAndLinearTimeSeries($label,  $stage, $begin, $end);
         }
     }
@@ -194,14 +194,14 @@
         my ($label) = @{$row};
 
-        $czarplot->createTimeSeries($label, undef, $begin, $end, 1, 1);
-        $czarplot->createHistogram($label, $begin, $end);
+        $plotter->createLogAndLinearTimeSeries($label, undef, $begin, $end);
+        $plotter->createHistogram($label, $begin, $end);
 
         #routineChecks($label, "1 HOUR");
     }
-    $czarplot->createTimeSeries("all_".$server."_labels", undef, $begin, $end, 1, 1);
-    $czarplot->createHistogram("all_".$server."_labels", $begin, $end);
+    $plotter->createLogAndLinearTimeSeries("all_".$server."_labels", undef, $begin, $end);
+    $plotter->createHistogram("all_".$server."_labels", $begin, $end);
     foreach $stage (@stages) {
 
-        $czarplot->createTimeSeries("all_".$server."_labels",  $stage, $begin, $end, 1, 1); # TODO must be a neater way...
+        $plotter->createLogAndLinearTimeSeries("all_".$server."_labels",  $stage, $begin, $end); # TODO must be a neater way...
     }
 }
