/*! For license information please see dll.220.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[220],{3409:function(e,a,t){"use strict";t.r(a);var n=t(14),l=t.n(n),r=t(12),i=t.n(r),o=t(15),s=t.n(o),c=t(16),u=t.n(c),d=t(8),f=t.n(d),p=t(0),g=t.n(p),v=t(1),h=t.n(v),b=t(38),m=t.n(b),y=t(75),V=t(86),w=t(207),C=t(203),R=t(204),E=t(1735),q=t(200),P=t(991);function D(e){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=f()(e);if(a){var l=f()(this).constructor;t=Reflect.construct(n,arguments,l)}else t=n.apply(this,arguments);return u()(this,t)}}var F=m()("isle:data-explorer:contingency-table"),S=function(e){s()(t,e);var a=D(t);function t(e){var n;return l()(this,t),(n=a.call(this,e)).state={relativeFreqs:!1,rowVar:e.defaultRowVar||e.variables[0],colVar:e.defaultColVar||e.variables[1],group:null,nDecimalPlaces:3,variables:e.variables,display:[]},n}return i()(t,[{key:"generateContingencyTable",value:function(){var e=this.state,a=e.rowVar,t=e.colVar,n=e.group,l=e.relativeFreqs,r=e.nDecimalPlaces,i=e.display;if(!a||!t)return this.props.session.addNotification({title:"Select Variables",message:"You need to select a row and column variable for the contingency table",level:"warning",position:"tr"});var o=g.a.createElement(E.default,{rowVar:a,colVar:t,group:n,relativeFreqs:l,nDecimalPlaces:r,display:i,data:this.props.data});this.props.logAction(q.DATA_EXPLORER_CONTINGENCY_TABLE,{rowVar:a,colVar:t,group:n,relativeFreqs:l,display:i}),this.props.onCreated(o)}},{key:"render",value:function(){var e=this,a=this.props,t=a.variables,n=a.groupingVariables;return g.a.createElement(V.default,null,g.a.createElement(V.default.Header,{as:"h4"},"Contingency Table",g.a.createElement(P.default,{title:"Contingency Table",content:"A contingency table displays either the raw absolute or relative frequencies of two categorical variable's values alongside their row and column totals."})),g.a.createElement(V.default.Body,null,g.a.createElement(C.default,{legend:"Row Variable:",defaultValue:this.state.rowVar,options:t,onChange:function(a){e.setState({rowVar:a})}}),g.a.createElement(C.default,{legend:"Column Variable:",defaultValue:this.state.colVar,options:t,onChange:function(a){e.setState({colVar:a})}}),g.a.createElement(C.default,{legend:"Group By:",options:n,clearable:!0,menuPlacement:"top",onChange:function(a){e.setState({group:a})},tooltip:"Generate a contingency table for each category of a chosen grouping variable"}),g.a.createElement(w.default,{legend:"Relative Frequency",defaultValue:!1,onChange:function(){e.setState({relativeFreqs:!e.state.relativeFreqs})}}),g.a.createElement(C.default,{legend:"Display:",options:["Row Percent","Column Percent"],multi:!0,onChange:function(a){e.setState({display:a||[]})}}),this.state.relativeFreqs||this.state.display.length>0?g.a.createElement("p",null,"Report relative frequencies to",g.a.createElement(R.default,{inline:!0,width:50,max:16,min:0,defaultValue:this.state.nDecimalPlaces,onChange:function(a){e.setState({nDecimalPlaces:a})}}),"decimal place(s)."):null,g.a.createElement(y.default,{variant:"primary",block:!0,onClick:this.generateContingencyTable.bind(this)},"Generate")))}}],[{key:"getDerivedStateFromProps",value:function(e,a){return e.variables.length!==a.variables.length?(F("Available variables have changed..."),{rowVar:e.defaultRowVar||e.variables[0],colVar:e.defaultColVar||e.variables[1],variables:e.variables}):null}}]),t}(p.Component);S.defaultProps={defaultRowVar:null,defaultColVar:null,groupingVariables:null,logAction:function(){},session:{}},S.propTypes={data:h.a.object.isRequired,defaultColVar:h.a.string,defaultRowVar:h.a.string,groupingVariables:h.a.array,logAction:h.a.func,onCreated:h.a.func.isRequired,session:h.a.object,variables:h.a.array.isRequired},a.default=S}}]);