function xfocus = getfocus(this,varargin)
%GETFOCUS  Computes optimal X limits for wave plot 
%          by merging Focus of individual waveforms.

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

%% Method to comput focus of xyplots. Optional second argument restricts
%% evaluation to a specific set of columns. Note that responses cannot be a
%% vector.
xfocus = [];
if ~isempty(this.Responses) && this.Responses.isvisible
    if nargin>=2 && ~isempty(varargin{1})
        nonandata = this.Responses.Data.XData(...
            ~isnan(this.Responses.Data.XData(:,varargin{1})),varargin{1});
    else
        nonandata = this.Responses.Data.XData(~isnan(this.Responses.Data.XData));
    end
    if ~isempty(nonandata)
        xlow = min(nonandata);
        xhigh = max(nonandata);
        xfocus = [tchop(xlow*sign(xlow))*sign(xlow) tchop(xhigh*sign(xhigh))*sign(xhigh)];
    end
end

% Return something reasonable if empty.
if isempty(xfocus)
  xfocus = [0 1];
end


