text: /*!
  *  filename: ej.pivottreemap.min.js
  *  version : 15.1.0.37
  *  Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
  *  Use of this code is subject to the terms of our license.
  *  A copy of the current license can be obtained at any time by e-mailing
  *  licensing@syncfusion.com. Any infringement will be prosecuted under
  *  applicable laws. 
  */
  (function(n){typeof define=="function"&&define.amd?define(["./../common/ej.globalize.min","./../common/ej.core.min","./../common/ej.data.min","./../common/ej.touch.min","./ej.waitingpopup.min","./../datavisualization/ej.treemap.min","./ej.pivot.common.min"],n):n()})(function(){(function(n,t,i){t.widget("ejPivotTreeMap","ej.PivotTreeMap",{_rootCSS:"e-pivottreemap",element:null,model:null,validTags:["div","span"],defaults:n.extend(t.datavisualization.TreeMap.prototype.defaults,{url:"",cssClass:"",currentReport:"",operationalMode:"clientmode",customObject:{},isResponsive:!1,dataSource:{data:null,isFormattedValues:!1,columns:[],cube:"",catalog:"",rows:[],values:[],filters:[]},serviceMethodSettings:{initialize:"InitializeTreeMap",drillDown:"DrillTreeMap"},locale:"en-US",drillSuccess:null,beforeServiceInvoke:null,afterServiceInvoke:null,load:null,renderComplete:null,renderFailure:null,renderSuccess:null,beforePivotEnginePopulate:null}),dataTypes:{serviceMethodSettings:"data",customObject:"data"},locale:t.util.valueFunction("locale"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJsonRecords:function(){return this._JSONRecords},setJsonRecords:function(n){this._JSONRecords=JSON.parse(n)},_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){this.element.empty().removeClass("e-pivottreemap"+this.model.cssClass);this._waitingPopup!=i&&this._waitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");ptreemapProxy=this;this._olapReport="";this._JSONRecords=null;this._treeMapDatasource=[];this._currentAction="initialize";this._selectedItem="";this._selectedTagInfo=null;this._tagCollection=[];this._drilledMembers=[];this._startDrilldown=!1;this._isDrilled=!1;this._treeMap=null;this._waitingPopup=null;this._drillText="";this._showDrillText=""},_load:function(){this.element.addClass(this.model.cssClass);typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?(this.model.customObject=oclientProxy.model.customObject,n("#"+oclientProxy._id+"_maxView")[0]?n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!0}):oclientWaitingPopup.show()):(this.element.ejWaitingPopup({showOnInit:!0}),this._waitingPopup=this.element.data("ejWaitingPopup"));var r=JSON.stringify(this.model.customObject);if(this.model.dataSource.data==null&&this.model.url==""&&this.model.dataSource.cube==""){this.renderTreeMapFromJSON(null);this._waitingPopup.hide();return}this.model.dataSource.data==null&&this.model.url!=""||this.model.dataSource.data!=null&&this.model.url!=""&&this.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(this.model.operationalMode=t.PivotTreeMap.OperationalMode.ServerMode,this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:this._currentAction,element:this.element,customObject:r}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize",currentReport:this.model.currentReport,customObject:r}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize"}),this.renderControlSuccess)):(this.model.operationalMode=t.PivotTreeMap.OperationalMode.ClientMode,this.model.dataSource.rows.length>1&&(this.model.dataSource.rows=[this.model.dataSource.rows[this.model.dataSource.rows.length-1]]),this.model.dataSource.cube!=""&&(this._trigger("beforePivotEnginePopulate",{treeMapObject:this}),t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)))},generateJSON:function(n,i){for(var g,a,c,ut,v,nt,e,u,f,o,tt=[],it=[],p="",k=[],y=[],s=[],w=[],l={},r=0;r<this.model.dataSource.values[0].measures.length;r++)p+=p==""?this.model.dataSource.values[0].measures[r].fieldCaption:"~"+this.model.dataSource.values[0].measures[r].fieldCaption;var rt=this.model.dataSource.values[0].axis,d=this.model.dataSource.rows.length,h=i[0][0].ColSpan,b=0;for(h-d<=0?(h=0,b=d,rowElementCount=d):(b=rt=="rows"?h-1:h,h=b-1),u=[],r=0;r<i.length;r++)for(f=0;f<i[r].length;f++)if(g=null,i[r][f].CSS==" value"&&w.push(i[r][f].Value),i[r][f].CSS=="rowheader"&&i[r][f].Value!=""){if(o={},g=i[r][f].Info+"::"+i[r][f].State,it.push(i[r][f].Info.replace(/&/g,"&amp;")),tt.push(g),u.length==0&&i[r][f].Info.split(".")[0].indexOf("Measures")<0&&(o.level=r,o.index=f,o.label=i[r][f].Value,u.push(o)),u.length!=0&&i[r][f].Info.split(".")[0].indexOf("Measures")<0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e]))if(u[e].index==f&&u[e].level!=r){u[e].level=r;u[e].label=u[e].label+"~~"+i[r][f].Value;break}else if(u[e].level==r){for(a=!1,c=0;c<u.length;c++)if(!t.isNullOrUndefined(u[c])&&u[c].index==f){a=!0;break}if(!a&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){o.level=r;o.index=f;o.label=i[r][f].Value;u.push(o);break}}}else if(i[r][f].CSS=="summary"&&u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e])&&u[e].index==f){delete u[e];break}for(e=0;e<u.length;e++)t.isNullOrUndefined(u[e])||b==u[e].label.split("~~").length&&s.push(u[e].label);for(u=[],r=0;r<i.length;r++)for(f=0;f<i[r].length;f++)if(i[r][f].CSS=="colheader"&&i[r][f].Value!=""){if(o={},u.length==0&&(o.level=f,o.index=r,o.label=i[r][f].Value,u.push(o)),u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e]))if(u[e].index==r&&u[e].level!=f&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){u[e].index=r;u[e].label=u[e].label+"~~"+i[r][f].Value;break}else if(u[e].level==f&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){for(a=!0,c=0;c<u.length;c++)if(!t.isNullOrUndefined(u[c])&&(a=!1,u[c].index==r)){a=!0;break}if(!a&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){o.level=f;o.index=r;o.label=i[r][f].Value;u.push(o);break}}}else if(i[r][f].CSS=="summary"&&u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e])&&u[e].index==r){delete u[e];break}for(e=0;e<u.length;e++)t.isNullOrUndefined(u[e])||y.push(u[e].label);if(p!=""&&rt==t.olap.AxisName.Column)for(r=0;r<y.length;r++)y[r]=y[r]+"~"+p;if(h==0)for(ut=w.length/y.length,r=0;r<s.length;r++){for(u=[],f=r;f<w.length;f=f+ut)o={},o.Item1=s[r].indexOf("~~")>=0?s[r].split("~~")[0]:s[r],o.Item2=w[f],u.push(o);k.push(u)}else{for(v=[],nt=null,r=0;r<s.length;r++)for(u=[],f=0;f<i[h].length;f++)if(i[h][f].CSS=="rowheader"&&i[h][f].Value!=""&&s[r].split("~~")[s[r].split("~~").length-1]==i[h][f].Value){nt=f;u.push(nt);u.push(s[r]);v.push(u);break}for(e=0;e<v.length;e++){for(u=[],r=0;r<i.length;r++)for(f=v[e][0];f<i[r].length;f++){i[r][f].CSS==" value"&&(o={},o.Item1=v[e][1].indexOf("~~")>=0?v[e][1].split("~~")[0]:v[e][1],o.Item2=i[r][f].Value,u.push(o));break}u.length!=0&&k.push(u)}}l.labelTags=tt;l.drillTags=it;l.measureNames=p;l.points_Y=k;l.seriesNames=y;l.treemapLabels=s;ptreemapProxy._JSONRecords=l;this.renderTreeMapFromJSON(l);this._unWireEvents();this._wireEvents()},_wireEvents:function(){if(typeof oclientProxy=="undefined")n(window).on("resize",n.proxy(this._reSizeHandler,this));this._on(this.element,"click",".drillItem",this._drillTreeMap)},_drillTreeMap:function(r){var u=null,e,f,o,s;if(r.type=="treeMapGroupSelected"){if(typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?n("#"+oclientProxy._id+"_maxView")[0]?n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!0}):oclientWaitingPopup.show():ptreemapProxy._waitingPopup.show(),r.selectedGroups.length==0){typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?n("#"+oclientProxy._id+"_maxView")[0]!=(i||null)?n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!1}):oclientWaitingPopup.hide():ptreemapProxy._waitingPopup.hide();return}for(ptreemapProxy._currentAction="drilldown",ptreemapProxy._selectedItem=r.selectedGroups[0].header,e=0;e<ptreemapProxy._treeMapDatasource.length;e++)if(ptreemapProxy._treeMapDatasource[e].Tag.split("::")[2]==ptreemapProxy._selectedItem){if(ptreemapProxy._selectedTagInfo=ptreemapProxy._treeMapDatasource[e].Tag,ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(u=ptreemapProxy._treeMapDatasource[e].drillTag),ptreemapProxy._selectedTagInfo.split("::")[ptreemapProxy._selectedTagInfo.split("::").length-1]!=2){ptreemapProxy._treeMap.refresh();typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?n("#"+oclientProxy._id+"_maxView")[0]!=(i||null)?n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!1}):oclientWaitingPopup.hide():ptreemapProxy._waitingPopup.hide();return}break}ptreemapProxy._startDrilldown=!0;ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(ptreemapProxy.model.beforeServiceInvoke!=null&&ptreemapProxy._trigger("beforeServiceInvoke",{action:ptreemapProxy._currentAction,element:ptreemapProxy.element,customObject:ptreemapProxy.model.customObject}),o=JSON.stringify(ptreemapProxy.model.customObject),ptreemapProxy.model.customObject!=""&&ptreemapProxy.model.customObject!=null&&ptreemapProxy.model.customObject!=i?typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports,customObject:o}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),customObject:o}),ptreemapProxy.renderControlSuccess):!typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport()}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports}),ptreemapProxy.renderControlSuccess)):(ptreemapProxy._drilledMembers.push(u),t.olap._mdxParser.updateDrilledReport({uniqueName:u,seriesInfo:[u],uniqueNameArray:ptreemapProxy._drilledMembers},"rowheader",ptreemapProxy))}else{if(typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?n("#"+oclientProxy._id+"_maxView")[0]?n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!0}):oclientWaitingPopup.show():ptreemapProxy._waitingPopup.show(),ptreemapProxy._currentAction="drillup",n(r.target).hasClass("drillItem"))if(ptreemapProxy.getJsonRecords().treemapLabels[0].indexOf("~~")>=0){for(ptreemapProxy._selectedItem=n(r.target).text(),f=0;f<ptreemapProxy.getJsonRecords().labelTags.length;f++)if(ptreemapProxy.getJsonRecords().labelTags[f].split("::")[2]==ptreemapProxy._selectedItem&&ptreemapProxy.getJsonRecords().labelTags[f].split("::")[ptreemapProxy.getJsonRecords().labelTags[f].split("::").length-1]==1){if(ptreemapProxy._selectedTagInfo=ptreemapProxy.getJsonRecords().labelTags[f],ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(u=ptreemapProxy.getJsonRecords().drillTags[f]),ptreemapProxy._selectedTagInfo.split("::")[ptreemapProxy._selectedTagInfo.split("::").length-1]!=1){typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?n("#"+oclientProxy._id+"_maxView")[0]!=(i||null)?n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!1}):oclientWaitingPopup.hide():ptreemapProxy._waitingPopup.hide();return}break}}else{typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?n("#"+oclientProxy._id+"_maxView")[0]!=(i||null)?n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!1}):oclientWaitingPopup.hide():ptreemapProxy._waitingPopup.hide();return}ptreemapProxy._tagCollection.length==0&&(ptreemapProxy._isDrilled=!1);ptreemapProxy._startDrilldown=!0;ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(ptreemapProxy.model.beforeServiceInvoke!=null&&ptreemapProxy._trigger("beforeServiceInvoke",{action:ptreemapProxy._currentAction,element:ptreemapProxy.element,customObject:ptreemapProxy.model.customObject}),o=JSON.stringify(ptreemapProxy.model.customObject),ptreemapProxy.model.customObject!=""&&ptreemapProxy.model.customObject!=null&&ptreemapProxy.model.customObject!=i?typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports,customObject:o}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),customObject:o}),ptreemapProxy.renderControlSuccess):!typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport()}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports}),ptreemapProxy.renderControlSuccess)):(s=ptreemapProxy._drilledMembers.slice(0,n.inArray(u,ptreemapProxy._drilledMembers)+1),ptreemapProxy._drilledMembers=ptreemapProxy._drilledMembers.slice(0,n.inArray(u,ptreemapProxy._drilledMembers)),t.olap._mdxParser.updateDrilledReport({uniqueName:u,seriesInfo:[u],uniqueNameArray:s,action:"collapse"},"rowheader",ptreemapProxy))}},_unWireEvents:function(){n(window).off("resize",n.proxy(this._reSizeHandler,this));this._off(this.element,"click",".drillItem",this._drillTreeMap)},renderControlSuccess:function(r){ptreemapProxy=this;typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&(n("#"+oclientProxy._id+"_maxView")[0]?n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!0}):oclientWaitingPopup.show());try{if(r[0]!=i?(this.setJsonRecords(r[0].Value),this.setOlapReport(r[1].Value),typeof oclientProxy!="undefined"&&(oclientProxy.currentReport=r[1].Value,r[2]!=null&&r[2]!=i&&r[2].Key=="ClientReports"&&(oclientProxy.reports=r[2].Value)),r[2]!=null&&r[2]!=i&&!r[2].Key=="ClientReports"&&(this.model.customObject=r[2].Value)):r.d!=i?(this.setJsonRecords(r.d[0].Value),this.setOlapReport(r.d[1].Value),typeof oclientProxy!="undefined"&&(oclientProxy.currentReport=r.d[1].Value,r.d[2]!=null&&r.d[2]!=i&&r.d[2].Key=="ClientReports"&&(oclientProxy.reports=r.d[2].Value)),r.d[2]==null||r.d[2]==i||r.d[2].Key=="ClientReports"||(this.model.customObject=r.d[2].Value)):(this.setJsonRecords(r.JsonRecords),this.setOlapReport(r.OlapReport),r.customObject!=null&&r.customObject!=null&&(this.model.customObject=r.customObject),typeof oclientProxy!="undefined"&&(typeof oclientProxy.currentReport!="undefined"&&(oclientProxy.currentReport=r.OlapReport),typeof oclientProxy.reports!="undefined"&&r.reports!=i&&r.reports!="undefined"&&(oclientProxy.reports=r.reports))),this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode){var u;u=this._currentAction!="initialize"?{action:this._currentAction,element:this.element,customObject:this.model.customObject}:{action:this._currentAction,element:this.element,customObject:this.model.customObject};this._trigger("afterServiceInvoke",u)}this.renderTreeMapFromJSON(this.getJsonRecords());this._unWireEvents();this._wireEvents();this._currentAction!="initialize"&&(this.model.currentReport=this.getOlapReport(),this._trigger("drillSuccess",this.element));typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?(n("#"+oclientProxy._id+"_maxView")[0]?(n("#"+oclientProxy._id+"_maxView").ejWaitingPopup({showOnInit:!1}),oclientWaitingPopup.hide()):typeof oclientProxy.ogridObj!="undefined"&&(oclientProxy&&oclientProxy.ogridObj._drillAction&&!oclientProxy.ogridObj._startDrilldown||oclientProxy.otreemapObj._currentAction&&!oclientProxy.otreemapObj._startDrilldown?oclientWaitingPopup.hide():!oclientProxy||oclientProxy.ogridObj._drillAction!=""||oclientProxy.otreemapObj._currentAction!=""||oclientProxy.ogridObj._startDrilldown||oclientProxy.otreemapObj._startDrilldown||oclientProxy.ogridObj._JSONRecords==null&&oclientProxy.otreemapObj._JSONRecords!=null?!oclientProxy.otreemapObj._startDrilldown||oclientProxy.ogridObj._startDrilldown||n("#"+oclientProxy._id+"_maxView")[0]?oclientProxy.otreemapObj._startDrilldown||oclientProxy.ogridObj._startDrilldown||oclientProxy.otreemapObj._currentAction!=""||oclientProxy.ogridObj._drillAction!=""||oclientProxy.ogridObj._JSONRecords==null&&oclientProxy.otreemapObj._JSONRecords!=null||oclientWaitingPopup.hide():oclientWaitingPopup.show():oclientWaitingPopup.hide()),oclientProxy.model.displaySettings.mode=="chartonly"&&oclientWaitingPopup.hide()):this._waitingPopup.hide();typeof oclientProxy!="undefined"&&(oclientProxy.otreemapObj._startDrilldown=!1)}catch(f){}t.isNullOrUndefined(r.Exception)||t.Pivot._createErrorDialog(r,"Exception",this)},renderTreeMapFromJSON:function(i){var s,f,y,l,e,o,v,h,u,a,c,p,r,w,b;if(this._treeMapDatasource=[],s="",t.isNullOrUndefined(i)||i.length<=0||i.labelTags.length==0||i.points_Y.length==0){typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null?oclientWaitingPopup.hide():this._waitingPopup.hide();return}if(t.isNullOrUndefined(i.chartLables)?i.treemapLabels:i.treemapLabels=i.chartLables,i.points_Y.length!=i.treemapLabels.length)for(oclientProxy._onFiltered=!1,f=[],r=0;r<JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y)).length-1;r++)f.push(JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y))[r]);else f=JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y));for(typeof oclientProxy!="undefined"&&oclientProxy.model.enableDeferUpdate&&oclientProxy._ischartTypesChanged&&(oclientProxy._ischartTypesChanged=!1),r=0;r<f.length;r++)for(y=ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length-1],u=0;u<f[r].length;u++)f[r][u].Item1=f[r][u].Item1.replace(f[r][u].Item1,y),f[r][u].Column=ptreemapProxy.getJsonRecords().seriesNames[u].split("~")[0],f[r][u].Measures=ptreemapProxy.getJsonRecords().measureNames,f[r][u].Tag=n.grep(ptreemapProxy.getJsonRecords().labelTags,function(n){return n.split("::")[2]==f[r][u].Item1})[0],this.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(f[r][u].drillTag=n.grep(ptreemapProxy.getJsonRecords().drillTags,function(n){return n.split("::")[2]==f[r][u].Item1})[0]),f[r][u][f[r][u].Tag.split("::")[1].split(".")[0].replace("[","").replace("]","")]=f[r][u].Item1,f[r][u].RowItem=f[r][u].Item1,f[r][u].Value=f[r][u].Item2!=""?f[r][u].Item2:"0",f[r][u].Index=u,delete f[r][u].Item1,delete f[r][u].Item2,s+=(s==""?"":";")+f[r][u].Tag.split("::")[1].split(".")[0].replace("[","").replace("]","");if(t.isNullOrUndefined(ptreemapProxy.getJsonRecords().measureNames)||(l=ptreemapProxy.getJsonRecords().measureNames.split("~")),l.length!=2)for(r=0;r<f.length;r++)for(u=0;u<f[r].length;u++)f[r][u].Value=t.isNullOrUndefined(f[r][u].Value)?0:(f[r][u].Value.indexOf(",")||f[r][u].Value.indexOf(".")||f[r][u].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(f[r][u].Value,"c",this.model.locale),this.model.locale):t.globalize.parseFloat(f[r][u].Value),this._treeMapDatasource.push(f[r][u]),(t.isNullOrUndefined(e)||e>=f[r][u].Value)&&(e=f[r][u].Value),(t.isNullOrUndefined(o)||o<=f[r][u].Value)&&(o=f[r][u].Value);else l.length==2&&(v=[],n.each(f,function(i,r){for(var u=0;u<r.length;u++)t.isNullOrUndefined(r[u].Value)||(r[u].Value=t.isNullOrUndefined(r[u].Value)?0:(r[u].Value.indexOf(",")||r[u].Value.indexOf(".")||r[u].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(r[u].Value,"c",ptreemapProxy.model.locale),ptreemapProxy.model.locale):t.globalize.parseFloat(r[u].Value),r[u].Color=r[u].Value,t.isNullOrUndefined(r[u+1])?r[u].Value=0:r[u].Column==r[u+1].Column&&(r[u].Value=t.isNullOrUndefined(r[u+1].Value)?0:(r[u+1].Value.indexOf(",")||r[u+1].Value.indexOf(".")||r[u+1].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(r[u+1].Value,"c",ptreemapProxy.model.locale),ptreemapProxy.model.locale):t.globalize.parseFloat(r[u+1].Value),u=u+1));n.each(r,function(n,i){t.isNullOrUndefined(i)||t.isNullOrUndefined(i.Value)||!t.isNullOrUndefined(i.Color)||r.splice(n,1)});n.each(r,function(n,i){t.isNullOrUndefined(i)||(i.Index=n,v.push(i))})}),this._treeMapDatasource=v,n.each(this._treeMapDatasource,function(n,i){t.isNullOrUndefined(i.Color)||((t.isNullOrUndefined(e)||e>=i.Color)&&(e=i.Color),(t.isNullOrUndefined(o)||o<=i.Color)&&(o=i.Color))}));if(ptreemapProxy.getJsonRecords().treemapLabels.length>0){for(ptreemapProxy._drillText="",h=[],r=0;r<ptreemapProxy.getJsonRecords().treemapLabels.length;r++)if(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length>1)for(u=0;u<ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length-1;u++){for(a=0,c=0;c<ptreemapProxy.getJsonRecords().labelTags.length;c++)if(ptreemapProxy.getJsonRecords().labelTags[c].split("::")[2]==ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]&&ptreemapProxy.getJsonRecords().labelTags[c].split("::")[ptreemapProxy.getJsonRecords().labelTags[c].split("::").length-1]==1){a=1;break}h.length==0&&a==1?h.push(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]):h.length>0&&(p=jQuery.inArray(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u],h),p==-1&&a==1&&h.push(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]))}for(r=0;r<h.length;r++)ptreemapProxy._drillText+=ptreemapProxy._drillText==""?t.buildTag("a.drillItem",h[r])[0].outerHTML:" > "+t.buildTag("a.drillItem",h[r])[0].outerHTML}this._showDrillText=ptreemapProxy._drillText==""?t.buildTag("span.drillup",s.split(";")[0],{"margin-left":"5px"})[0].outerHTML:t.buildTag("span.drillup",s.split(";")[0],{"margin-left":"5px"})[0].outerHTML+": "+ptreemapProxy._drillText;w=t.buildTag("div#"+this._id+"TreeMapContainer","",{height:typeof oclientProxy!="undefined"?(parseInt(oclientProxy._chartHeight)-50).toString()+"px":this.element.height(),width:typeof oclientProxy!="undefined"?oclientProxy._chartWidth:this.element.width(),"margin-top":"50px"})[0].outerHTML;this.element.html(w);e=e-1;o=o+1;s=s.split(";")[0];n("#"+this._id+"TreeMapContainer").ejTreeMap({dataSource:this._treeMapDatasource,showTooltip:!0,colorValuePath:l.length==2?"Color":"Value",tooltipTemplate:"tooltipTemplate",enableDrillDown:!1,enableGradient:!0,highlightGroupOnSelection:typeof oclientProxy!="undefined"?oclientProxy.model.enableDeferUpdate?!1:!0:!0,treeMapGroupSelected:this._drillTreeMap,refreshed:this._treeMapRenderSuccess,showLegend:!0,legendSettings:{leftLabel:e.toString(),width:150,height:20,title:this._treeMapDatasource[0].Measures,rightLabel:o.toString(),mode:"interactive",dockPosition:"bottom",alignment:"center"},rangeColorMapping:[{from:e,to:o,gradientColors:["#fde6cc","#fab665"]}],weightValuePath:"Value",leafItemSettings:{showLabels:!0,labelPath:"Column",labelVisibilityMode:"hideonexceededlength"},levels:[{groupPath:s,groupGap:2,showHeader:!0,headerHeight:25,labelPosition:"topleft",headerVisibilityMode:"hideonexceededlength"}]});this._treeMap=n("#"+this._id+"TreeMapContainer").data("ejTreeMap");this._treeMap.rowItem=s;n.views.helpers({Measures:function(n){return n.Measures},Row:function(n){return n.Column},Column:function(n){return n.RowItem},Value:function(n){return n.Value},Color:function(n){return t.isNullOrUndefined(n.Color)?n.Value:n.Color}});b={action:this._currentAction,customObject:this.model.customObject,element:this.element};this._trigger("renderSuccess",b);typeof oclientProxy!="undefined"&&n("#"+this._id+"TreeMapContainer").css({width:"100%"});this._treeMap.refresh();ptreemapProxy=this;ptreemapProxy._JSONRecords=i;this.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&this._waitingPopup.hide()},_treeMapRenderSuccess:function(){ptreemapProxy._treeMap=n("#"+ptreemapProxy._id+"TreeMapContainer").data("ejTreeMap");t.isNullOrUndefined(ptreemapProxy._treeMap)||(ptreemapProxy._treeMap.model.legendSettings.dockPosition=="top"?ptreemapProxy.element.find("#"+ptreemapProxy._id+"TreeMapContainer").children().hasClass("drillupAction")||n(t.buildTag("div#drillHeader .drillupAction",ptreemapProxy._showDrillText,{height:"25px",width:"99.8%","z-index":"10",position:"absolute","margin-top":"33px"})[0].outerHTML).insertAfter(n("#"+ptreemapProxy._id+"TreeMapContainer").find(".LegendDiv").css("margin-top","-50px").css("font-size","12px")):(n("#"+ptreemapProxy._id+"TreeMapContainer").find(".LegendDiv").css("font-size","12px").insertAfter(n("#"+ptreemapProxy._id+"TreeMapContainer").find("._templateDiv")),n(t.buildTag("div#drillHeader .drillupAction",ptreemapProxy._showDrillText,{height:"25px",width:"99.8%",position:"absolute","margin-top":"-32px"})[0].outerHTML).insertBefore(n("#"+ptreemapProxy._id+"TreeMapContainer").find("#backgroundTile"))))},_reSizeHandler:function(){var n=ptreemapProxy.element.find("#"+ptreemapProxy._id+"TreeMapContainer").width(ptreemapProxy.element.width()).data("ejTreeMap");t.isNullOrUndefined(n)||n.refresh()},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,async:a,dataType:c,data:f,success:l,complete:t.proxy(function(t){n.proxy(t,this);var i={action:this._currentAction,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",i)},this),error:t.proxy(function(n){typeof this._waitingPopup!="undefined"&&this._waitingPopup!=null&&this._waitingPopup.hide();typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&oclientWaitingPopup.hide();var t={action:this._currentAction,customObject:this.model.customObject,element:this.element,Message:n};this._trigger("renderFailure",t);this.renderTreeMapFromJSON("")},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()}});t.PivotTreeMap.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"}})(jQuery,Syncfusion)});
  