From 915486f8e232365329148f394013d299cdbacbae Mon Sep 17 00:00:00 2001
From: Olivier Couet <Olivier.Couet@cern.ch>
Date: Fri, 3 Apr 2009 10:02:27 +0000
Subject: [PATCH] - The problem submitted here:  
 http://root.cern.ch/phpBB2/viewtopic.php?p=35090#35090   was a side effect of
 the fix done here:   http://root.cern.ch/viewvc?view=rev&revision=25536  
 Both problems are now fixed. The following macro   reproduces the problem
 submitted in the forum:   {     TCanvas *can = new TCanvas("can",
 "",5,48,800,600);     can->SetTickx(1); can->SetTicky(1);     THStack *hs =
 new THStack();     TH1 *h = new TH1F("h","h",40,0,200);    
 h->SetBinContent(4,4);     hs->Add(h,""); hs->Draw();     TLegend *leg = new
 TLegend(0.7,0.6,0.99,0.99,NULL,"brNDC");     leg->AddEntry("h","h","F");    
 leg->Draw();   }

git-svn-id: http://root.cern.ch/svn/root/trunk@28088 27541ba8-7e3a-0410-8455-c3a389f83636
---
 hist/hist/src/THStack.cxx | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/hist/hist/src/THStack.cxx b/hist/hist/src/THStack.cxx
index dfea9baaa1a..a6af1009cf7 100644
--- a/hist/hist/src/THStack.cxx
+++ b/hist/hist/src/THStack.cxx
@@ -381,8 +381,7 @@ Int_t THStack::DistancetoPrimitive(Int_t px, Int_t py)
 //______________________________________________________________________________
 void THStack::Draw(Option_t *option)
 {
-   //*-*-*-*-*-*-*-*-*-*-*Draw this multihist with its current attributes*-*-*-*-*-*-*
-   //*-*                  ==========================================
+   // Draw this multihist with its current attributes.
    //
    //   Options to draw histograms  are described in THistPainter::Paint
    // By default (if option "nostack" is not specified), histograms will be paint
@@ -400,6 +399,7 @@ void THStack::Draw(Option_t *option)
       }
    }
    AppendPad(opt.Data());
+   gPad->RedrawAxis();
 }
 
 //______________________________________________________________________________
@@ -584,8 +584,8 @@ void THStack::Paint(Option_t *option)
          padsav->Clear();
          Int_t nx = (Int_t)TMath::Sqrt((Double_t)npads);
          if (nx*nx < npads) nx++;
-	 Int_t ny = nx;
-	 if (((nx*ny)-nx) >= npads) ny--;
+         Int_t ny = nx;
+         if (((nx*ny)-nx) >= npads) ny--;
          padsav->Divide(nx,ny);
       }
       TH1 *h;
@@ -755,7 +755,6 @@ void THStack::Paint(Option_t *option)
          lnk = (TObjOptLink*)lnk->Prev();
       }
    }
-   gPad->RedrawAxis();
 }
 
 //______________________________________________________________________________
-- 
GitLab