Index: trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc	(revision 4702)
+++ trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc	(revision 4703)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2003
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
@@ -27,5 +27,15 @@
 // MHVsTime
 //
-// Preliminary: the docu may be wrong!
+// Use this class if you want to display any rule vs time (or event number)
+//
+// eg.
+//       MHVsTime hist("MHillas.fAlpha");
+//       MHVsTime hist("MPointintPos.GetAbsErr");
+//       MHVsTime hist("MPointintPos.GetAbsErr*kRad2Deg");
+//
+// To set a maximum number of data-points (eg. to display the last 20min
+// only) call SetMaxPts(200)
+//
+// SetMaxPts(-1) disables this feature.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -58,8 +68,9 @@
 // --------------------------------------------------------------------------
 //
-// Default constructor.
+// Default constructor. For more informations about a valid rule
+// see MDataChain.
 //
 MHVsTime::MHVsTime(const char *rule)
-    : fGraph(NULL), fData(NULL), fScale(1), fUseEventNumber(0)
+    : fGraph(NULL), fData(NULL), fScale(1), fMaxPts(-1), fUseEventNumber(0)
 {  
     fName  = gsDefName;
@@ -98,7 +109,6 @@
 // --------------------------------------------------------------------------
 //
-// Setup the Binning for the histograms automatically if the correct
-// instances of MBinning are found in the parameter list
-// For a more detailed description see class description above.
+// PreProcess the MDataChain. Create a new TGraph. Delete an old one if
+// already allocated.
 //
 Bool_t MHVsTime::SetupFill(const MParList *plist)
@@ -127,5 +137,5 @@
 // --------------------------------------------------------------------------
 //
-// Set the name of the histogram ant the MHVsTime container
+// Set the name of the TGraph and the MHVsTime container
 //
 void MHVsTime::SetName(const char *name)
@@ -137,5 +147,5 @@
 // --------------------------------------------------------------------------
 //
-// Set the title of the histogram ant the MHVsTime container
+// Set the title of the TGraph and the MHVsTime container
 //
 void MHVsTime::SetTitle(const char *title)
@@ -147,5 +157,5 @@
 // --------------------------------------------------------------------------
 //
-// Fills the one, two or three data members into our histogram
+// Set the next data point. If the graph exceeds fMaxPts remove the first
 //
 Bool_t MHVsTime::Fill(const MParContainer *par, const Stat_t w)
@@ -165,4 +175,5 @@
             return kFALSE;
         }
+        // If the time is not valid skip this entry
 	if (!*tm)
             return kTRUE;
@@ -172,4 +183,7 @@
     const Double_t v = fData->GetValue()*fScale;
 
+    if (fMaxPts>0 && fGraph->GetN()>fMaxPts)
+        fGraph->RemovePoint(0);
+
     fGraph->SetPoint(fGraph->GetN(), t, v);
 
@@ -179,16 +193,7 @@
 // --------------------------------------------------------------------------
 //
-// Creates a new canvas and draws the histogram into it.
-//
-// Possible options are:
-//   PROFX: Draw a x-profile into the histogram (for 2D histograms only)
-//   PROFY: Draw a y-profile into the histogram (for 2D histograms only)
-//   ONLY:  Draw the profile histogram only (for 2D histograms only)
-//
-// If the kIsLog?-Bit is set the axis is displayed lkogarithmically.
-// eg this is set when applying a logarithmic MBinning
-//
-// Be careful: The histogram belongs to this object and won't get deleted
-// together with the canvas.
+// This displays the TGraph like you expect it to be (eg. time on the axis)
+// It should also make sure, that the displayed time always is UTC and
+// not local time...
 //
 void MHVsTime::Draw(Option_t *opt)
@@ -245,4 +250,5 @@
     if (fUseEventNumber)
         h->SetUseEventNumber();
+    h->SetMaxPts(fMaxPts);
     return h;
 }
Index: trunk/MagicSoft/Mars/mhvstime/MHVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHVsTime.h	(revision 4702)
+++ trunk/MagicSoft/Mars/mhvstime/MHVsTime.h	(revision 4703)
@@ -14,9 +14,10 @@
     // Could be const but root < 3.02/06 doesn't like this...
     TGraph     *fGraph;  // Histogram to fill
-    MDataChain *fData;  // Object from which the data is filled
-    Double_t    fScale; // Scale for axis (eg unit)
+    MDataChain *fData;   // Object from which the data is filled
+    Double_t    fScale;  // Scale for axis (eg unit)
+    Int_t       fMaxPts; // Maximum number of data points
 
     enum {
-        kIsLogy = BIT(18),
+        kIsLogy         = BIT(18),
         kUseEventNumber = BIT(20)
     };
@@ -42,8 +43,8 @@
 
     /*
-//    const TH1 *GetHist() const;
-//    TH1 *GetHist();
-//    TH1 *GetHistByName(const TString name="");
-*/
+     const TH1 *GetHist() const;
+     TH1 *GetHist();
+     TH1 *GetHistByName(const TString name="");
+     */
     const TGraph *GetGraph() const { return fGraph; }
     TGraph *GetGraph() { return fGraph; }
@@ -55,4 +56,6 @@
     MParContainer *New() const;
 
+    void SetMaxPts(Int_t n) { fMaxPts=n; }
+
     ClassDef(MHVsTime, 1) // Generalized 1/2/3D-histogram for Mars variables
 };
