Index: trunk/tools/czartool/Czarplot.pm
===================================================================
--- trunk/tools/czartool/Czarplot.pm	(revision 29058)
+++ trunk/tools/czartool/Czarplot.pm	(revision 29114)
@@ -33,9 +33,10 @@
 ###########################################################################
 sub createImageFileName {
-    my ($self, $label, $stage, $suffix) = @_;
+    my ($self, $label, $stage, $suffix, $isLog) = @_;
 
     my $prefix = $self->{_outputPath} ? $self->{_outputPath} : ".";
     my $stagePart = $stage ? $stage : "all_stages";
-    return $prefix . "/czarplot_" . $label . "_" . $stagePart . "_$suffix.png";
+    my $type = $isLog ? "log" : "linear";
+    return $prefix . "/czarplot_" . $type . "_" . $label . "_" . $stagePart . "_$suffix.png";
 }
 
@@ -46,7 +47,5 @@
 ###########################################################################
 sub createTimeSeries {
-    my ($self, $label, $selectedStage, $beginTime, $endTime) = @_;
-
-    my $outputFile = createImageFileName($self, $label, $selectedStage, "t");
+    my ($self, $label, $selectedStage, $beginTime, $endTime, $makeLinear, $makeLog) = @_;
 
     my ($minX, $maxX, $minY, $maxY, $timeDiff);
@@ -61,15 +60,31 @@
     else {$stages = ["$selectedStage"]};        
 
-    my %gnuplotFiles;
+    my %gnuplotFilesLin;
+    my %gnuplotFilesLog;
     my $stage = undef;
-    my $gnuplotFile = undef;
+    my $gnuplotFileLin = undef;
+    my $gnuplotFileLog = undef;
     foreach $stage (@{$stages}) {
 
-        $gnuplotFile = $self->{_czarDb}->createTimeSeriesData($label, $stage, $beginTime, $endTime, \$minX, \$maxX, \$minY, \$maxY, \$timeDiff);
-        if ($gnuplotFile) {$gnuplotFiles{$stage} = $gnuplotFile;}
+        if($self->{_czarDb}->createTimeSeriesData(
+                    $label, 
+                    $stage, 
+                    $beginTime, 
+                    $endTime, 
+                    \$minX, 
+                    \$maxX, 
+                    \$minY, 
+                    \$maxY, 
+                    \$timeDiff, 
+                    \$gnuplotFileLin,
+                    \$gnuplotFileLog)) {
+
+            $gnuplotFilesLin{$stage} = $gnuplotFileLin;
+            $gnuplotFilesLog{$stage} = $gnuplotFileLog;
+        }
 
     }                                                           
 
-    my $numOfPlots =  keys(%gnuplotFiles);
+    my $numOfPlots =  keys(%gnuplotFilesLin);
 
     if ($numOfPlots == 0 ) {
@@ -85,5 +100,15 @@
     }
 
-    plotTimeSeries($self, \%gnuplotFiles, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff);
+    my $outputFile;
+    if ($makeLinear) {
+
+        $outputFile = createImageFileName($self, $label, $selectedStage, "t", 0);
+        $self->plotTimeSeries(\%gnuplotFilesLin, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff, 0);
+    }
+    if ($makeLog) {
+
+        $outputFile = createImageFileName($self, $label, $selectedStage, "t", 1);
+        $self->plotTimeSeries(\%gnuplotFilesLog, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff, 1);
+    }
 }                                                    
 
@@ -96,8 +121,8 @@
     my ($self, $label, $beginTime, $endTime) = @_;
 
-    my $outputFile = createImageFileName($self, $label, undef, "h");
+    my $outputFile = createImageFileName($self, $label, undef, "h", 0);
 
     my $inputFile = "/tmp/czarplot_gnuplot_".$label."_h.dat"; # TODO use stage not table
-    open (GNUDAT, ">$inputFile");
+        open (GNUDAT, ">$inputFile");
 
     my ($processed, $pending, $faults);
@@ -216,5 +241,5 @@
 ###########################################################################
 sub plotTimeSeries {
-    my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $maxY, $minY, $timeDiff) = @_;
+    my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $maxY, $minY, $timeDiff, $isLog) = @_;
 
     $self->sortOutMaxMinY(\$minY, \$maxY);
@@ -222,5 +247,7 @@
     my $timeFormat = undef;
     my $divX = undef;
-
+    my $yTitle = undef;
+    if ($isLog) {$yTitle = "Log(Num of Exposures)";}
+    else {$yTitle = "Num of Exposures";}
     $self->getTimeSpacing($timeDiff, \$divX, \$timeFormat);
 
@@ -245,5 +272,5 @@
         "set xdata time;" .
         "set timefmt \"$self->{_dateFormat}\";" .
-    #    "set yrange [\"$minY\":\"$maxY\"];" .
+        #    "set yrange [\"$minY\":\"$maxY\"];" .
         "set xrange [\"$minX\":\"$maxX\"];" .
         "set format x \"$timeFormat\";" .
@@ -251,5 +278,5 @@
         "set grid xtics;" .
         "set xlabel \"Time\";" .
-        "set ylabel \"Exposures\";" .
+        "set ylabel \"$yTitle\";" .
         "plot ";
 
@@ -342,5 +369,5 @@
         "set boxwidth;" .
         "set style data histogram;" .
- "set style histogram rowstacked;" .
+        "set style histogram rowstacked;" .
         "set style fill solid border -1;" .
         "set ylabel \"Exposures\";" .
