function bfitdatastatappdatasetup(datahandle)
% BFITDATASTATAPPDATASETUP setup for a data set anything needed for the Data Statisics GUI.

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.3 $  $Date: 2000/03/15 15:26:47 $

infarray = repmat(inf,1,5);

% place to store stats
setappdata(datahandle,'_Data_Stats_X',[]);
setappdata(datahandle,'_Data_Stats_Y',[]);

% place to store handles of lines plotted, and
% index vector of who is currently plotted
setappdata(datahandle,'_Data_Stats_X_Handles',infarray);  % array of handles of plots
setappdata(datahandle,'_Data_Stats_Y_Handles',infarray);  % array of handles of plots
setappdata(datahandle,'_Data_Stats_X_Showing', logical(zeros(1,5))); % array of logicals: 1 if showing
setappdata(datahandle,'_Data_Stats_Y_Showing', logical(zeros(1,5))); % array of logicals: 1 if showing

axesH = get(datahandle,'parent');
figureH = get(axesH, 'parent');

% turn the figure into double-buffering
% should we save this state and restore? and if we changed it, throw a warning??
set(figureH,'doublebuffer','on');

% Add the data to the legend and put appdata on the data
statappdata.type = 'data';
statappdata.index = [];
setappdata(datahandle,'_bfit',statappdata);
bfitcreatelegend(axesH)

