www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/+xregdesgui/PairwiseProjGraph.m
classdef PairwiseProjGraph < mbcgui.widget.BasicContainer %xregdesgui.PairwiseProjGraph class % xregdesgui.PairwiseProjGraph properties: % Parent - Property is of type 'MATLAB array' % Visible - Property is of type 'on/off' % Position - Property is of type 'rect' % Enable - Property is of type 'on/off' % DataShowing - Property is of type 'bool' % DrawEdgeAxes - Property is of type 'bool' % AxesHitTest - Property is of type 'bool' % % xregdesgui.PairwiseProjGraph methods: % doSetupPPG - Create property listeners % setTableData - Table drawing interface function % Copyright 2015 The MathWorks, Inc. and Ford Global Technologies, Inc. properties (AbortSet, SetObservable) %DATASHOWING Property is of type 'bool' DataShowing = true; %DRAWEDGEAXES Property is of type 'bool' DrawEdgeAxes = false; %AXESHITTEST Property is of type 'bool' AxesHitTest = false; end properties (SetAccess=protected, AbortSet) %HGRAPH Property is of type 'handle' hGraph = []; %HLISTPPG Property is of type 'handle vector' hListPPG = []; end methods % constructor block function obj = PairwiseProjGraph(varargin) %PAIRWISEPROJGRAPH Constructor for PairwiseProjGraph % OBJ = PAIRWISEPROJGRAPH(PROP, VAL,...) obj@mbcgui.widget.BasicContainer(varargin{:}); obj.hGraph = mbcgui.widget.XYScatter('Parent', obj.Parent, ... 'HitTest', 'off', ... 'XTickLabel', 'off', ... 'YTickLabel', 'off', ... 'LabelClipping', 'off'); if obj.AxesHitTest set(obj.hGraph, 'HitTest', 'on'); end setVisible(obj,obj.Visible) lyt = xreglayerlayout(obj.Parent,'elements',{obj.hGraph},'border',[15 10 15 10]); obj.ContentHandle = lyt; doSetupPPG(obj) end % PairwiseProjGraph end % constructor block methods % public methods %---------------------------------------- function doSetupPPG(obj) %DOSETUPPPG Create property listeners % DOSETUPPPG(OBJ) obj.hListPPG = [... event.proplistener(obj, obj.findprop('DataShowing'), 'PostSet', @onSetDataShowing); ... event.proplistener(obj, obj.findprop('AxesHitTest'), 'PostSet', @onSetAxesHitTest); ... ]; end % doSetupPPG %---------------------------------------- function setTableData(obj, R, C, data) %SETTABLEDATA Table drawing interface function % SETTABLEDATA(OBJ, ROW, COL, DATA) if R<C obj.DataShowing = false; set(obj, 'DataShowing', false); else des = data.DesignPackage.getdesign; fs = invcode(model(des),factorsettings(des)); lims=designlimits(des,'natural'); if ~isempty(fs) set(obj.hGraph,'XData', fs(:,C), 'YData', fs(:,R+1)); else set(obj.hGraph,'XData', [], 'YData', []); end obj.hGraph.setAxesProperty('xlim', lims{C}, 'ylim', lims{R+1}); if data.DesignPackage.DesignShowTestNumbers==1 lbls = cell(npoints(des), 1); for n = 1:length(lbls) lbls{n} = sprintf('%d', n); end obj.hGraph.LabelData = lbls; obj.hGraph.LabelStyle = 0; elseif data.DesignPackage.DesignShowTestNumbers==2 obj.hGraph.LabelData = {}; obj.hGraph.LabelStyle = 1; else obj.hGraph.LabelData = {}; obj.hGraph.LabelStyle = 0; end if obj.DrawEdgeAxes lbls = factors(des); if C==1 set(obj.hGraph, 'YTickLabel', 'on', 'YLabel', lbls{R+1}); else set(obj.hGraph, 'YTickLabel', 'off', 'YLabel', ''); end if R==(length(lims)-1) set(obj.hGraph, 'XTickLabel', 'on', 'XLabel', lbls{C}); else set(obj.hGraph, 'XTickLabel', 'off', 'XLabel', ''); end end obj.DataShowing = true; end end % setTableData end % public methods methods(Access=protected) function setVisible(obj,vis) if obj.DataShowing obj.hGraph.Visible = vis; else obj.hGraph.Visible = 'off'; end end end end % classdef function onSetDataShowing(~,evt) obj = evt.AffectedObject; setVisible(obj,obj.Visible) end function onSetAxesHitTest(~, evt) obj = evt.AffectedObject; obj.hGraph.HitTest = mbconoff(obj.AxesHitTest); end