UNPKG

js-pkg

Version:
10 lines 105 kB
/*! * filename: ej.pivotchart.min.js * version : 15.3.0.33 * 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","./../common/ej.draggable.min","./../common/ej.scroller.min","./ej.dialog.min","./ej.waitingpopup.min","./../datavisualization/ej.chart.min","./ej.pivotanalysis.base.min","./ej.olap.base.min","./ej.pivot.common.min"],n):n()})(function(){(function(n,t,i){t.widget("ejPivotChart","ej.PivotChart",{_rootCSS:"e-pivotchart",element:null,model:null,_requiresID:!0,validTags:["div","span"],defaults:n.extend(t.datavisualization.Chart.prototype.defaults,{url:"",analysisMode:"pivot",operationalMode:"clientmode",cssClass:"",currentReport:"",customObject:{},enableRTL:!1,isResponsive:!1,enable3D:!1,enableContextMenu:!1,enableMultiLevelLabels:!1,enableXHRCredentials:!1,rotation:0,serviceMethodSettings:{initialize:"InitializeChart",drillDown:"DrillChart",exportPivotChart:"Export",paging:"paging"},dataSource:{data:null,sourceInfo:"",providerName:"ssas",isFormattedValues:!1,columns:[],cube:"",catalog:"",rows:[],values:[],filters:[]},locale:null,drillSuccess:null,load:null,beforeServiceInvoke:null,afterServiceInvoke:null,renderComplete:null,renderFailure:null,renderSuccess:null,beforeExport:null,beforePivotEnginePopulate:null}),dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},marker:"data",crossHair:"data",size:"data",serviceMethodSettings:{initialize:"enum",drillDown:"enum",exportPivotChart:"enum",paging:"enum"},zooming:"data",customObject:"data"},observables:["title.text","commonSeriesOptions.type","locale"],titleText:t.util.valueFunction("title.text"),seriesType:t.util.valueFunction("commonSeriesOptions.type"),locale:t.util.valueFunction("locale"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJSONRecords:function(){return this._JSONRecords},setJSONRecords:function(t){this._JSONRecords=n.parseJSON(t)},getPivotEngine:function(){return this._pivotEngine},setPivotEngine:function(n){this._pivotEngine=n},_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){this._pivotEngine=null;this.element.empty().removeClass("e-pivotchart"+this.model.cssClass).removeAttr("tabindex");this._waitingPopup!=i&&this._waitingPopup.destroy();this.element.attr("class")==""&&this.element.removeAttr("class")},_initPrivateProperties:function(){this._id=this.element.attr("id");this._olapReport="";this._JSONRecords=null;this._currentAction="initialize";this._selectedItem="";this._selectedIndex=-1;this._selectedTagInfo=null;this._tagCollection=[];this._selectedTags=[];this._labelCurrentTags=[];this._startDrilldown=!1;this._drillAction="";this._initZooming=!1;this._dimensionIndex=-1;this._selectedMenuItem="";this._pivotEngine=null;this._curFocus=null;this._prevDrillElements=[];this._drillParams=[];this._currentDrillInfo=[];this._selectedSeriesInfo=[];this._waitingPopup=null;this._pivotClientObj=null},_load:function(){var r,u;if(this.model.locale=!t.isNullOrUndefined(t.util.getVal(this.locale()))&&n.isFunction(this.locale)?this.locale():"en-US",r={action:"initialize",element:this.element,customObject:this.model.customObject},this._trigger("load",r),this.element.addClass(this.model.cssClass),n(this.element).parents(".e-pivotclient").length>0?(this._pivotClientObj=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+this._pivotClientObj._id+"_maxView")[0]?n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):(this.element.ejWaitingPopup({showOnInit:!0}),this._waitingPopup=this.element.data("ejWaitingPopup"),this._waitingPopup.show()),this.model.zooming!=""&&(this._initZooming=!0),this.model.dataSource.data==null&&this.model.url!=""||this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode){if(this.model.operationalMode=t.PivotChart.OperationalMode.ServerMode,this.model.url==""){this.renderChartFromJSON("");return}this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._currentAction,element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);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:u}),this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._generateData:this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize"}),this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._generateData:this.renderControlSuccess)}else this.model.operationalMode=t.PivotChart.OperationalMode.ClientMode,this.model.analysisMode=this.model.dataSource.cube!=""?t.PivotChart.AnalysisMode.Olap:t.PivotChart.AnalysisMode.Pivot,this.refreshControl()},refreshControl:function(){var r,u,f,i;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)if(t.PivotAnalysis.setFieldCaptions(this.model.dataSource),r=t.PivotAnalysis.pivotEnginePopulate(this.model),u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,this._pivotEngine=r.pivotEngine,r.pivotEngine.length>0)if(t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)||this.model.enableMultiLevelLabels)this._generateData(this._pivotEngine);else{for(f=this._cloneEngine(this._pivotEngine),i=0;i<this._labelCurrentTags.expandedMembers.length;i++)this._cropData(f,this._labelCurrentTags.expandedMembers[i],0,!0);this._generateData(f)}else t.isNullOrUndefined(this._waitingPopup)||(t.isNullOrUndefined(u)||(u._isTimeOut=!1),this._waitingPopup.hide());else t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)},_setFirst:!1,_setModel:function(i){var u=this.element.find("#"+this._id+"Container").data("ejChart"),r,f;for(r in i)switch(r){case"olapReport":this.setOlapReport(i[r]);this._load();break;case"jsonData":this.setJSONRecords(i[r]);this.element.renderChartFromJSON(i[r]);break;case"refreshPivotChart":this.element.renderChartFromJSON(i[r]);break;case"customObject":this.model.customObject=i[r];break;case"height":this.model.size.height=i[r];u&&u.redraw();break;case"width":this.model.size.width=i[r];u&&u.redraw();break;case"operationalMode":this.model.operationalMode=i[r];break;case"analysisMode":this.model.analysisMode=i[r];break;case"commonSeriesOptions":if(u){for(!t.isNullOrUndefined(t.util.getVal(i[r]).type)&&n.isFunction(t.util.getVal(i[r]).type)?this.seriesType(i[r].type()):t.isNullOrUndefined(i[r].type)||this.seriesType(i[r].type),u.model.commonSeriesOptions=n.extend({},u.model.commonSeriesOptions,i[r]),u.model.type=u.model.commonSeriesOptions.type=this.seriesType(),f=0;f<u.model.series.length;f++)u.model.series[f].type=u.model.type;u.redraw()}break;case"title":u&&(!t.isNullOrUndefined(t.util.getVal(i[r]).text)&&n.isFunction(t.util.getVal(i[r]).text)?this.titleText(i[r].text()):t.isNullOrUndefined(i[r].text)||this.titleText(i[r].text),u.model.title.text=this.titleText(),u.redraw());break;case"animation":this.model.animation=i[r];break;case"crossHair":this.model.crossHair=i[r];break;case"marker":this.model.marker=i[r];break;case"zooming":this.model.zooming=i[r];break;case"legend":this.model.legend=i[r];break;case"primaryXAxis":this.model.primaryXAxis=i[r];break;case"primaryYAxis":this.model.primaryYAxis=i[r];break;case"dataSource":this.model.dataSource=n.extend({},this.model.dataSource,i[r]);this.refreshControl();this._schemaData&&this._schemaData._load();break;case"locale":this.locale(t.util.getVal(i[r]));this._load();break;case"enableRTL":this.model.enableRTL=i[r];this._load();break;case"isResponsive":this.model.isResponsive=i[r];u&&u.redraw();break;case"enable3D":this.model.enable3D=i[r];u&&u.redraw();break;case"enableContextMenu":this.model.enableContextMenu=i[r];u&&u.redraw();break;case"enableMultiLevelLabels":this.model.enableMultiLevelLabels=i[r];this._load();break;case"rotation":this.model.rotation=i[r];u&&u.redraw();break;default:n.extend(!0,this.model,{},i[r])}u&&this.renderControlSuccess({JsonRecords:JSON.stringify(this.getJSONRecords()),OlapReport:this.getOlapReport()})},_keyDownPress:function(n){var u,r,i;n.which!==13||t.isNullOrUndefined(this._curFocus)||this._curFocus.click();(n.which===39||n.which===37||n.which===38||n.which===40)&&this.element.find(".e-dialog").length>0&&(n.preventDefault(),u=this.element.find(".e-dialog"),u.tabindex=-1,u.focus(),r=u.find("li"),n.which===39||n.which===40?(t.isNullOrUndefined(this._curFocus)?this._curFocus=r.eq(0):(this._curFocus.removeClass("e-hoverCell"),i=this._curFocus.next(),this._curFocus=i.length>0?i:r.eq(0)),this._curFocus.addClass("e-hoverCell")):(n.which===37||n.which===38)&&(t.isNullOrUndefined(this._curFocus)?this._curFocus=r.last():(this._curFocus.removeClass("e-hoverCell"),i=this._curFocus.prev(),this._curFocus=i.length>0?i:r.last()),this._curFocus.addClass("e-hoverCell")))},_wireEvents:function(){if(this._on(n(document),"keydown",this._keyDownPress),!this.model.enableContextMenu||this.element.parents(".e-pivotclient").length>0||this._on(this.element,"contextmenu","#"+this._id+"Container",t.proxy(function(){var u="<li class='chartTypes'><a>"+this._getLocalizedLabels("ChartTypes")+"<\/a><ul><li class='e-line'><a>"+this._getLocalizedLabels("Line")+"<\/a><\/li><li class='e-spline'><a>"+this._getLocalizedLabels("Spline")+"<\/a><\/li><li class='e-column'><a>"+this._getLocalizedLabels("Column")+"<\/a><\/li><li class='e-area'><a>"+this._getLocalizedLabels("Area")+"<\/a><\/li><li class='e-splinearea'><a>"+this._getLocalizedLabels("SplineArea")+"<\/a><\/li><li class='e-stepline'><a>"+this._getLocalizedLabels("StepLine")+"<\/a><\/li><li class='e-steparea'><a>Step Area<\/a><\/li><li class='e-pie'><a>Pie<\/a><\/li><li class='e-bar'><a>Bar<\/a><\/li><li class='e-stackingarea'><a>Stacking Area<\/a><\/li><li class='e-stackingcolumn'><a>"+this._getLocalizedLabels("StackingColumn")+"<\/a><\/li><li class='e-stackingbar'><a>"+this._getLocalizedLabels("StackingBar")+"<\/a><\/li><li class='e-funnel'><a>"+this._getLocalizedLabels("Funnel")+"<\/a><\/li><li class='e-pyramid'><a>"+this._getLocalizedLabels("Pyramid")+"<\/a><\/li><li class='e-doughnut'><a>"+this._getLocalizedLabels("Doughnut")+"<\/a><\/li><li class='e-scatter'><a>"+this._getLocalizedLabels("Scatter")+"<\/a><\/li><li class='e-bubble'><a>"+this._getLocalizedLabels("Bubble")+"<\/a><\/li><\/ul><\/li>",f="<li class='chart3DTypes'><a>"+this._getLocalizedLabels("TDCharts")+"<\/a><ul><li class='e-column'><a>"+this._getLocalizedLabels("ColumnTD")+"<\/a><\/li><li class='e-pie'><a>"+this._getLocalizedLabels("PieTD")+"<\/a><\/li><li class='e-bar'><a>"+this._getLocalizedLabels("BarTD")+"<\/a><\/li><li class='e-stackingbar'><a>"+this._getLocalizedLabels("StackingBarTD")+"<\/a><\/li><li class='e-stackingcolumn'><a>"+this._getLocalizedLabels("StackingColumnTD")+"<\/a><\/li><li class='e-disable3D'><a>"+this._getLocalizedLabels("DisableTD")+"<\/a><\/li><\/ul><\/li>",e="<li class='exportTypes'><a>"+this._getLocalizedLabels("Exporting")+"<\/a><ul><li class='e-excel'><a>"+this._getLocalizedLabels("Excel")+"<\/a><\/li><li class='e-word'><a>"+this._getLocalizedLabels("Word")+"<\/a><\/li><li class='e-pdf'><a>"+this._getLocalizedLabels("Pdf")+"<\/a><\/li><li class='e-png'><a>"+this._getLocalizedLabels("PNG")+"<\/a><\/li><li class='e-emf'><a>"+this._getLocalizedLabels("EMF")+"<\/a><\/li><li class='e-gif'><a>"+this._getLocalizedLabels("GIF")+"<\/a><\/li><li class='e-jpg'><a>"+this._getLocalizedLabels("JPG")+"<\/a><\/li><li class='e-bmp'><a>"+this._getLocalizedLabels("BMP")+"<\/a><\/li><\/ul><\/li>",o="<li class='e-smartLabels'><a>"+this._getLocalizedLabels("SmartLabels")+"<\/a><ul><li class='e-rotate45'><a>"+this._getLocalizedLabels("Rotate45")+"<\/a><\/li><li class='e-rotate90'><a>"+this._getLocalizedLabels("Rotate90")+"<\/a><\/li><li class='e-trim'><a>"+this._getLocalizedLabels("Trim")+"<\/a><\/li><li class='e-multipleRows'><a>"+this._getLocalizedLabels("MultipleRows")+"<\/a><\/li><li class='e-wrap'><a>"+this._getLocalizedLabels("Wrap")+"<\/a><\/li><li class='e-hiding'><a>"+this._getLocalizedLabels("Hide")+"<\/a><\/li><li class='e-wrapByWord'><a>"+this._getLocalizedLabels("WrapByWord")+"<\/a><\/li><\/ul><\/li>",s="<li class='e-interaction'><a>"+this._getLocalizedLabels("Interactions")+"<\/a><ul><li class='e-crossHair'><a>"+this._getLocalizedLabels("CrossHair")+"<\/a><\/li><li class='e-trackBall'><a>"+this._getLocalizedLabels("TrackBall")+"<\/a><\/li><li class='none'><a>"+this._getLocalizedLabels("None")+"<\/a><\/li><\/ul><\/li>",h=t.buildTag("ul#"+this._id+"_ContextMenu",t.buildTag("li.e-toolTip",t.buildTag("a",this._getLocalizedLabels("Tooltip"))[0].outerHTML)[0].outerHTML+t.buildTag("li.e-legend",t.buildTag("a",this._getLocalizedLabels("Legend"))[0].outerHTML)[0].outerHTML+(this.model.enable3D?"":t.buildTag("li.e-zooming",t.buildTag("a",this._getLocalizedLabels("Zooming"))[0].outerHTML)[0].outerHTML)+u+f+e+(this.model.enable3D?"":s+o))[0].outerHTML,r,i;n("#"+this._id).append(h);r=this.element.find("#"+this._id+"Container");this.element.find("#"+this._id+"_ContextMenu").ejMenu({width:"150px",menuType:t.MenuType.ContextMenu,contextMenuTarget:r,enableRTL:this.model.enableRTL,click:t.proxy(this._contextMenuClick,this)});i=t.buildTag("span.e-enabledState").addClass("e-icon").attr("aria-label",this._getLocalizedLabels("EnabledState"))[0].outerHTML;this.model.enable3D?n("#"+this._id+"_ContextMenu").find(".chart3DTypes ."+this.model.commonSeriesOptions.type+" a:eq(0)").append(i):n("#"+this._id+"_ContextMenu").find(".chartTypes ."+this.model.commonSeriesOptions.type+" a:eq(0)").append(i);this.model.commonSeriesOptions.tooltip.visible&&n("#"+this._id+"_ContextMenu").find(".e-toolTip a:eq(0)").append(i);this.model.zooming.enable&&n("#"+this._id+"_ContextMenu").find(".e-zooming a:eq(0)").append(i);this.model.legend.visible&&n("#"+this._id+"_ContextMenu").find(".e-legend a:eq(0)").append(i);this.model.primaryXAxis.labelIntersectAction!="none"&&(n("#"+this._id+"_ContextMenu").find(".e-smartLabels a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".e-smartLabels ."+this.model.primaryXAxis.labelIntersectAction+" a:eq(0)").append(i),this.model.primaryXAxis.labelIntersectAction=="hide"&&n("#"+this._id+"_ContextMenu").find(".e-smartLabels .e-hiding a:eq(0)").append(i));this.model.crosshair.type=="crosshair"&&this.model.crosshair.visible&&(n("#"+this._id+"_ContextMenu").find(".e-interaction a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".e-interaction .e-crossHair a:eq(0)").append(i),this.mode.enable3D||n("#"+this._id+"_ContextMenu").ejMenu("disableItem",this._getLocalizedLabels("Tooltip")));this.model.crosshair.type=="trackBall"&&this.model.crosshair.visible&&(n("#"+this._id+"_ContextMenu").find(".e-interaction a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".e-interaction .e-trackBall a:eq(0)").append(i),this.mode.enable3D||n("#"+this._id+"_ContextMenu").ejMenu("disableItem",this._getLocalizedLabels("Tooltip")));this.model.crosshair.visible||n("#"+this._id+"_ContextMenu").find(".e-interaction .none a:eq(0)").append(i)})),this._on(this.element,"click",".e-menuList",function(r){var h,c,f,s,e,o,u;if(this._curFocus=null,r.target.innerHTML==this._getLocalizedLabels("Exit"))this.element.find("#"+this._id+"ExpandMenu, .e-expandMenu, .e-dialog").remove();else if(r.target.innerHTML.indexOf(this._getLocalizedLabels("Expand"))>-1)this._drillAction="drilldown",n(this.element).parents(".e-pivotclient").length>0?(e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+e._id+"_maxView")[0]?n("#"+e._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode?(f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._getChartDrillDown("",f,r):(this._labelCurrentTags.collapsedMembers=n.grep(this._labelCurrentTags.collapsedMembers,function(n){return n!=f}),h=n(this.getJSONRecords().seriesTags).filter(function(n,t){return t.split("::")[2]==f})[0],c=t.olap._mdxParser._splitCellInfo(h),this._getChartDrillDown(h,c,r))):(s=JSON.stringify(this.model.customObject),this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?(f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this._selectedItem=f,t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&(this._labelCurrentTags.expandedMembers=[]),this._labelCurrentTags.expandedMembers.push(f),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),customObject:s,currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess)):(u=this,this._isDrilled||(this._isDrilled=!0,jQuery.each(r.target.parentElement.children,function(n,t){t.innerHTML==r.target.innerHTML&&(u._dimensionIndex=n)})),o=this.getOlapReport(),this._drillAction="drilldown",this._selectedItem=this.model.enableRTL?n.trim(r.target.innerHTML.replace(" - "+this._getLocalizedLabels("Expand"),"")):n.trim(r.target.innerHTML.replace(this._getLocalizedLabels("Expand")+" - ","")),jQuery.each(this._labelCurrentTags,function(n,t){if(t.name==u._selectedItem)return u._tagCollection=[],u._tagCollection=u._selectedTags.slice(),u._selectedTagInfo=t.tag,u._selectedMenuItem=t.name,!1}),this._startDrilldown=!0,this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._drillAction,element:this.element,customObject:this.model.customObject}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,customObject:s}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:this._pivotClientObj.reports,customObject:s}),this.renderControlSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:this._pivotClientObj.reports}),this.renderControlSuccess)));else if(this._drillAction="drillup",n(this.element).parents(".e-pivotclient").length>0?(e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+e._id+"_maxView")[0]?n("#"+e._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode)f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this._getChartDrillDown("",f,r);else if(s=JSON.stringify(this.model.customObject),this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){var f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],l=!1,a=[];jQuery.map(this._labelCurrentTags.expandedMembers,function(n){n==f&&(l=!0);l||a.push(n)});this._selectedItem=f;this._labelCurrentTags.expandedMembers=a;this._currentDrillInfo=n.extend([],this._labelCurrentTags.expandedMembers,!0).concat([f]);n(this.element).parents(".e-pivotclient").length>0&&(this._labelCurrentTags.expandedMembers=[],e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),e._drillParams.length>0&&(e._drillParams=n.grep(e._drillParams,function(n){return n.indexOf(f)<0}),e._getDrilledMember()));this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),customObject:s,currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess)}else o=this.getOlapReport(),this._drillAction="drillup",this._selectedItem=this.model.enableRTL?n.trim(r.target.innerHTML.replace(" - "+this._getLocalizedLabels("Collapse"),"")):n.trim(r.target.innerHTML.replace(this._getLocalizedLabels("Collapse")+" - ","")),this._tagCollection=[],this._tagCollection=this._selectedTags.slice(),u=this,jQuery.each(this._tagCollection,function(n,t){if(t.name==u._selectedItem)return u._selectedIndex=n,u._selectedTagInfo=t.tag,u._tagCollection.splice(n,u._tagCollection.length),!1}),this._tagCollection.length==0&&(this._isDrilled=!1),this._startDrilldown=!0,this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._drillAction,element:this.element,customObject:this.model.customObject}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,customObject:s}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:this._pivotClientObj.reports,customObject:s}),this.renderControlSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:reports}),this.renderControlSuccess)}),t.isNullOrUndefined(this._pivotClientObj))n(window).on("resize",n.proxy(this._reSizeHandler,this));this._on(this.element,"click",".e-chart3DImg",function(i){var r=this;r._createDialog(i);n(".e-chart3DTypesIcon").click(function(n){r._contextMenuClick(n);t.isNullOrUndefined(this._pivotClientObj)||(r._pivotClientObj._unWireEvents(),r._pivotClientObj._wireEvents())})});this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&(this._on(this.element,"click",".e-toolTipImg",function(){var n=this;this.model.commonSeriesOptions.tooltip.visible=!this.model.commonSeriesOptions.tooltip.visible;this.renderChartFromJSON(this.getJSONRecords());this.model.commonSeriesOptions.tooltip.visible?this.element.find(".e-toolTipImg").addClass("e-enabled"):this.element.find(".e-toolTipImg").removeClass("e-enabled")}),this._on(this.element,"click",".e-exportImg",function(t){var i=this;i._createDialog(t);n(".e-exportTypesIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".e-smartLabels",function(t){var i=this;i._createDialog(t);n(".e-smartLabelsIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".e-interaction",function(t){var i=this;i._createDialog(t);n(".e-interactionsIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".e-legend",function(n){var t=this;t._contextMenuClick(n)}),this._on(this.element,"click",".e-zooming",function(n){var t=this;t._contextMenuClick(n)}))},_unWireEvents:function(){this._off(n(document),"keydown",this._keyDownPress);n(document.body).off("click");this._off(this.element,"click",".e-menuList");n(window).off("resize",n.proxy(this._reSizeHandler,this));this._off(this.element,"contextmenu");this._off(this.element,"click",".e-chartTypesImg");this._off(this.element,"click",".e-toolTipImg");this._off(this.element,"click",".e-chart3DImg");this._off(this.element,"click",".e-exportImg");this._off(this.element,"click",".e-legend");this._off(this.element,"click",".e-zooming");this._off(this.element,"click",".e-smartLabels");this._off(this.element,"click",".e-interaction")},_createDialog:function(r){var u=this,f,e,o,s;n(r.target).hasClass("e-exportImg")?(f=t.buildTag("div.e-exportTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-excel e-exportTypesIcon").attr({title:this._getLocalizedLabels("Excel"),"aria-label":this._getLocalizedLabels("Excel"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-word e-exportTypesIcon").attr({title:this._getLocalizedLabels("Word"),"aria-label":this._getLocalizedLabels("Word"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-pdf e-exportTypesIcon").attr({title:this._getLocalizedLabels("Pdf"),"aria-label":this._getLocalizedLabels("Pdf"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-png e-exportTypesIcon").attr({title:this._getLocalizedLabels("PNG"),"aria-label":this._getLocalizedLabels("PNG"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-emf e-exportTypesIcon").attr({title:this._getLocalizedLabels("EMF"),"aria-label":this._getLocalizedLabels("EMF"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-gif e-exportTypesIcon").attr({title:this._getLocalizedLabels("GIF"),"aria-label":this._getLocalizedLabels("GIF"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-jpg e-exportTypesIcon").attr({title:this._getLocalizedLabels("JPG"),"aria-label":this._getLocalizedLabels("JPG"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-bmp e-exportTypesIcon").attr({title:this._getLocalizedLabels("BMF"),"aria-label":this._getLocalizedLabels("BMF"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.e-exportTypesDialog").length==0&&(n(f).appendTo(this.element),n(f).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),this.model.enableRTL&&n(f).addClass("e-rtl"))):n(r.target).hasClass("e-chart3DImg")?(e=t.buildTag("div.e-chart3DTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-column3D e-chart3DTypesIcon").attr({title:this._getLocalizedLabels("ColumnTD"),"aria-label":this._getLocalizedLabels("ColumnTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-pie3D e-chart3DTypesIcon").attr({title:this._getLocalizedLabels("PieTD"),"aria-label":this._getLocalizedLabels("PieTD"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-bar3D e-chart3DTypesIcon").attr({title:this._getLocalizedLabels("BarTD"),"aria-label":this._getLocalizedLabels("BarTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-stackingbar3D e-chart3DTypesIcon").attr({title:this._getLocalizedLabels("StackingBarTD"),"aria-label":this._getLocalizedLabels("StackingBarTD"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-stackingcolumn3D e-chart3DTypesIcon").attr({title:this._getLocalizedLabels("StackingColumnTD"),"aria-label":this._getLocalizedLabels("StackingColumnTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-disable3D e-chart3DTypesIcon")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.e-chart3DTypesDialog").length==0&&(n(e).appendTo(this.element),n(e).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),u.model.enable3D&&n("."+this.model.type+"3D").addClass("e-enabled"),this.model.enableRTL&&n(e).addClass("e-rtl"))):n(r.target).hasClass("e-smartLabels")?(o=t.buildTag("div.e-smartLabelsDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-rotate45 e-smartLabelsIcon").attr({title:this._getLocalizedLabels("Rotate45"),"aria-label":this._getLocalizedLabels("Rotate45"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-rotate90 e-smartLabelsIcon").attr({title:this._getLocalizedLabels("Rotate90"),"aria-label":this._getLocalizedLabels("Rotate90"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-trim e-smartLabelsIcon").attr({title:this._getLocalizedLabels("Trim"),"aria-label":this._getLocalizedLabels("Trim"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-multipleRows e-smartLabelsIcon").attr({title:this._getLocalizedLabels("MultipleRows"),"aria-label":this._getLocalizedLabels("MultipleRows"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-wrap e-smartLabelsIcon").attr({title:this._getLocalizedLabels("Wrap"),"aria-label":this._getLocalizedLabels("Wrap"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-hiding e-smartLabelsIcon").attr({title:this._getLocalizedLabels("Hide"),"aria-label":this._getLocalizedLabels("Hide"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-wrapByWord smartLabelsIcon").attr({title:this._getLocalizedLabels("WrapByWord"),"aria-label":this._getLocalizedLabels("WrapByWord"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.e-smartLabelsDialog").length==0&&(n(o).appendTo(this.element),n(o).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),u.model.primaryXAxis.labelIntersectAction!="none"&&u.model.primaryXAxis.labelIntersectAction!="hide"&&u.model.primaryXAxis.labelIntersectAction!=i&&n("."+u.model.primaryXAxis.labelIntersectAction).addClass("e-enabled"),u.model.primaryXAxis.labelIntersectAction=="hide"&&n(".e-hiding").addClass("e-enabled"),this.model.enableRTL&&n(o).addClass("e-rtl"))):n(r.target).hasClass("e-interaction")&&(s=t.buildTag("div.e-interactionsDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.e-crossHair e-interactionsIcon").attr({title:this._getLocalizedLabels("CrossHair"),"aria-label":this._getLocalizedLabels("CrossHair"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.e-trackBall e-interactionsIcon").attr({title:this._getLocalizedLabels("TrackBall"),"aria-label":this._getLocalizedLabels("TrackBall"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.none e-interactionsIcon").attr({title:this._getLocalizedLabels("None"),"aria-label":this._getLocalizedLabels("None"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.e-interactionsDialog").length==0&&(n(s).appendTo(this.element),n(s).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),this.model.crosshair.type=="crosshair"&&this.model.crosshair.visible&&this.element.find(".e-crossHair").addClass("e-enabled"),this.model.crosshair.type=="trackBall"&&this.model.crosshair.visible&&this.element.find(".e-trackBall").addClass("e-enabled"),this.model.crosshair.visible||this.element.find(".none").addClass("e-enabled"),this.model.enableRTL&&n(s).addClass("e-rtl")))},_contextMenuClick:function(i){chrtObj=n("#"+this._id).data("ejPivotChart");var r=n(this.element).parents(".e-pivotclient").length>0?n(i.target).attr("class").split(" ")[0]:n(i.element).attr("class").split(" ")[0];if(n(i.element).parents().hasClass("chartTypes"))chrtObj.model.enable3D=!1,chrtObj.model.type=chrtObj.model.commonSeriesOptions.type=r,chrtObj.model.type=="funnel"&&(chrtObj.model.commonSeriesOptions.marker={dataLabel:{visible:!0,shape:"none",font:{color:"white",size:"12px",fontWeight:"lighter"}}}),(chrtObj.model.type=="pie"||chrtObj.model.type=="doughnut")&&(chrtObj.model.commonSeriesOptions.explode=!0),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("e-toolTip"))chrtObj.model.commonSeriesOptions.tooltip.visible=!chrtObj.model.commonSeriesOptions.tooltip.visible,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("e-legend")||n(i.target).hasClass("e-legend"))chrtObj.model.legend.visible=!chrtObj.model.legend.visible,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("e-zooming")||n(i.target).hasClass("e-zooming"))chrtObj.model.zooming.enable=!chrtObj.model.zooming.enable,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("e-smartLabels")||n(i.target).hasClass("e-smartLabelsIcon"))chrtObj.model.primaryXAxis.labelIntersectAction=r=="e-hiding"?"hide":r,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("e-interaction")||n(i.target).hasClass("e-interactionsIcon"))r=="crossHair"&&(chrtObj.model.crosshair.type=t.datavisualization.Chart.CrosshairType.Crosshair,chrtObj.model.crosshair.visible=!0),r=="trackBall"&&(chrtObj.model.crosshair.type=t.datavisualization.Chart.CrosshairType.TrackBall,chrtObj.model.crosshair.visible=!0),r=="none"&&(chrtObj.model.crosshair.visible=!1),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("chart3DTypes")||n(i.target).hasClass("e-chart3DTypesIcon"))chrtObj.model.enable3D=!0,r!="e-disable3D"&&(r=r.split("3")[0]),r=="e-disable3D"&&(chrtObj.model.enable3D=!1,r=chrtObj.model.commonSeriesOptions.type),chrtObj.model.type=chrtObj.model.commonSeriesOptions.type=r,r=="e-pie"&&(chrtObj.model.rotation=24),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else{n(this.element).parents(".e-pivotclient").length>0&&!t.isNullOrUndefined(this._pivotClientObj)&&(this.model.beforeExport=this._pivotClientObj.model.beforeExport);switch(r){case"e-excel":case"e-word":case"e-pdf":chrtObj.exportPivotChart(r,"Sample");break;case"e-png":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.PNG);break;case"e-emf":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.EMF);break;case"e-gif":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.GIF);break;case"e-jpg":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.JPG);break;case"e-bmp":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.BMP)}}},generateJSON:function(n,i){var u,r,f;if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&this._labelCurrentTags.expandedMembers.length>0&&!this.model.enableMultiLevelLabels)for(u=0,r=0;r<this._labelCurrentTags.expandedMembers.length;r++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[r])&&this._labelCurrentTags.expandedMembers[r].length>0)for(r>0&&!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[r-1])&&this._labelCurrentTags.expandedMembers[r-1].length>0&&this._cropData(i,this._selectedSeriesInfo[r-1].split("::")[2],r-1+u,!1),f=0;f<this._labelCurrentTags.expandedMembers[r].length;f++)this._cropData(i,this._labelCurrentTags.expandedMembers[r][f].split("::")[2],r+u,!0),u++;this._generateData(i)},_jsonToEngine:function(n){for(var u,f=JSON.parse(n),i=[],r=0;r<f.length;r++)u=parseInt(f[r].Index.split(",")[0]),t.isNullOrUndefined(i[u])?(i[u]=[],i[u].push(f[r])):i[u].push(f[r]);return i},_generateData:function(r){var ht=!1,s,k,o,a,rt,ut,d,v,w,g,b,ct,p,f,ot,u;if(ht=r[2]!=i?r[2].Value=="Olap"||r[2]=="Olap"?!0:!1:r.d!=i?!t.isNullOrUndefined(r.d[2])&&r.d[2].Value=="Olap"?!0:!1:r.AnalysisMode=="Olap"?!0:!1,ht)this.renderControlSuccess(r);else{var e={seriesNames:[],chartLables:[],labelTags:[],multiLevelLabels:[],multiLevelLabelTags:[],seriesTags:[],points_Y:[],labelFormat:[],measureNames:""},tt="",st=[];if(this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&(s={},r[0]!=i?(n(this.element).parents(".e-pivotclient").length>0?s.JsonRecords=t.isNullOrUndefined(r[0].Value)?r[0]:r[0].Value:(s.JsonRecords={},s.JsonRecords.ChartJSON=t.isNullOrUndefined(r[0].Value)?r[0]:r[0].Value,s.JsonRecords.GridJSON=t.isNullOrUndefined(r[3].Value)?r[3]:r[3].Value),s.PivotReport=t.isNullOrUndefined(r[1].Value)?r[1]:r[1].Value,r=s):r.d!=i&&(n(this.element).parents(".e-pivotclient").length>0?s.JsonRecords=!t.isNullOrUndefined(r.d[0])&&r.d[0].Key=="JsonRecords"?r.d[0].Value:[]:(s.JsonRecords={},s.JsonRecords.ChartJSON=!t.isNullOrUndefined(r.d[0])&&r.d[0].Key=="JsonRecords"?r.d[0].Value:[],s.JsonRecords.GridJSON=!t.isNullOrUndefined(r.d[3])&&r.d[3].Key=="GridJSON"?r.d[3].Value:[]),s.PivotReport=!t.isNullOrUndefined(r.d[1])&&(r.d[1].Key=="PivotReport"||r.d[1].Key=="OlapReport")?r.d[1].Value:[],r=s),tt=r.PivotReport||r.OlapReport,r=t.isNullOrUndefined(r.JsonRecords.GridJSON)?t.isNullOrUndefined(r.GridJSON)?r.JsonRecords:this._jsonToEngine(r.GridJSON):this._jsonToEngine(r.JsonRecords.GridJSON),this._pivotEngine=r,st=t.isNullOrUndefined(JSON.parse(tt).values)?JSON.parse(tt).PivotCalculations:JSON.parse(JSON.parse(tt).values),e.labelFormat=n.map(st,function(n){return n.Format.toLowerCase()})),k=r.length,k>0&&r[0].length>0){var et=r[0].length,it=[],nt=[];for(o=this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&!this.model.enableMultiLevelLabels?this.model.dataSource.rows.length-this._labelCurrentTags.expandedMembers.length:this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?r[0][0].ColSpan:this.model.dataSource.rows.length:r[0][0].ColSpan,this.model.enableMultiLevelLabels&&(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode||this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)?a=r[0][0].RowSpan:(a=this.model.dataSource.columns.length,this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?a+=this.model.dataSource.values.length>0?1:0:a=r[0][0].RowSpan),rt="",u=o;u<k;u++){for(ut="",d=!1,f=0;f<a;f++)if(!t.isNullOrUndefined(r[u][f])){if(r[u][f].CSS.indexOf("summary")>=0){d=!0;it.push(u);break}r[u][f].Info.indexOf("Measure")>=0&&rt.indexOf(r[u][f].Value)<0&&(rt+=rt==""?r[u][f].Value:"~~"+r[u][f].Value);ut+=(ut==""?"":r[u][f].Value==""?"":"~~")+r[u][f].Value}d||ut==""||e.seriesNames.push(ut)}for(u=a;u<et;u++)if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){if(this.model.enableMultiLevelLabels&&o>1){this._drillParams=this._drillAction!=""?this._drillParams:[];var c=n.extend(!0,[],this._drillParams.sort()),l=c.length>0?-1:0,ft="";for(u=a;u<et;u++)for(v=c[0],w="",f=0;f<o;f++)w+=w==""?r[f][u].Value:">#>"+r[f][u].Value,(l==-1||ft==""||w==c[1])&&(w==v||w==c[1])&&(w==c[1]&&(v=c[1],c.splice(0,1)),l=f+1,ft=w),!t.isNullOrUndefined(v)&&l>0&&l==o-1&&f==o-1?(nt.push(u),e.chartLables.push(v.split(">#>").join("~~")+"~~"+r[f][u].Value)):!t.isNullOrUndefined(v)&&l>0&&l==f&&r[f][u].CSS.indexOf("summary")>-1?(nt.push(u),e.chartLables.push(v.split(">#>").join("~~")+"~~"+r[f][u].Value.split(" Total")[0])):l-1==f&&r[f][u].CSS.indexOf("summary")>-1?(ft!=""&&(c[0]=c[0].split(">#>").slice(0,c[0].split(">#>").length-1).join(">#>"),c[0]==""&&(c.splice(0,1),ft="")),l=l-1):(l==0||ft=="")&&f==0&&r[0][u].CSS.indexOf("summary")>-1&&(t.isNullOrUndefined(v)?!0:v.split(">#>")[0]!=r[0][u].Value.split(" Total")[0])&&r[f][u].Value!="Grand Total"&&(nt.push(u),e.chartLables.push(r[f][u].Value.split(" Total")[0]))}else o>1?r[0][u].CSS=="summary rstot"&&r[0][u].Value!="Grand Total"&&e.chartLables.push(r[0][u].Value.replace(" Total","")):r[0][u].CSS=="rowheader"&&e.chartLables.push(r[0][u].Value);this.model.enableMultiLevelLabels&&(e.multiLevelLabels=n.extend(!0,[],e.chartLables))}else if(t.isNullOrUndefined(this._labelCurrentTags.collapsedMembers)&&(this._labelCurrentTags.collapsedMembers=[]),o>1){var h="",d=!1,y="";for(f=0;f<o;f++)if(r[f][u].CSS=="rowheader")h+=h==""?r[f][u].Value:(r[f][u].Info!=""&&r[f-1][u].Info!=""&&r[f][u].Info.split("::")[3]==r[f-1][u].Info.split("::")[0]?"#":"~~")+r[f][u].Value,r[f][u].Info.indexOf("[Measures]")==-1&&(y+=y==""?r[f][u].Info:(r[f][u].Info!=""&&r[f-1][u].Info!=""&&r[f][u].Info.split("::")[3]==r[f-1][u].Info.split("::")[0]?"#":"~~")+r[f][u].Info),n.inArray(r[f][u].Value,this._labelCurrentTags.collapsedMembers)<0&&r[f][u].State==2&&this._labelCurrentTags.collapsedMembers.push(r[f][u].Value),n.inArray(r[f][u].Info,e.seriesTags)<0&&r[f][u].Info.indexOf("[Measures]")==-1&&e.seriesTags.push(r[f][u].Info);else if((!this.model.enableMultiLevelLabels||h==""||r[f][u].CSS.indexOf("summary")>=0)&&(this.model.enableMultiLevelLabels?!0:r[f][u].CSS.indexOf("none")==-1&&r[f][u].CSS.indexOf("value")==-1)){d=!0;nt.push(u);break}d||(e.chartLables.push(h),e.labelTags.push(y))}else r[0][u].CSS=="rowheader"&&(e.chartLables.push(r[0][u].Value),e.labelTags.push(r[0][u].Info),e.seriesTags.push(r[0][u].Info)),r[0][u].State==2&&this._labelCurrentTags.collapsedMembers.push(r[0][u].Value);if(this.model.enableMultiLevelLabels)if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){for(g=0,f=0;f<e.multiLevelLabels.length;f++)e.multiLevelLabels[f]=n.map(e.multiLevelLabels[f].split("~~"),function(n){return n+"#1"}).join("~~"),g=e.multiLevelLabels[f].split("~~").length>g?e.multiLevelLabels[f].split("~~").length:g;for(b=0;b<e.multiLevelLabels.length;b++)if(g>1&&e.multiLevelLabels[b].split("~~").length<g){ct=e.multiLevelLabels[b].split("~~")[e.multiLevelLabels[b].split("~~").length-1].split("#1")[0];do e.multiLevelLabels[b]+="~~"+ct+"#0";while(e.multiLevelLabels[b].split("~~").length<g)}}else for(u=a;u<et;u++)if(o>1){var h="",y="",d=!1;for(f=0;f<o;f++)if(r[f][u].CSS=="rowheader")h+=h==""?r[f][u].Value+"#"+r[f][u].Expander:"~~"+(r[f][u].Value+"#"+r[f][u].Expander),y+=y==""?r[f][u].Info+"::"+r[f][u].State:"~~"+(r[f][u].Info+"::"+r[f][u].State);else if(r[f][u].CSS.indexOf("none")>=0&&h!="")h+="~~"+h.split("~~")[h.split("~~").length-1].split("#")[0]+"#"+r[f][u].Expander,y+="~~"+y.split("~~")[y.split("~~").length-1];else if(h==""||r[f][u].CSS.indexOf("summary")>=0||r[f][u].CSS.indexOf("value")>=0){d=r[f][u].CSS.indexOf("summary")>=0?!0:!1;break}d||h==""||(e.multiLevelLabels.push(h),e.multiLevelLabelTags.push(y))}else r[0][u].CSS=="rowheader"&&(e.multiLevelLabels.push(r[0][u].Value+"#"+r[0][u].Expander),e.multiLevelLabelTags.push(r[0][u].Info+"::"+r[0][u].State));for(u=a;u<et;u++)if(p=[],o>1){if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){if(this.model.enableMultiLevelLabels){if(n.inArray(u,nt)>-1){for(f=o;f<k;f++)n.inArray(f,it)<0&&p.push(r[f][u].Value);e.points_Y.push(p)}}else if(r[0][u].CSS=="summary rstot"&&r[0][u].Value!="Grand Total"){for(f=o;f<k;f++)n.inArray(f,it)<0&&p.push(r[f][u].Value);e.points_Y.push(p)}}else if(n.inArray(u,nt)<0){for(f=o;f<k;f++)n.inArray(f,it)<0&&r[f][u].CSS.indexOf("value")>-1&&(p.push(r[f][u].Value==""?0:t.parseFloat(r[f][u].ActualValue)),t.isNullOrUndefined(r[f][u].Format)||(e.labelFormat=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?e.labelFormat.length>0?e.labelFormat==r[f][u].Format?r[f][u].Format:e.labelFormat+"_"+r[f][u].Format:r[f][u].Format:"Number"));e.points_Y.push(p)}}else if(r[0][u].CSS=="rowheader"){for(f=r[0][0].ColSpan;f<k;f++)n.inArray(f,it)<0&&(p.push(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?r[f][u].Value==""?0:t.parseFloat(r[f][u].ActualValue):r[f][u].Value),t.isNullOrUndefined(r[f][u].Format)||(e.labelFormat=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?e.labelFormat.length>0?e.labelFormat==r[f][u].Format?r[f][u].Format:e.labelFormat+"_"+r[f][u].Format:r[f][u].Format:"Number"));e.points_Y.push(p)}}if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)e.measureNames=rt;else for(ot=this.model.enableMultiLevelLabels&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?n(st).map(function(n,t){return t.FieldHeader}):n(this.model.dataSource.values).map(function(n,t){return t.fieldCaption}),u=0;u<ot.length;u++)e.measureNames+=e.measureNames==""?ot[u]:"~"+ot[u];this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?this.renderControlSuccess({JsonRecords:JSON.stringify(e),OlapReport:tt}):this.renderControlSuccess({JsonRecords:JSON.stringify(e),OlapReport:JSON.stringify(this.model.dataSource)});e={}}},_cloneEngine:function(t){for(var r=n.extend(!0,[],t),i=0;i<t.length;i++)r[i]=n.extend(!0,[],t[i]);return r},_cropData:function(n,i,r,u){var e=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?n[0][0].RowSpan:this.model.dataSource.columns.length+(this.model.dataSource.values.length==0||this.model.dataSource.values[0].axis=="rows"?0:1),s,o,f;if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap){s=r;do{for(o=!1,f=0;f<n[r].length;)if(n[r][f].Value==i){o=!0;break}else f++;if(o)break;else r=r==s?n[0][0].ColSpan:r,s="",r--}while(!o&&r>-1)}for(r=r==-1?0:r;e<n[r].length;)if(n[r][e].Value!=i)for(f=0;f<n.length;f++)n[f].splice(e,1);else e+=n[r][e].RowSpan;this.model.analysisMode!=t.PivotChart.AnalysisMode.Olap&&u&&n.splice(r,1)},refreshPagedPivotChart:function(n,t){typeof ochartWaitingPopup!="undefined"&&ochartWaitingPopup!=null&&ochartWaitingPopup.show();n=n.indexOf("categ")!=-1?"categorical":"series";var i;try{i=JSON.parse(this.getOlapReport())}catch(r){i=this.getOlapReport()}this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"paging",pagingInfo:n+":"+t,currentReport:i,customObject:JSON.stringify(this.model.customObject)}),this.renderControlSuccess)},_updatePageSettings:function(t,i){var r=n.map(t,function(n){if(n.Key=="PageSettings")return n}),u=n.map(t,function(n){if(n.Key=="HeaderCounts")return n});r.length>0&&i._pagerObj!=null&&(i._pagerObj.element.css("opacity","1"),i._pagerObj.element.find(".e-pagerTextBox").removeAttr("disabled"),i._pagerObj._unwireEvents(),i._pagerObj._wireEvents(),i._pagerObj.initPagerProperties(JSON.parse(u[0].Value),JSON.parse(r[0].Value)))},renderControlSuccess:function(r){var h,e,o,c,l,f,u,s;typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&(n("#"+this._pivotClientObj._id+"_maxView")[0]?n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}):oclientWaitingPopup.show());try{if(r[0]!=i?(this.setJSONRecords(r[0].Value),this.setOlapReport(r[1].Value),t.isNullOrUndefined(r[2])||r[2].Key!="AnalysisMode"||r[2].Value!="Olap"||(this.model.analysisMode=t.PivotChart.AnalysisMode.Olap),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this.getOlapReport()).Report:r[1].Value,r[2]!=null&&r[2]!=i&&r[2].Key=="ClientReports"&&(this._pivotClientObj.reports=r[2].Value),this._updatePageSettings(r,this._pivotClientObj)),r[2]!=null&&r[2]!=i&&!r[2].Key=="ClientReports"&&r[2].Key!="AnalysisMode"&&(this.model.customObject=r[2].Value),n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&this._pagerObj!=null&&r[2]!=null&&r.d[2]!=i&&this._pagerObj.initPagerProperties(JSON.parse(r.d[3].Value),JSON.parse(r.d[2].Value))):r.d!=i?(this.setJSONRecords(r.d[0].Value),this.setOlapReport(r.d[1].Value),r.d[2].Key=="AnalysisMode"&&r.d[2].Value=="Olap"&&(this.model.analysisMode=t.PivotChart.AnalysisMode.Olap),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=this.model