function addTs(h,ts,varargin)

%% If the destination axes is not specied expand the number of axes by 1 to
%% accomodate the additional plot
s = size(ts.Data);
if nargin==2
    h.addaxes;
    axespos = h.axesgrid.size(1);
else
    axespos = varargin{1};
end

%% Add the new waveform. Overloaded method used to circumevent the behavior
%% of the @waveform localize method which will not allow a datasrc to
%% direct all components of a response to the same channel
thissrc = tsguis.tssource('Timeseries',ts);
thissrc.Name = 'timeplot';
r = h.addwave(thissrc,axespos,@timeresp);

%% Add a listener to the data property which will fire when
%% the a new time series @timedata is added (below)
r.addlisteners(handle.listener(r,r.findprop('Data'), ...
    'PropertyPostSet',{@localSrcChanged r}));
set(r,'Data',tsguis.timedata,'RowIndex',axespos*ones([s(2) 1]), ...
    'ColumnIndex',1, 'Name',ts.Name);

%% Add a listener to the @timeseries datachange event which fires the 
%% waveform sourcechanged event
schema.prop(r,'tslistener','MATLAB array');
r.tslistener = handle.listener(r.DataSrc.Timeseries,'datachange', ...
    {@localSrcChanged r});
 
%% Add a listener to the timeseries name property of the timePlot Data
%% to update the first column of the axes table
r.addlisteners(handle.listener(ts,ts.findprop('Name'),'PropertyPostSet',...
    {@localSrcChanged r}));

%% Extend time focus if needed
if length(h.Waves)>1
    focus = h.getfocus;
else
    focus = [inf -inf]; % If this is the first wave the focus = time
                        % range of the first wave
end
h.setfocus(r.Data.Focus);

%% Update title
if length(h.Waves)==1
    h.axesgrid.Title = sprintf('Time Series Plot of %s',ts.Name);
else
    h.axesgrid.Title = 'Multiple Time Series';
end
S = warning('off','all'); % Disable "Some data is missing ..."
h.draw
warning(S);        

function localSrcChanged(es,ed,r)

S = warning('off','all'); % Disable "Some data is missing ..."
r.DataSrc.send('SourceChanged')
warning(S);