function adjustview(View,Data,Event,NormalRefresh)
%ADJUSTVIEW  Adjusts view prior to and after picking the axes limits. 
%
%  ADJUSTVIEW(VIEW,DATA,'postlim') adjusts the HG object extent once the 
%  axes limits have been finalized (invoked in response, e.g., to a 
%  'LimitChanged' event).

%  Author(s):  
%  Copyright 1986-2002 The MathWorks, Inc.
%  $Revision: 1.1.6.1 $ $Date: 2004/12/26 21:41:29 $

if strcmp(Event,'postlim') && strcmp(View.AxesGrid.YNormalization,'on')
      % Draw normalized data once X limits are finalized
      for ct=1:prod(size(View.Curves))
         Xlims = get(View.Curves(ct).Parent,'Xlim');
         YData = normalize(Data,Data.Amplitude(:,ct),Xlims,ct);
         if ~isempty(Data.Amplitude)
             set(double(View.Curves(ct)),'XData',Data.Time,'YData',YData)
         else
             set(double(View.Curves(ct)),'XData',[],'YData',[])
         end
      end 
end

