From b8b16e2376bdf3aa8600d6fd1419d49a07a48cf7 Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Fri, 12 Dec 2003 17:57:05 +0000
Subject: [PATCH] Some axis optimisations (time axis in particular) by Damir
 Buskulic

git-svn-id: http://root.cern.ch/svn/root/trunk@7744 27541ba8-7e3a-0410-8455-c3a389f83636
---
 graf/src/TGaxis.cxx         |  6 +++++-
 hist/src/THLimitsFinder.cxx | 17 ++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/graf/src/TGaxis.cxx b/graf/src/TGaxis.cxx
index 90326f50535..3ac880340f3 100644
--- a/graf/src/TGaxis.cxx
+++ b/graf/src/TGaxis.cxx
@@ -1,4 +1,4 @@
-// @(#)root/graf:$Name:  $:$Id: TGaxis.cxx,v 1.61 2003/11/25 17:12:30 brun Exp $
+// @(#)root/graf:$Name:  $:$Id: TGaxis.cxx,v 1.62 2003/11/27 15:15:48 brun Exp $
 // Author: Rene Brun, Olivier Couet   12/12/94
 
 /*************************************************************************
@@ -821,6 +821,10 @@ void TGaxis::PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t yma
          N1A         = N1Aold;
          NN1         = NN1old;
          Nticks      = NN1;
+         if (OptionTime) {
+            wmin        += timeoffset - (int)(timeoffset) + rangeOffset;
+            wmax        += timeoffset - (int)(timeoffset) + rangeOffset;
+         }
       }
    }
 
diff --git a/hist/src/THLimitsFinder.cxx b/hist/src/THLimitsFinder.cxx
index 6a63badf555..d85506b108e 100644
--- a/hist/src/THLimitsFinder.cxx
+++ b/hist/src/THLimitsFinder.cxx
@@ -1,4 +1,4 @@
-// @(#)root/hist:$Name:  $:$Id: THLimitsFinder.cxx,v 1.6 2003/05/05 09:18:42 brun Exp $
+// @(#)root/hist:$Name:  $:$Id: THLimitsFinder.cxx,v 1.7 2003/09/30 19:04:39 brun Exp $
 // Author: Rene Brun   14/01/2002
 /*************************************************************************
  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
@@ -251,6 +251,7 @@ L20:
          else if (sigfig <= 1.5 && jlog==1)    siground = 1.5;
          else if (sigfig <= 2)    siground = 2;
          else if (sigfig <= 3 && jlog ==1)    siground = 3;
+         else if (sigfig <= 5 && sigfig>3 && jlog ==0) siground = 5; //added (Damir in 3.10/02)
          else if (jlog==0)        {siground = 1; jlog++;}
          else                     siground = 6;
          break;
@@ -321,22 +322,24 @@ LOK:
    Int_t oldnbins = nbins;
 
    Double_t atest = BinWidth*0.0001;
-   if (TMath::Abs(BinLow-A1)  >= atest) { BinLow  += BinWidth;  nbins--; }
-   if (TMath::Abs(BinHigh-A2) >= atest) { BinHigh -= BinWidth;  nbins--; }
-   if (BinLow >= BinHigh) {
+   //if (TMath::Abs(BinLow-A1)  >= atest) { BinLow  += BinWidth;  nbins--; } //replaced by Damir in 3.10/02
+   //if (TMath::Abs(BinHigh-A2) >= atest) { BinHigh -= BinWidth;  nbins--; } //by the next two lines
+   if (AL-BinLow  >= atest) { BinLow  += BinWidth;  nbins--; }
+   if (BinHigh-AH >= atest) { BinHigh -= BinWidth;  nbins--; }
+   if (!OptionTime && BinLow >= BinHigh) {
       //this case may happen when nbins <=5
       BinLow = oldBinLow;
       BinHigh = oldBinHigh;
       nbins = oldnbins;
    }
-   if (OptionTime && nbins==0) {
+   else if (OptionTime && BinLow>=BinHigh) {
       nbins = 2*oldnbins;
       BinHigh = oldBinHigh;
       BinLow = oldBinLow;
       BinWidth = (oldBinHigh - oldBinLow)/nbins;
       Double_t atest = BinWidth*0.0001;
-      if (TMath::Abs(BinLow-A1)  >= atest) { BinLow  += BinWidth;  nbins--; }
-      if (TMath::Abs(BinHigh-A2) >= atest) { BinHigh -= BinWidth;  nbins--; }
+      if (AL-BinLow  >= atest) { BinLow  += BinWidth;  nbins--; }
+      if (BinHigh-AH >= atest) { BinHigh -= BinWidth;  nbins--; }
    }
 }
 
-- 
GitLab