diff --git a/src/canvasXpress.min.js b/src/canvasXpress.min.js index 5448bb0..8609fdb 100755 --- a/src/canvasXpress.min.js +++ b/src/canvasXpress.min.js @@ -1,6 +1,6 @@ /** * - * CanvasXpress 52.4 - JavaScript Canvas Library + * CanvasXpress 52.5 - JavaScript Canvas Library * * Copyright (c) 2009-2024 - license@canvasxpress.org * @@ -296,8 +296,8 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -(function(b,a){if(typeof exports==="object"){a(exports)}else{(a((b.CanvasXpress=b.CanvasXpress||{})))}}(this,(function(){CanvasXpress=typeof CanvasXpress!="undefined"&&CanvasXpress.ready?CanvasXpress:function(h,e,d,l,c,i,k,g){var f=this;var j=function(){f.init(h,e,d,l,c,i,k,g)};var b=function(m){if(m){f.init(m)}else{f.init(h,e,d,l,c,i,k,g)}};if((d&&d.fonts)||(h&&h.config&&h.config.fonts)){if(d&&d.fonts){CanvasXpress.loadFonts(d.fonts,j)}else{CanvasXpress.loadFonts(h.config.fonts,j)}}else{if((d&&d.fontsExternal)||(h&&h.config&&h.config.fontsExternal)){if(d&&d.fontsExternal){CanvasXpress.loadFontsExternal(d.fontsExternal,j)}else{CanvasXpress.loadFontsExternal(h.config.fontsExternal,j)}}else{if((d&&d.topoJSON&&typeof d.topoJSON=="string")||(h&&h.config&&h.config.topoJSON&&typeof h.config.topoJSON=="string")||(d&&d.useLeaflet)||(h&&h.config&&h.config.useLeaflet)){if((d&&d.useLeaflet)||(h&&h.config&&h.config.useLeaflet)){var a=function(){if(d&&d.topoJSON){CanvasXpress.loadTopoJSON(d.topoJSON,d.mapId,j)}else{if(h&&h.config&&h.config.topoJSON){CanvasXpress.loadTopoJSON(h.config.topoJSON,h.config.mapId,j)}else{j()}}};CanvasXpress.loadLeaflet(a,f)}else{if(d&&d.topoJSON){CanvasXpress.loadTopoJSON(d.topoJSON,d.mapId,j)}else{CanvasXpress.loadTopoJSON(h.config.topoJSON,h.config.mapId,j)}}}else{if((e&&typeof e=="string")||(h&&h.data&&typeof h.data=="string")){if(e){CanvasXpress.loadRemoteData(h,e,d,l,b)}else{CanvasXpress.loadRemoteData(h.renderTo,h.data,h.config,h.events,b)}}else{this.init(h,e,d,l,c,i,k,g)}}}}}})));(function(b,a){if(typeof exports==="object"&&typeof module!=="undefined"){a(exports)}else{(a((b.cxplot=b.cxplot||{})))}}(this,(function(){cxplot=function(v,w,j,a){if(typeof(v)=="object"&&v.isGGPlot){var l=function(g){if(Array.isArray(g)&&!g.length){return{}}else{var f={};for(var m in g){if(g[m]&&typeof g[m]==="string"){f[m]=g[m].replace(/^"(.+)"$/,"$1")}else{f[m]=g[m]}}return f}};var k=function(){if(v.order){v.aes.meta={};for(var f in v.order){v.aes.meta[f]=v.order[f]}}if(!v.aes.hasOwnProperty("x")){for(var f=0;f"}return f};delete (v.isGGPlot);var o=JSON.stringify(v);var n=Array.isArray(v.geoms)?v.geoms:[v.geoms];var d=new cxplot(v.renderTo,v.data,aes(k()),a);var e={};d.skipGeoms=false;d.meta.config.user.geoms=n;d.meta.config.user.layers=v.layers;d.meta.config.user.cxplot=o;for(var q=0;q1){if(c==0){f.x=b[c][d]}else{if(c==1){f.y=b[c][d]}else{if(c==2){f.z=b[c][d]}}}}}else{if(e.includes(d)){if(b[c][d] instanceof Object&&b[c][d].factor){a();f.stringSampleFactors.push(b[c][d].factor);f.stringVariableFactors.push(b[c][d].factor);f.asSampleFactors.push(b[c][d].factor);f.asVariableFactors.push(b[c][d].factor);f[d]=b[c][d].factor}else{if(b[c][d].toString().match(/^factor\(.+\)/)){f[d]=b[c][d].replace(/^factor\(/,"").replace(/\)$/,"");a();f.stringSampleFactors.push(f[d]);f.stringVariableFactors.push(f[d]);f.asSampleFactors.push(f[d]);f.asVariableFactors.push(f[d])}}}else{if(d=="sample"){f.x=b[c][d]}}}}}else{if(c==0){f.x=b[c]}else{if(c==1){f.y=b[c]}else{if(c==2){f.z=b[c]}}}f[b[c]]=b[c]}}}return f}})));CanvasXpress.onReady=function(){var f=[];var a=false;var d=false;var c=function(){if(!a){var g=CanvasXpress.instances[0];if(g){g.iS("canvasXpress JS ready");a=true;for(var h=0;h0){CanvasXpress.instances[0].destroy(b,a)}};CanvasXpress.create=function(c,b,a){CanvasXpress.inject(c);return new CanvasXpress(c,b,a)};CanvasXpress.createObject=function(f,d,b,c,e,h,g,a){if(!f){throw new Error("No target provided")}else{if(typeof(f)=="object"&&f.renderTo){d=f.tracks?{tracks:f.tracks}:f.nodes?{nodes:f.nodes}:f.venn?{venn:f.venn}:f.data?f.data:false;b=f.config||false;if(f.version){b.createVersion=f.version}if(f.factory){b.createFactory=f.factory}c=f.events||false;e=f.info?f.info.replace(/'/g,"'").replace(/"/g,"'"):false;h=f.afterRender||false;g=f.callback||false;a=f.noValidate?f.noValidate:b&&b.noValidate?b.noValidate:false;f=f.renderTo;CanvasXpress.inject(f)}else{if(typeof f==="string"||f instanceof String){CanvasXpress.inject(f)}}}return{target:f,data:d,config:b,events:c,info:e,afterRender:h,callback:g,noValidate:a}};CanvasXpress.inject=function(c){if(typeof c==="string"||c instanceof String){var b=document.getElementById(c);if(b!==null){if(b.tagName.toLowerCase()=="canvas"){if(!b.width){b.width=500}if(!b.height){b.height=500}}else{if(b.tagName.toLowerCase()=="div"){b.id=c+"-div";var a=document.createElement("canvas");a.id=c;a.width=500;a.height=500;b.appendChild(a)}}}else{var a=document.createElement("canvas");a.id=c;a.width=500;a.height=500;document.body.appendChild(a)}}};CanvasXpress.loadFonts=function(d,c){if(d&&d.length&&c){var b=false;for(var a=0;a=0){that.wJ([vi,x,y]);draw=true}}if(draw){arr.unshift(["broadcastDraw",[{func:"afterRender"}],{},t,true])}}};this.afterRendering=true;if(!arr){arr=[]}var t=this.meta.time.start;var v=this.graphType=="Scatter2D"&&this.scatterType=="visium";this.AH();if(this.showHistogram||this.ridgeBy){if(this.showHistogram===true){arr.push(["createHistogram",[false],{},t,true])}else{arr.push(["createHistogram",[this.ridgeBy||this.showHistogram],{},t,true])}}if(this.stringVariableFactors.length){for(var i=0;i0?ar.shift():[];var cn=ar.length>0?ar.shift():{};var tm=ar.length>0?ar.shift():t;var rp=ar.length>0?ar.shift():false;if(this.view=="table"&&fn=="setDimensions"){continue}if(fn=="clickView"){cv=true;continue}if(fn=="updateDataFilter"||fn=="resetDataFilter"){this.skipRender=true}var dr=arr[i+1]&&arr[i+1][0]&&arr[i+1][0].match(/drag/i)?true:false;this.skipRender=fn=="createDOE"||fn=="createHistogram"||fn=="modifyColorScheme"||fn.match(/segregate/)||dr?false:!this.showTransition&&i0&&!CanvasXpress.readyFonts){CanvasXpress.readyFonts=true;return}t.iS("canvasXpress data ready - "+cllr);t.Ki();CanvasXpress.ready=true};if(CanvasXpress.cacheImagesReady){if(cllr=="afterRender"){if(!this.isAnimation&&!this.isTransitionOn&&!this.isUpdateRemoteData){runCallback()}}else{if(this.graphType=="Network"){if(!this.isAnimation&&!this.isUpdateRemoteData){runCallback()}}else{if(!this.isTransitionOn){runCallback()}}}}};this.dU=function(){CanvasXpress.stack[this.target].stateCX.push(this.z9())};this.setView=function(){if(this.view=="table"){this.view="canvas";this.fg()}else{if(this.view=="layout"){this.view="canvas";this.RJ()}}};this.A2=function(){var s=CanvasXpress.stack[this.target];var b=this.Vs();this.w6(false,false,false,false,false,false,b);this.yh(s.afterRenderInit);this.dU();CanvasXpress.current=this.target;this.setView();this.meta.time.end=parseInt(performance.now());this.Hz();this.PI()};this.VL=function(){if(!this.lazyLoad||(!this.loaded&&this.m5(this.meta.canvas.ctx.canvas))){this.A2()}};this.c9=function(o){var t=this;t.wu(o);t.GW("init");t.h3();t.gh(o);t.Ha();t.T4();t.nG();t.Jg();t.zy(o.config);t.hH();t.Ce();t.vX();t.UZ(o.data);t.GW("initData");t.KF();t.t1();t.Xl();t.dG();t.S9(o.data,o.config,o.events,o.info,o.afterRender);t.xV();t.T4();t.VL()};this.c9(o)};CanvasXpress.prototype.initStart=function(){this.initIO();this.initCrypt();this.initDOM();this.initViewport();this.initConfig()};CanvasXpress.prototype.initDataset=function(){this.uY=function(){delete (this.meta.data);this.Ff(false,false,false,true)};this.yi=function(c){if(c){this.meta.data={tracks:[]}}for(var H=0;HF){F=g;K=x[B].length;u=x[B]}}var e=[];for(var B=0;BI){I=h;O=B[H].length;A=B[H]}}c.maxLevLen=I;c.maxLevChr=O;c.maxLevStr=A;c.colors=[];var p=0;for(var H=0;HI){I=h;O=c.levels[H].toString().length;A=c.levels[H]}c.maxLevLen=I;c.maxLevChr=O;c.maxLevStr=A}c.shapes=this.shapes;c.sizes=this.sizes;c.patterns=this.patterns}P[E][G]=c}}}}if(this.decorations.length&&this.decorationsType=="heatmap"){var u=[];P.decorations={};P.decorations.unique=false;P.decorations.type="Numeric";P.decorations.n=0;for(var H=0;HI){I=h;O=P.decorations.levels[H].toString().length;A=P.decorations.levels[H]}P.decorations.maxLevLen=I;P.decorations.maxLevChr=O;P.decorations.maxLevStr=A}}}};this.k8=function(O,af,ac,P,ah){var J=this;var G=this.meta.config.user;var A=this.meta.data;var l=this.data;var C=CanvasXpress.colorSchemes;var p=["x","z","w"];var Y=this.font;var D=function(s,a,r,ai,ak){var t={};if(J.legendOrder&&J.legendOrder[s]){for(var aj=0;ajr[r.length-1]){t--;while(!C[J[ai+"Key"][U]][t]){t--}}else{if(td.length&&d.length==1&&J.graphType=="Map"){var t=S.length;var r=J.pn(C[J.colorScheme]);r.sort(function(aj,j){return aj-j});if(t>r[r.length-1]){t--;while(!C[J.colorScheme][t]){t--}}else{if(tag){ag=t;c=d.levels[s].toString().length;aa=d.levels[s]}d.maxLevLen=ag;d.maxLevChr=c;d.maxLevStr=aa}}else{d[a+"s"]=a=="connect"?J.colors:J[a+"s"]}};if(!O||O=="w"||O=="x"||O=="z"){if(O&&ac){if(!af){delete (A[O])}else{if(A[O][af]){delete (A[O][af])}}}for(var X=0;Xag){ag=E;c=S[V].length;aa=S[V]}}I.maxLevLen=ag;I.maxLevChr=c;I.maxLevStr=aa;Z("color",this.colors,I);Z("shape",this.shapes,I);Z("size",this.Gl(S.length),I);Z("pattern",this.patterns,I);Z("linePattern",this.linePatterns,I);Z("connect",this.colors,I)}else{I.unique=false;I["boolean"]=false;for(var V=0;VA.m[T].maxFacLen){A.m[T].maxFacLen=ad;A.m[T].maxFacChr=b;A.m[T].maxFacStr=W}}else{A.m[T].maxFacLen=ad;A.m[T].maxFacChr=b;A.m[T].maxFacStr=W}}}if(P){return}var w,H,R;if(T=="z"){w="y";H="vars";R="Var"}if(T=="x"||T=="q"){w="y";H="smps";R="Smp"}if(T=="w"){w="w";H="smps";R="Smp"}var ag=0;var c=0;var aa="";if(l[w]){for(var V=0;Vthis.fullTextMeasureCheck){var L=l[w][H][V].toString().length;if(L>c){var E=this.vL(l[w][H][V],Y);if(E>ag){ag=E;c=L;aa=l[w][H][V]}}}else{if(l[w][H][V]!=null){var L=l[w][H][V].toString().length;if(L>=c){var E=this.vL(l[w][H][V].toString(),Y);if(E>ag){ag=E;c=L;aa=l[w][H][V].toString()}}}}}A[w]["max"+R+"Len"]=ag;A[w]["max"+R+"Chr"]=c;A[w]["max"+R+"Str"]=aa;A[w].vars=this.N0(l.y.vars)?"World":this.eX(l.y.vars)?"USA":this.TZ(l.y.vars)?"Date":"String";A[w].smps=this.N0(l.y.smps)?"World":this.eX(l.y.smps)?"USA":this.TZ(l.y.smps)?"Date":"String";if(T=="x"){var ab={};var z=l.y.smps;for(var V=0;Vthis.fullTextMeasureCheck){var L=l.y.vars[V].toString().length;if(L>c){var E=this.vL(l.y.vars[V],Y);if(E>ag){ag=E;c=L;aa=l.y.vars[V]}}}else{if(l.y.vars[V]!=null){var L=l.y.vars[V].toString().length;if(L>=c){var E=this.vL(l.y.vars[V],Y);if(E>ag){ag=E;c=L;aa=l.y.vars[V]}}}}}A.y.maxVarLen=ag;A.y.maxVarChr=c;A.y.maxVarStr=aa;A.y.vars=this.N0(l.y.vars)?"World":this.eX(l.y.vars)?"USA":this.TZ(l.y.vars)?"Date":"String";if(!A.y.range){A.y.range={}}for(var V=0;Vag){ag=E;c=A[O].levels[V].toString().length;aa=A[O].levels[V]}A[O].maxLevLen=ag;A[O].maxLevChr=c;A[O].maxLevStr=aa}A[O].shapes=this.shapes;A[O].sizes=this.sizes;A[O].patterns=this.patterns}else{var S={};for(var V=0;Vag){ag=E;c=S[V].length;aa=S[V]}}A[O].maxLevLen=ag;A[O].maxLevChr=c;A[O].maxLevStr=aa;A[O].type="String";A[O].colors=[];var K=0;for(var V=0;V0){return true}else{if(a=="max"&&b.max&&b.max[0].length>0){return true}else{if(a=="min"&&b.min&&b.min[0].length>0){return true}else{if(a=="count"&&b.count&&b.count[0].length>0){return true}else{if(a=="mean"&&b.mean&&b.mean[0].length>0){return true}else{if(a=="median"&&b.median&&b.median[0].length>0){return true}else{if(a=="iqr"&&b.iqr1&&b.qtl1&&b.median&&b.qtl3&&b.iqr3&&b.median[0].length>0){return true}else{if(a=="raw"&&this.isRawData){return true}else{return false}}}}}}}}}}}}};this.ir=function(at,f,N,ad,H){var T=this;var r=this.isDOE?this.data.l.data[this.layoutCurrent||0]:false;var t=this.isGroupedData&&!f&&this.data.w?this.data.w:this.data.y;var ae=this.graphType=="Scatter2D"&&this.scatterType=="visium"?CanvasXpress.cacheImages[this.backgroundImageMD5||this.RX(this.backgroundImage)]:false;var ap=Number.POSITIVE_INFINITY;var I=Number.NEGATIVE_INFINITY;var z=Number.POSITIVE_INFINITY;var Y=Number.NEGATIVE_INFINITY;if(this.setMin!=null&&this.setMax!=null){this.minData=Number(this.setMin);this.maxData=Number(this.setMax);return}if(this.isGroupedData&&!at&&!r){at=this.graphType=="Boxplot"?"iqr":this.summaryType;if(this.graphType=="Boxplot"&&!this.isBoxplotCalc){this.bD(this.groupingFactors,false,false,false,true);t=this.data.w}}if(this.isGroupedData&&!f&&this.data.w&&!ad&&!r&&!this.layoutCurrent){for(var ah=0;ah=0?F:0;var V=this.data.y.data[this.meterIndex];ap=0;I=this.o1(V,true)}else{if(at=="fish"){if(H=="xAxis"){ap=this.fishTimepoints[0]-((this.fishTimepoints[this.fishTimepoints.length-1]-this.fishTimepoints[0])/5);I=this.fishTimepoints[this.fishTimepoints.length-1]}else{ap=0;I=100}}else{if(at=="genome"){var P=this.data.tracks.length;for(var ah=0;ah=0){var aa=this.hj(this.data.y.data[am]);ap=aa[0];I=aa[1]}else{ap=0;I=1}}}else{if(at=="gantt"){if(!this.data.gantt){this.isGanttDataFormated=false;this.RY()}var ah=this.tM(this.ganttStart);var ag=this.tM(this.ganttEnd);var ao=this.VJ(this.data.gantt);ap=ao[ah].sort(function(d,c){return d-c})[0];I=ao[ag].sort(function(d,c){return c-d})[0]}else{if(at=="km"&&!f){if(!this.layoutValid){this.dZ()}if(H=="y"){ap=0;I=1}else{var Z=this.layoutValid&&this.meta.data.p.l.length?this.meta.data.p.l:this.meta.data.p.g;if(this.layoutValid&&this.meta.data.p.l.length){for(var ah=0;ah0){e+=L}else{if(L<0){g+=L}}}}I=Math.max(e,I);ap=Math.min(g,ap)}}}else{var E=this.isDOE&&this.isDOE==1?this.data.y.vars.length:this.varIndices.length;for(var ah=0;ah0){ap=Math.min(L-W,ap);I=Math.max(L+W,I)}}else{ap=Math.min(L-W,ap);I=Math.max(L+W,I)}}else{if(N){if(L>0){ap=Math.min(L,ap);I=Math.max(L,I)}}else{ap=Math.min(L,ap);I=Math.max(L,I)}}}}}}}}else{if(this.summaryType=="mean"&&!this.isRawData){var P=this.isDOE&&this.isDOE==1?this.data.y.vars.length:this.varIndices.length;for(var ah=0;ah0&&A>0){ap=Math.min(C,ap);I=Math.max(A,I)}}else{ap=Math.min(C,ap);I=Math.max(A,I)}}if(U){var Q=U.length;for(var af=0;af0){ap=Math.min(U[af],ap);I=Math.max(U[af],I)}}else{ap=Math.min(U[af],ap);I=Math.max(U[af],I)}}}}}}}}else{if(at=="cor"){var o=this.correlationAxis=="variables"?this.varIndices:this.isGroupedData?this.grpIndices:this.smpIndices;var P=o.length;for(var ah=0;ah0){ap=Math.min(L,ap);I=Math.max(L,I)}}else{ap=Math.min(L,ap);I=Math.max(L,I)}}}}}else{if(r){var B=H=="xAxis"?0:1;if(this.graphType=="Scatter2D"){for(var ah=0;ah0){if(ad){var S=this.graphType=="Circular"&&this.showIdeogram;var D=S?[this.varIndices,this.smpIndices]:[this.smpIndices,this.varIndices];var x=D[0].length;I=0;ap=0;Y=0;z=0;for(var ah=0;ah0){e+=L}else{if(L<0){g+=L}}}}I=Math.max(e,I);ap=Math.min(g,ap)}}else{var P=this.motionBy||(this.isDOE&&this.isDOE==1)?this.data.y.vars.length:this.varIndices.length;for(var ah=0;ah0){ap=Math.min(L,ap);I=Math.max(L,I)}}else{ap=Math.min(L,ap);I=Math.max(L,I)}}}}}if(this[H+"Transform"]=="sqrt"){ap=Math.sqrt(ap);I=Math.sqrt(I)}}}}}}}}}}}}}}}}}}if(this.graphType=="Boxplot"&&this.showViolinBoxplot&&!this.violinTrim){var w=this.meta.data.d;if(this.isGroupedData){w=w.g;var P=w.length;for(var ah=0;ahNumber.NEGATIVE_INFINITY){if(this.dataPointSizeScaleFactor){ap=Math.min(ap,ac.minY);I=Math.max(I,ac.maxY)}else{ap=ac.minY;I=ac.maxY}}}}}}}}}}if(this.decorations){if(this.decorations.error){for(var ah=0;ah=f&&d<=b))&&(e===null||(c>=e&&c<=a))){j.push(d);g.push(c)}}return[j,g]};this.dL=function(){var I=this;var K=[];var S=function(aw,an,aq){var aa=[];var aj=[];var q=aw.sets||[aw];var ah=0;if(!I.isDOE){for(var av=0;av0?aA[au][1]/ab.position.tot[au]:0);ae[au]=[ad.xy[au][0],ax[au]]}ab.filled[av]=ae.concat(ak.reverse())}if(aq!=null){var az=0;for(var av=0;av1&&I.meta.data.z&&I.meta.data.z.hasOwnProperty(I.segregateVariablesBy[1])){j=I.meta.data.z[I.segregateVariablesBy[1]].levels}}if(I.segregateSamplesBy.length){if(I.meta.data.z&&I.meta.data.z.hasOwnProperty(I.segregateSamplesBy[0])){aa=I.meta.data.z[I.segregateSamplesBy[0]].levels}else{if(I.segregateSamplesBy[0]=="sample"){aa=I.data.y.smps}}if(I.segregateSamplesBy.length>1&&I.meta.data.z&&I.meta.data.z.hasOwnProperty(I.segregateSamplesBy[1])){q=I.meta.data.z[I.segregateSamplesBy[1]].levels}}var k=(l.length||1)*(j.length||1)*(aa.length||1)*(q.length||1);if(ab.length&&ab.length==k){return true}else{return false}};var A=function(ag,ae){var ac=[];var ab=ae||I.segregateVariablesBy[ag];var aj=I.meta.data.z[ab].levels;var ap=I.data;if(!Z.hasOwnProperty("Factor")){Z.Factor={}}var ai=0;for(var am=0;amthis.maxDOENumber){break}}}else{for(var T=0;Tthis.maxDOENumber){break}}}o=true}}}else{if(this.graphType.match(/Scatter|Map/)){if(this.segregateVariablesBy.length&&this.meta.data.z&&this.meta.data.z.hasOwnProperty(this.segregateVariablesBy[0])){var Z=I.meta.data.s.density;var V=A(0);if(this.segregateVariablesBy.length==2||(this.showHistogram!=true&&this.showHistogram!=this.segregateVariablesBy[0])){var e=this.segregateVariablesBy.length==2?this.segregateVariablesBy[1]:this.showHistogram;var U=this.segregateVariablesBy.length==2?A(1):A(false,e);K=[];var h=this.meta.data.z[this.segregateVariablesBy[0]].levels;var f=this.meta.data.z[e].levels;var X=this.data;var N=0;for(var T=0;T5){try{b.loess[o+":"+h[d]]=this.Fq([q[0],q[1]],"Loess:"+o+":"+h[d]+(g!=null?":"+g:""));b.minY=Math.min(b.minY,b.loess[o+":"+h[d]].range[2]);b.maxY=Math.max(b.maxY,b.loess[o+":"+h[d]].range[3])}catch(c){f.push(["setLoessData",q[0].length,o+":"+h[d],c])}}}}else{var l=g!=null?this.data.l.comp[g]:false;var q=this.wD(g,k,r,l);if(q[0].length>5){try{b.loess[o]=this.Fq([q[0],q[1]],"Global:"+o+(g!=null?":"+g:""));b.minY=Math.min(b.minY,b.loess[o].range[2]);b.maxY=Math.max(b.maxY,b.loess[o].range[3])}catch(c){f.push(["setLoessData",q[0].length,o,c])}}}}}};this.l1=function(a,g){var f=this.meta.console;if(!a){if(!this.meta.data.s){this.meta.data.s={regression:{},layout:[]}}else{if(this.meta.data.s&&!this.meta.data.s.hasOwnProperty("regression")){this.meta.data.s.regression={}}}if(this.layoutValid&&this.meta.data.s.layout&&this.meta.data.s.layout.length!=this.data.l.comp.length){for(var e=0;e3){b.regression[p+":"+h[c]]=this.DQ(s[0],s[1],"Regression:"+p+":"+h[c]);b.minY=Math.min(b.minY,b.regression[p+":"+h[c]][4][2]);b.maxY=Math.max(b.maxY,b.regression[p+":"+h[c]][4][3])}else{f.push(["setRegressionData",s[0].length,p+":"+h[c],"Less than 3 values"])}}}else{var o=g!=null?this.data.l.comp[g]:false;var s=this.wD(g,e,d,o);if(s[0].length>3){b.regression[p]=this.DQ(s[0],s[1],"Global:"+p+(g!=null?":"+g:""));b.minY=Math.min(b.minY,b.regression[p][4][2]);b.maxY=Math.max(b.maxY,b.regression[p][4][3])}else{f.push(["setRegressionData",s[0].length,p,"Less than 3 values"])}}}}}else{for(var e=0;e3){b.regression[p+":"+h[d]]=this.DQ(s[0],s[1],"Regression:"+p+":"+h[d]+(g!=null?":"+g:""));b.minY=Math.min(b.minY,b.regression[p+":"+h[d]][4][2]);b.maxY=Math.max(b.maxY,b.regression[p+":"+h[d]][4][3])}else{f.push(["setRegressionData",s[0].length,p+":"+h[d],"Less than 3 values"])}}}else{var o=g!=null?this.data.l.comp[g]:false;var s=this.wD(g,l,r,o);if(s[0].length>3){b.regression[p]=this.DQ(s[0],s[1],"Global:"+p+(g!=null?":"+g:""));b.minY=Math.min(b.minY,b.regression[p][4][2]);b.maxY=Math.max(b.maxY,b.regression[p][4][3])}else{f.push(["setRegressionData",s[0].length,p,"Less than 3 values"])}}}}}};this.ba=function(a,g){var f=this.meta.console;if(!a){if(!this.meta.data.s){this.meta.data.s={quantileRegression:{},layout:[]}}else{if(this.meta.data.s&&!this.meta.data.s.hasOwnProperty("quantileRegression")){this.meta.data.s.quantileRegression={}}}if(this.layoutValid&&this.meta.data.s.layout.length!=this.data.l.comp.length){for(var e=0;e5){try{b.quantileRegression[o+":"+h[d]]=this.Qq(q[0],q[1],this.quantiles,"QuantileRegression:"+o+":"+h[d]+(g!=null?":"+g:""));if(this.f6(b.quantileRegression[o+":"+h[d]])){b.minY=Math.min(b.minY,b.quantileRegression[o+":"+h[d]].range[2]);b.maxY=Math.max(b.maxY,b.quantileRegression[o+":"+h[d]].range[3])}}catch(c){f.push(["setQuantileRegressionData",q[0].length,o+":"+h[d],c])}}}}else{var l=g!=null?this.data.l.comp[g]:false;var q=this.wD(g,k,r,l);if(q[0].length>5){try{b.quantileRegression[o]=this.Qq(q[0],q[1],this.quantiles,"Global:"+o+(g!=null?":"+g:""));if(this.f6(b.quantileRegression[o])){b.minY=Math.min(b.minY,b.quantileRegression[o].range[2]);b.maxY=Math.max(b.maxY,b.quantileRegression[o].range[3])}}catch(c){f.push(["setQuantileRegressionData",q[0].length,o,c])}}}}}};this.Tw=function(b,o){if(!b){if(!this.meta.data.s||(this.layoutValid&&this.meta.data.s.layout.length!=this.data.l.comp.length)){if(!this.meta.data.s){this.meta.data.s={areas:{},layout:[]}}}if(this.layoutValid&&this.meta.data.s.layout.length!=this.data.l.comp.length){for(var f=0;f=0){t[0].push(l[r]);t[1].push(d[r]);s=r}else{if(e==0){t[0].push(h[e]);t[1].push(h[e]=0){g[0].push(r[q]);g[1].push(E[q])}else{g[0].push(k[w]);g[1].push(0)}}if(r.length>5){this.loessSpan=this.scatterStreamBandwidth?Math.max(0.1,this.scatterStreamBandwidth-0.45):0.3;try{var t=this.Fq([g[0],g[1]],"Stream"+s[y]+(D!=null?D:""));for(var w=0;w0){this.cg();for(var c=0;c=1000){alert("Cannot exp transform values > 1000");return false}e=e=="exp2"?"exp2":"exp10"}}if(!g.trans){g.trans=[]}if(!g.tstdev){g.tstdev=[]}var f=this.motionBy?this.data.y.vars.length:this.isGroupedData?this.data.y.vars.length:!this.isDOE?this.data.y.vars.length:this.varIndices.length;for(var c=0;c0){var c=this.transformBase==2?"ratio2":"ratio10";var z=a.data[k][s]/e;var d=a.stdev[k][s];if(c=="ratio2"){a.trans[k][s]=Math.log(z)/Math.LN2;if(d&&d>0){a.tstdev[k][s]=Math.log(d)/Math.LN2}}else{if(c=="ratio10"){a.trans[k][s]=Math.log(z)/Math.LN10;if(d&&d>0){a.tstdev[k][s]=Math.log(d)/Math.LN10}}}}}}};this.kX=function(s,p,o){var c=this.isGroupedData&&!this.graphType.match(/dotplot|boxplot/i)?this.data.w:this.data.y;var k=this.isGroupedData?false:true;var q;p=p?p:this.transformAxis;if(p=="samples"){for(var g=0;g1&&ah.includes("__FACTOR__")){ah=ah.filter(function(a){return a!="__FACTOR__"})}for(var Y=0;Y0?q.join(" :: "):"";if(!w.hasOwnProperty(B)){af.w.smps.push(B);P[B]=U;w[B]=[]}w[B].push(y)}this.isGroupedData=true;if(af.w.smps.length<1){af.w.smps=z;this.Dh({func:"groupSamples",par:[ah,R,r,ac,c,C,ai]});return}if(this.isCxplot&&ah.length==1&&this.meta.data.x&&this.meta.data.x.hasOwnProperty(ah[0])&&this.meta.data.x[ah[0]].levels&&this.meta.data.x[ah[0]].type!="Numeric"){if(this.sortIncludeEmpty){if(this.meta.config.user.aes.hasOwnProperty("meta")){if(ah[0]==this.meta.config.user.aes.x&&this.meta.config.user.aes.meta.hasOwnProperty("xLabels")){var Z=this.tc(this.meta.config.user.aes.meta.xLabels);var ab=false;for(var Y=0;Y360){this.circularArc=360}else{if(this.circularArc<90){this.circularArc=90}}var y=this.circularArc*(Math.PI*2)/360;var p=(y-this.Yu(this.arcSegmentsSeparation)*(this.circularArc==360?B:B-1))/k;var h=[];var f=[];var C=0;for(var F=0;F=0){this.data.y.smps.splice(a,1);for(var a=0;a=0){this.data.y.vars.splice(a,1);this.data.y.data.splice(a,1)}this.k8("y");this.D2(true,true);this.z0()}if(!c){this.Dh({func:"uncountData",par:[]})}};this.rq=function(b,e){if(b){this.data.y.smps.push("__SEQ__");for(var a=0;a=0){this.data.y.smps.splice(a,1);for(var a=0;a=0){this.data.y.vars.splice(a,1);this.data.y.data.splice(a,1)}}this.k8("y");this.D2(true,true);this.z0();if(!c){this.Dh({func:"unsequenceData",par:[]})}};this.yH=function(){var u=this.isDOE?this.data.l.data[this.layoutCurrent]:false;var g=this.isDOE?u.y.data[0]:this.tc(this.data.y.data[this.meterIndex]);var t=this.isDOE?u.y.meter.group:this.meterGroup;var e=this.isDOE?u.x[t]:t?this.tc(this.data.x[t]):false;var h=this.isDOE?u.y.meter.summary:this.meterSummary;var c=this.isDOE?u.y.meter.topology:this.meterTopology;var p=t&&(!this.isDOE||this.isDOE==1)?this.meta.data.x[t]:t&&this.isDOE>1?this.meta.data.z[t]:false;var j=this.isDOE&&this.isDOE>1?this.varIndices:this.smpIndices;this.isMeterSummarized={data:g,count:g.length,sum:this.NC(g),mean:this.UI(g),max:this.o1(g)};var q=this.isMeterSummarized;var a=this.meterSegments.length&&!this.isDOE?this.meterSegments[this.meterSegments.length-1]:false;switch(h){case"count":case"countTotal":q.value=q.count;q.scale=this[this.axisAlgorithm](0,a||q.count,5,false,this.axisWilkinsonLoose);q.reference=q.count;break;case"average":q.value=q.mean;q.scale=this[this.axisAlgorithm](0,a||q.max,5,false,this.axisWilkinsonLoose);q.reference=q.max;break;case"sum":case"sumTotal":q.value=q.sum;q.scale=this[this.axisAlgorithm](0,a||q.sum,5,false,this.axisWilkinsonLoose);q.reference=q.sum;break;case"percentage":case"percentageTotal":q.value=100;q.scale=this[this.axisAlgorithm](0,a||100,5,false,this.axisWilkinsonLoose);q.reference=100;break}q.range=a||q.scale[q.scale.length-1];var k=this.k4();var b=this.isDOE?this.layoutWidth:this.width-(this.marginLeft+this.marginRight);var o=(this.isDOE?this.layoutHeight:this.height)-(k+this.marginTop+this.marginBottom);if(t){if(p&&p.type=="String"){q.n=p.levels.length;let ratio=b/o;let inverseRatio=o/b;let condition=q.n<2&&c=="auto";let condition2=c=="auto"&&ratio>q.n-0.5;let condition3=c=="auto"&&inverseRatio>q.n-0.5;let condition4=c=="horizontal";let condition5=c=="vertical";if(condition||condition2||condition4){q.cols=q.n;q.rows=1}else{if(condition3||condition5){q.cols=1;q.rows=q.n}else{q.cols=Math.ceil(Math.sqrt(q.n));q.rows=Math.ceil(q.n/q.cols)}}q[t]={};q.levels=p.levels;for(var f=0;f0){l[g]++}}}if(!this.data.x){this.data.x={}}this.data.x.Sets=l;a=a.sort(function(s,j){return l[j]-l[s]});if(!this.upSetSets.length){a=a.splice(0,this.nUpSets)}this.isUpSetSumarized.vars=this.tc(a.reverse());a=this.JG(a);var b=[];var o=[];var r=[];var c=[];var e={};var h={};var k=[];for(var g=0;g0){b[g]++;if(a.hasOwnProperty(f)){o.push(f)}}}var q=o.join(":");if(!e.hasOwnProperty(q)){e[q]=[]}e[q].push(g)}this.isUpSetSumarized.inter=e;var p=[];for(var g in e){var d=g.split(":").length;h[g]=e[g].length;if(g!=""){p.push(g)}for(var f=0;f0){var g=[];var e=[];for(var f=0;f0){}this.treemapBy=g}var j=this.graphType.match(/Boxplot|Dotplot|Gantt|Scatter|Map/)||this.graphType=="Tree";if(this.shapeBy&&!this.isMultidimensionalData&&!j){b+="shapeBy changed to false (shapeBy not support in"+this.graphType+")\n";this.shapeBy=false}else{if(this.shapeBy&&this.groupingFactors.length>1&&!j){b+="shapeBy changed to variable (multiple grouping factors not allowed)\n";this.shapeBy="variable"}else{if(this.shapeBy&&this.groupingFactors.length==1&&this.shapeBy!=this.groupingFactors[0]&&!j){b+="shapeBy changed to variable (grouping factor should the same as shapeBy)\n";this.shapeBy="variable"}}}if(this.sizeBy&&!this.isMultidimensionalData&&!j){b+="sizeBy changed to false (sizeBy not support in"+this.graphType+")\n";this.sizeBy=false}else{if(this.sizeBy&&this.groupingFactors.length>1&&!j){b+="sizeBy changed to variable (multiple grouping factors not allowed)\n";this.sizeBy="variable"}else{if(this.sizeBy&&this.groupingFactors.length==1&&this.sizeBy!=this.groupingFactors[0]&&!j){b+="sizeBy changed to variable (grouping factor should the same as sizeBy)\n";this.sizeBy="variable"}}}if(this.colorBy&&this.graphType=="Heatmap"&&!this.isMultidimensionalData){b+="colorBy changed to false (colorBy not support in"+this.graphType+")\n";this.colorBy=false}else{if(this.colorBy&&this.groupingFactors.length>1&&!this.graphType.match(/Boxplot|Dotplot|Gantt|Scatter|Stacked|Treemap/)&&!this.isCxplot){b+="colorBy changed to variable (multiple grouping factors not allowed)\n";this.colorBy="variable"}else{if(this.colorBy&&this.groupingFactors.length==1&&this.colorBy!=this.groupingFactors[0]&&!this.graphType.match(/Boxplot|Dotplot|Gantt|Scatter|Stacked|Treemap|Line/)&&this.barType!="swimmer"){if(this.toDoPivot){this.colorBy=false}else{b+="colorBy changed to variable (grouping factor should the same as colorBy)\n";this.colorBy="variable"}}}}if((this.shapeBy||this.sizeBy||this.patternBy||this.outlineBy)&&!this.colorBy&&!this.isMultidimensionalData&&!this.graphType=="Heatmap"&&!this.isCxplot){this.colorBy="variable"}else{if(!this.shapeBy&&!this.sizeBy&&!this.patternBy&&this.colorBy=="variable"){this.colorBy=h()}}if(this.shapeBy=="variable"&&!this.colorBy&&!this.graphType.match(/Scatter/)){this.colorBy="variable"}if(this.sizeBy=="variable"&&!this.colorBy&&!this.graphType.match(/Scatter/)){this.colorBy="variable"}if(this.patternBy=="variable"&&!this.colorBy&&!this.graphType.match(/Scatter/)){this.colorBy="variable"}if(this.stackBy&&!this.colorBy){this.colorBy=this.stackBy}else{if(this.stackBy&&this.colorBy&&this.stackBy!=this.colorBy){b+="colorBy changed to stackBy (remove stackBy to color by different factor)\n";this.colorBy=this.stackBy}}if(this.dodgeBy&&!this.colorBy){this.colorBy=this.dodgeBy}else{if(this.dodgeBy&&this.colorBy&&this.dodgeBy!=this.colorBy){b+="colorBy changed to dodgeBy (remove dodgeBy to color by different factor)\n";this.colorBy=this.dodgeBy}}if(this.lineBy&&!this.colorBy&&this.isGroupedData){}else{if(this.lineBy&&this.colorBy&&this.lineBy!=this.colorBy&&this.isGroupedData){b+="colorBy changed to lineBy (remove lineBy to color by different factor)\n";this.colorBy=this.lineBy}else{if(this.lineBy&&!this.isGroupedData&&this.graphType!="Scatter2D"){b+="Data needs to be grouped";this.lineBy=false}}}if(b!=""){this.jW(10,10,b,3000)}if(c){this.Ma()}};this.R0=function(e,d){var a=[];if(this.meta.data[e]){for(var b in this.meta.data[e]){if(d&&this.meta.data[e][b].type==d){a.push(b)}else{if(!d){a.push(b)}}}}return a};this.Yg=function(d,f,c,k,e){var l=d.vals.length-1;var g;if((k[e]=="shapes"&&!this.shapeByContinuous)||(k[e]=="sizes"&&!this.sizeByContinuous)){for(var j=0;j=0&&o.w.grps[E]){for(var g=0;g1){return false}}}return true};var f=function(){if(!e.patternBy){if(G>e.colors.length-1&&!e.colorBy){return e[z[F]][Math.floor(G/e.colors.length)]}else{return e[z[F]][0]}}else{return e[z[F]][0]}};var r=F&&this[z[F]]?this[z[F]].length:false;if(G!=null&&E!=null&&u&&o.y.hasOwnProperty(u)){y=o.y[u][G][E];x=H[u];j=x.type}else{if(E!=null&&u&&o.x&&o.x.hasOwnProperty(u)){x=H.x[u];if(C||!this.isGroupedData){j=x.type;y=this.graphType=="Gantt"?o.x[u][E]:this.isGroupedData?o.w.smps[E]:o.x[u][E];if(x[F]&&x[F].hasOwnProperty(y)){return x[F][y]}else{if(F=="colorSmpDendrogramBy"&&x.colorBy&&x.colorBy.hasOwnProperty(y)){return x.colorBy[y]}}}else{if((A&&(this.groupingFactors[0]==u||d()))||(!A&&this.isGroupedData&&this.isCxplot&&this.groupingFactors.length>1)){j=x.type;y=E!==false&&E>=0&&o.w.grps[E]?o.x[u][o.w.grps[E][0]]:false;if(y&&F.match(/color|patternBy/)){if(x[F]&&x[F].hasOwnProperty(y)){return x[F][y]}else{if(x[z[F]]){return x[z[F]][x.order[y]%r]}else{return this[z[F]][x.order[y]%r]}}}else{return x[z[F]]?x[z[F]][0]:F.match(/color/)?this[z[F]][0]:F=="patternBy"?f():this[z[F]][0]}}else{return G!=null&&F.match(/color/)?this[z[F]][G%r]:F=="patternBy"?f():this[z[F]][0]}}}else{if(G!=null&&u&&o.z&&o.z.hasOwnProperty(u)){x=H.z[u];j=x.type;y=o.z[u][G];if(x[F]&&(x[F].hasOwnProperty(y)||x[F][y])){return x[F][y]}else{if(x[F]&&(x[F].hasOwnProperty(y+"\x00")||x[F][y+"\x00"])){return x[F][y+"\x00"]}else{if(x[F]&&x[F][y.replace("\x00","")]){return x[F][y.replace("\x00","")]}else{if(F=="colorVarDendrogramBy"&&x.colorBy&&x.colorBy.hasOwnProperty(y)){return x.colorBy[y]}else{if(x[F]&&F=="linePatterns"&&x.order&&x.order.hasOwnProperty(y)){return x[F][x.order[y]%this[F].length]}}}}}}else{if(G!=null&&E!=null&&F&&((this.isGroupedData&&H.w.smps.hasOwnProperty(F))||(!this.isGroupedData&&H.y.range.hasOwnProperty(F)))){y=o.y.data[G][E];x=H.y.range[F];j=H.y.type}else{if(G!=null&&!this.isGroupedData&&u&&H.y.range.hasOwnProperty(u)){x=H.y.range[u];j=x.type;k=E!=null?false:this.qT(u);y=E!=null?o.y.data[G][E]:o.y.data[G]?o.y.data[G][k>=0?k:0]:0;if(H.modified&&H.modified.z&&H.modified.z[u]){return this[z[F]][y%r]}else{if(!x.colorBrew){x.colorBrew=this.P8(false,x.min,x.max);x.vals=x.colorBrew.vals}}}else{if(G!=null){if(u){return this[z[F]][G%r]}else{return !u&&F.match(/color/)?this[z[F]][G%r]:F=="patternBy"?f():this[z[F]][0]}}else{return this[z[F]][0]}}}}}}if(j=="Numeric"){if(F.match(/color|outlineBy/)){return !isNaN(y)&&y!==null?this.s8(x.colorBrew,Number(y)):this.missingDataColor}else{if(F.match(/shapeBy/)){if(!isNaN(y)){return this.shapeByContinuous?"pie"+this.Yg(x,y,true,z,F):this[z[F]][this.Yg(x,y,true,z,F)]}else{return"sphere"}}else{if(F.match(/sizeBy/)){if(!isNaN(y)){return this.sizeByContinuous?this.PR(x,y,z[F]):this.Yg(x,y,false,z,F)}else{return this[z[F]][0]}}else{if(F.match(/patternBy/)){if(!isNaN(y)){return this.Yg(x,y,false,z,F)}else{return"closed"}}}}}}else{if(j=="String"){if(x[z[F]]){if(w){if(F=="sizeLabelBy"){return this.m8([5,9,13,17,21],this.IK(x[z[F]][0],x[z[F]][x[z[F]].length-1],x[z[F]][x.order[y]%x[z[F]].length])/100)}else{return this.IK(x[z[F]][0],x[z[F]][x[z[F]].length-1],x[z[F]][x.order[y]%x[z[F]].length])}}else{return F=="sizeBy"?parseInt(x[z[F]][x.order[y]%x[z[F]].length]):x[z[F]][x.order[y]%x[z[F]].length]}}else{return F=="sizeBy"?parseInt(this[z[F]][x.order[y]%this[z[F]].length]):this[z[F]][x.order[y]%this[z[F]].length]}}}};this.QN=function(a,t){var s=this.meta.data;var d=this.data;var u=this.graphType=="Network"?["nodes","edges"]:["x","z"];if(a&&t){t.colors=a;t.connects=a}else{for(var p=0;p1){e=false;var a=this.groupingFactors.indexOf(this.colorBy);for(var c=0;c1){e=false;var a=this.groupingFactors.indexOf(this.shapeBy);for(var c=0;c=0){d.splice(a,1).join(" :: ")}else{d=d.join(" :: ")}this.data.w.smps[b]=d}}}}if(this.data.w){this.k8("w")}};this.Mk=function(b,f,c){if(b!=null&&f){if(!c){c=this.Ad(f)}var e=[];if(this.pv(b)){if(this.pv(f)){var g=b.length;for(var d=0;dl})}}}}return j};this.wn=function(k,e,b,j,g){var r=[];var d=this.data[j];if(d&&k&&d[k]){if(e){for(var f=0;f=0){g=[g]}else{g=false}}}if(g&&g.length){for(var f=0;f=0||j>=0)){var a=[];for(var g=0;g=0){for(var g=0;g=0)||(e>=0&&r<0)){this.scatterType=false;return}else{if(e>=0&&r>=0){for(var g=0;g=0?f:0}if(this.hierarchy.length>0){if(!this.data[b]||(this.data[b].hierarchy&&!this.Hl(this.data[b].hierarchy,this.hierarchy))){this.data[b]={};this.data[b]["data"]={name:this.hierarchy[0],children:[]};for(var f=0;f2||this.isDOE){this.validGraphTypes.push("Scatter2D");this.validGraphTypes.push("ScatterBubble2D");this.validGraphTypes.push("Scatter3D")}else{if(this.data.y.smps.length>1||this.isDOE){this.validGraphTypes.push("Scatter2D")}}}}this.validGraphTypes.sort();this.Ff(false,false,a)}}};CanvasXpress.prototype.initAesthetics=function(){this.initLegendUtils();this.initMarkerUtils()};CanvasXpress.prototype.initScale=function(){};CanvasXpress.prototype.initGeometry=function(){this.initPrimitives();this.initUtils();this.initGraph()};CanvasXpress.prototype.initStatistics=function(){this.initNumeric();this.initjLouvain();this.initCola();this.initMathUtils();this.initSankeyUtils();this.initTreeUtils();this.initCirclePackUtils();this.initNetworkUtils();this.initComplex();this.initFFT();this.initContour();this.initDensity();this.initHist();this.initLoess();this.initQuantreg();this.initLAPACK();this.initClusterUtils()};CanvasXpress.prototype.initFacets=function(){this.initLayout()};CanvasXpress.prototype.initCoordinates=function(){this.initAxes()};CanvasXpress.prototype.initTheme=function(){this.jY=function(b){var a=b.toLowerCase().replace(/ /g,"");switch(a){case"grey":case"gray":case"igray":case"ggplot":return CanvasXpress.themeDef.grey;case"bw":case"blackandwhite":return CanvasXpress.themeDef.bw;case"linedraw":return CanvasXpress.themeDef.linedraw;case"light":return CanvasXpress.themeDef.light;case"dark":return CanvasXpress.themeDef.dark;case"minimal":return CanvasXpress.themeDef.minimal;case"classic":return CanvasXpress.themeDef.classic;case"void":case"void0":return CanvasXpress.themeDef.void0;case"economist":return CanvasXpress.themeDef.economist;case"excel":return CanvasXpress.themeDef.excel;case"solarized":return CanvasXpress.themeDef.solarized;case"paulTol":case"ptol":return CanvasXpress.themeDef.ptol;case"highcharts":return CanvasXpress.themeDef.highcharts;case"wallstreetjournal":case"wallstreet":case"wsj":return CanvasXpress.themeDef.wsj;case"tableau":return CanvasXpress.themeDef.tableau;case"stata":return CanvasXpress.themeDef.stata;case"ggblanket":return CanvasXpress.themeDef.ggblanket;case"cx":case"canvasxpress":return CanvasXpress.themeDef.cx;default:return CanvasXpress.themeDef.light}};this.hM=function(b){if(!b){b="x"}var e=["AxisShow","Axis2Show","AxisTitleColor","AxisTitleScaleFontFactor","AxisTextColor","AxisTextScaleFontFactor","AxisTicksShow","AxisTicksColor","AxisTicksLength","AxisTicksWidth","AxisLineBottomShow","AxisLineBottomColor","AxisLineBottomLineType","AxisLineBottomWidth","AxisLineTopShow","AxisLineTopColor","AxisLineTopLineType","AxisLineTopWidth","AxisGridMajorShow","AxisGridMajorColor","AxisGridMajorLineType","AxisGridMajorWidth","AxisGridMinorShow","AxisGridMinorColor","AxisGridMinorLineType","AxisGridMinorWidth"];var f=["r","z"];for(var d=0;d0&&!this.skipTransition&&this.showTransition){delete (a.transition);if(!d){if(this.graphType=="Network"&&!this.isLayoutDone){}else{a.transition=this.tc(a)}}}if(!c){a.objects=[];a.groups={};a.types={};a.order=[];a.map={};a.origin=[]}b.resetRender();b.resetContext()};this.pO=function(k,f,h){if(!this.skipRender){this.GW("render - start");var j=this.TO();var c=this.meta.render.objects;var g=0;if(c.length>0){if(!k){k=0}if(!f){f=c.length}for(var d=k;d";return t};if(CanvasXpress.icons.use.hasOwnProperty(f)){var h='';if(CanvasXpress.icons.gradients.hasOwnProperty(f)){var hh=CanvasXpress.icons.gradients[f].replace(/"/g,'"');hh=hh.replace(/s=/g,"style=");hh=hh.replace(/o=/g,"offset=");hh=hh.replace(/c=/g,"stop-color=");hh=hh.replace(/t=/g,"gradientTransform=");hh=hh.replace(/u=/g,"gradientUnits=");hh=hh.replace(/<\/s/g,""+a.title+"":"";if(o){for(var g in o){b.style[g]=o[g]}}b.innerHTML=z+l+h}return m?new XMLSerializer().serializeToString(b):b};this.$cXIU=function(b,e,a,l){try{CanvasXpress}catch(f){return false}var j="";var d=function(p){var n={};var k=p.split(/class=|c=/);var s="";s=s.replace(/l:/g,"stroke-miterlimit:");s=s.replace(/w:/g,"stroke-width:");s=s.replace(/n:/g,"font:");s=s.replace(/s:/g,"stroke:");s=s.replace(/f:/g,"fill:");return s};if(b&&CanvasXpress.icons.use.hasOwnProperty(e)){var g="";if(CanvasXpress.icons.gradients.hasOwnProperty(e)){g+=CanvasXpress.icons.gradients[e].replace(/"/g,'"');g=g.replace(/"/g,'"').replace(/'/g,"'");g=g.replace(/<\/y/g,"'+g;var h=d(g);if(a){for(var f in a){if(f=="className"){b.setAttribute("class",a[f])}else{b.setAttribute(f,a[f]);if(f=="title"){j=""+a[f]+""}}}}if(l){for(var f in l){b.style[f]=l[f]}}b.innerHTML=j+h+g}};this.$p=function(s){var t=this;var w=window;var q=t.$w;var p=t[q(0)];var u=t[q(0,true)];var r=s?p:!p?false:!u;if(w[q(8)][q(15)]&&!w[q(8)][q(15)].length){r=true}if(!s&&r){w[q(40)]=function(){return false}}return r};this.$pX=function(c){var t=this;var q=t.$w;var p=t.$(t.target+q(2));if(c&&p){var x=t[q(0)];if(x){var e=t[q(10)](x);if(e==p.value){t[q(0,true)]=true;return true}else{return false}}else{return false}}else{if(p&&p.value!=""){var e=t[q(9)](p.value);t[q(0)]=e;t[q(0,true)]=true;return e}else{return false}}};this.db=function(s){var h="";for(var i=0;i50?CanvasXpress.colorWords[i]:n?q(CanvasXpress.colorWords[i].split("").reverse().join("")).split("").reverse().join(""):q(CanvasXpress.colorWords[i].split("").reverse().join(""))};this.js=function(){try{CanvasXpress}catch(f){return false}if(CanvasXpress.instances.length==1){this.beaconImage=this.$cX("img",{id:this.target+"-cX-Beacon-Image",src:(window.navigator.onLine?"https://www.canvasxpress.org/assets/images/beacon.gif?"+CanvasXpress.factory.client:CanvasXpress.png),title:"",alt:""})}else{this.beaconImage=CanvasXpress.instances[0].beaconImage}};this.$$=function(){try{CanvasXpress}catch(f){return false}var o=this;var j=CanvasXpress;var g=function(i){if(!i){i=j[h[4]]}else{if(i.length>36){return 0}}var c=i.length;var f=Number(i.substring(2,3));var d=Number(i.substring(c-3,c-2));var q=i.substring(3+f,3+f+5)[h[7]]("")[h[8]]()[h[9]]("");var m=i.substring(c-(3+d+5),c-(3+d));return Number(q+""+m+"000")};var l=["686578546f537472696e67","6472617754657874","666163746f7279","73797374656d","72656769737465726564","76616c6964","737562737472696e67","73706c6974","72657665727365","6a6f696e","43616e766173587072657373","4e6f7420612076616c696420636f7079206f6620","556e737570706f727465642056657273696f6e206f6620","20522056657273696f6e","204e6f64652056657273696f6e","697352566965776572","697352436f6e736f6c65","68726566","2f7777772e63616e7661737870726573732e6f72672f646973742f","72616e646f6d496e744265747765656e","666f6e7453697a65","666f6e744e616d65","69734378706c6f74","6378706c6f742042792043616e766173587072657373","736574506978656c496d616765","64697361626c65426561636f6e"];var h=[];for(var e=0;e1200?24:s>800?20:s>500?16:s>300?12:8;for(var i=0;i=0&&b.top>=0&&c<=w[0]&&m<=w[1]};this.RO=function(e,n){return e?e.classList.contains(n):false};this.TT=function(e,n){if(e){e.classList.add(n)}};this.X0=function(e,n){if(e){e.classList.remove(n)}};this.Tg=function(e,r,a){if(e){e.classList.remove(r);e.classList.add(a)}};this.Rs=function(e){var s="";var o=getComputedStyle(e);for(var i=0;i0?1:-1)*Math.floor(Math.abs(number))};var maxSafeInteger=Math.pow(2,53)-1;var toLength=function(value){var len=toInteger(value);return Math.min(Math.max(len,0),maxSafeInteger)};return function from(arrayLike){var C=this;var items=Object(arrayLike);if(arrayLike==null){throw new TypeError("Array.from requires an array-like object - not null or undefined")}var mapFn=arguments.length>1?arguments[1]:void undefined;var T;if(typeof mapFn!=="undefined"){if(!isCallable(mapFn)){throw new TypeError("Array.from: when provided, the second argument must be a function")}if(arguments.length>2){T=arguments[2]}}var len=toLength(items.length);var A=isCallable(C)?Object(new C(len)):new Array(len);var k=0;var kValue;while(k>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var finl=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k>>0;if(typeof callback!=="function"){throw new TypeError(callback+" is not a function")}if(arguments.length>1){T=arguments[1]}A=new Array(len);k=0;while(k>>0;if(typeof predicate!=="function"){throw new TypeError("predicate must be a function")}var thisArg=arguments[1];var k=0;while(k>>0;if(len===0){return false}var n=fromIndex|0;var k=Math.max(n>=0?n:len-Math.abs(n),0);function sameValueZero(x,y){return x===y||(typeof x==="number"&&typeof y==="number"&&isNaN(x)&&isNaN(y))}while(kA){var G=A;A=u;u=G}}var o=this.NB(u,A,4);u=o[0];A=o[o.length-1];var y=A-u;var a=(((y*1000000)-(parseInt(y)*1000000))/1000000).toString().replace(/\./,"").length-1;var e=Math.pow(1/10,(a+1));var C=u>0?Math.log10(u):u==0?0:null;var E=A>0?Math.log10(A):A==0?0:null;var c=[];var Q="CanvasXpressRangeSlider";if(C!=null&&E!=null){var I=this.NB(C,E,4);for(var B=0;B1){m=l;m.width=arguments[0];m.height=arguments[1]}else{if(!n){m=l}else{m=n}}if(!(this instanceof k)){return new k(m)}this.width=m.width||l.width;this.height=m.height||l.height;this.desc=m.desc||l.desc;this.enableMirroring=m.enableMirroring!==undefined?m.enableMirroring:l.enableMirroring;this.canvas=this;this.__document=m.document||document;if(m.ctx){this.__ctx=m.ctx}else{this.__canvas=this.__document.createElement("canvas");this.__ctx=this.__canvas.getContext("2d")}this.__setDefaultStyles();this.__stack=[this.__getStyleState()];this.__groupStack=[];this.__root=this.__document.createElementNS("http://www.w3.org/2000/svg","svg");this.__root.setAttribute("version",1.1);this.__root.setAttribute("xmlns","http://www.w3.org/2000/svg");this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");this.__root.setAttribute("width",this.width);this.__root.setAttribute("height",this.height);this.__root.setAttribute("desc",this.desc);this.__ids={};this.__defs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs");this.__root.appendChild(this.__defs);this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g");this.__root.appendChild(this.__currentElement)};k.prototype.__createElement=function(l,p,r){if(typeof p==="undefined"){p={}}var o=this.__document.createElementNS("http://www.w3.org/2000/svg",l),q=Object.keys(p),n,m;if(r){o.setAttribute("fill","none");o.setAttribute("stroke","none")}for(n=0;n0){if(this.__currentElement.nodeName==="path"){if(!this.__currentElementsToStyle){this.__currentElementsToStyle={element:n,children:[]}}this.__currentElementsToStyle.children.push(this.__currentElement);this.__applyCurrentDefaultPath()}var o=this.__createElement("g");n.appendChild(o);this.__currentElement=o}var l=this.__currentElement.getAttribute("transform");if(l){l+=" "}else{l=""}l+=m;this.__currentElement.setAttribute("transform",l)};k.prototype.scale=function(l,m){if(m===undefined){m=l}this.__addTransform(g("scale({x},{y})",{x:l,y:m}))};k.prototype.rotate=function(m){var l=(m*180/Math.PI);this.__addTransform(g("rotate({angle},{cx},{cy})",{angle:l,cx:0,cy:0}))};k.prototype.translate=function(l,m){this.__addTransform(g("translate({x},{y})",{x:l,y:m}))};k.prototype.transform=function(m,l,q,p,o,n){this.__addTransform(g("matrix({a},{b},{c},{d},{e},{f})",{a:m,b:l,c:q,d:p,e:o,f:n}))};k.prototype.beginPath=function(){var m,l;this.__currentDefaultPath="";this.__currentPosition={};m=this.__createElement("path",{},true);l=this.__closestGroupOrSvg();l.appendChild(m);this.__currentElement=m};k.prototype.__applyCurrentDefaultPath=function(){var l=this.__currentElement;if(l.nodeName==="path"){l.setAttribute("d",this.__currentDefaultPath)}else{console.error("Attempted to apply path command to node",l.nodeName)}};k.prototype.__addPathCommand=function(l){this.__currentDefaultPath+=" ";this.__currentDefaultPath+=l};k.prototype.moveTo=function(l,m){if(this.__currentElement.nodeName!=="path"){this.beginPath()}this.__currentPosition={x:l,y:m};this.__addPathCommand(g("M {x} {y}",{x:l,y:m}))};k.prototype.closePath=function(){if(this.__currentDefaultPath){this.__addPathCommand("Z")}};k.prototype.lineTo=function(l,m){this.__currentPosition={x:l,y:m};if(this.__currentDefaultPath.indexOf("M")>-1){this.__addPathCommand(g("L {x} {y}",{x:l,y:m}))}else{this.__addPathCommand(g("M {x} {y}",{x:l,y:m}))}};k.prototype.bezierCurveTo=function(n,m,p,o,l,q){this.__currentPosition={x:l,y:q};this.__addPathCommand(g("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:n,cp1y:m,cp2x:p,cp2y:o,x:l,y:q}))};k.prototype.quadraticCurveTo=function(n,m,l,o){this.__currentPosition={x:l,y:o};this.__addPathCommand(g("Q {cpx} {cpy} {x} {y}",{cpx:n,cpy:m,x:l,y:o}))};var b=function(m){var l=Math.sqrt(m[0]*m[0]+m[1]*m[1]);return[m[0]/l,m[1]/l]};k.prototype.arcTo=function(F,o,E,n,q){var G=this.__currentPosition&&this.__currentPosition.x;var p=this.__currentPosition&&this.__currentPosition.y;if(typeof G=="undefined"||typeof p=="undefined"){return}if(q<0){throw new Error("IndexSizeError: The radius provided ("+q+") is negative.")}if(((G===F)&&(p===o))||((F===E)&&(o===n))||(q===0)){this.lineTo(F,o);return}var u=b([G-F,p-o]);var t=b([E-F,n-o]);if(u[0]*t[1]===u[1]*t[0]){this.lineTo(F,o);return}var m=(u[0]*t[0]+u[1]*t[1]);var v=Math.acos(Math.abs(m));var B=b([u[0]+t[0],u[1]+t[1]]);var r=q/Math.sin(v/2);var A=F+r*B[0];var z=o+r*B[1];var l=[-u[1],u[0]];var w=[t[1],-t[0]];var s=function(I){var H=I[0];var J=I[1];if(J>=0){return Math.acos(H)}else{return -Math.acos(H)}};var D=s(l);var C=s(w);this.lineTo(A+l[0]*q,z+l[1]*q);this.arc(A,z,q,D,C)};k.prototype.stroke=function(){if(this.__currentElement.nodeName==="path"){this.__currentElement.setAttribute("paint-order","fill stroke markers")}this.__applyCurrentDefaultPath();this.__applyStyleToCurrentElement("stroke")};k.prototype.fill=function(){if(this.__currentElement.nodeName==="path"){this.__currentElement.setAttribute("paint-order","stroke fill markers")}this.__applyCurrentDefaultPath();this.__applyStyleToCurrentElement("fill")};k.prototype.rect=function(m,o,n,l){if(this.__currentElement.nodeName!=="path"){this.beginPath()}this.moveTo(m,o);this.lineTo(m+n,o);this.lineTo(m+n,o+l);this.lineTo(m,o+l);this.lineTo(m,o);this.closePath()};k.prototype.fillRect=function(m,q,o,l){var p,n;p=this.__createElement("rect",{x:m,y:q,width:o,height:l},true);n=this.__closestGroupOrSvg();n.appendChild(p);this.__currentElement=p;this.__applyStyleToCurrentElement("fill")};k.prototype.strokeRect=function(m,q,o,l){var p,n;p=this.__createElement("rect",{x:m,y:q,width:o,height:l},true);n=this.__closestGroupOrSvg();n.appendChild(p);this.__currentElement=p;this.__applyStyleToCurrentElement("stroke")};k.prototype.__clearCanvas=function(){var o=this.__closestGroupOrSvg(),l=o.getAttribute("transform");var n=this.__root.childNodes[1];var p=n.childNodes;for(var m=p.length-1;m>=0;m--){if(p[m]){n.removeChild(p[m])}}this.__currentElement=n;this.__groupStack=[];if(l){this.__addTransform(l)}};k.prototype.clearRect=function(m,q,o,l){if(m===0&&q===0&&o===this.width&&l===this.height){this.__clearCanvas();return}var p,n=this.__closestGroupOrSvg();p=this.__createElement("rect",{x:m,y:q,width:o,height:l,fill:"#FFFFFF"},true);n.appendChild(p)};k.prototype.createLinearGradient=function(m,o,l,n){var p=this.__createElement("linearGradient",{id:h(this.__ids),x1:m+"px",x2:l+"px",y1:o+"px",y2:n+"px",gradientUnits:"userSpaceOnUse"},false);this.__defs.appendChild(p);return new i(p,this)};k.prototype.createRadialGradient=function(o,q,n,m,p,l){var r=this.__createElement("radialGradient",{id:h(this.__ids),cx:m+"px",cy:p+"px",r:l+"px",fx:o+"px",fy:q+"px",gradientUnits:"userSpaceOnUse"},false);this.__defs.appendChild(r);return new i(r,this)};k.prototype.__parseFont=function(){var m=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i;var l=m.exec(this.font);var n={style:l[1]||"normal",size:l[4]||"10px",family:l[6]||"sans-serif",weight:l[3]||"normal",decoration:l[2]||"normal",href:null};if(this.__fontUnderline==="underline"){n.decoration="underline"}if(this.__fontHref){n.href=this.__fontHref}return n};k.prototype.__wrapTextLink=function(m,n){if(m.href){var l=this.__createElement("a");l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m.href);l.appendChild(n);return l}return n};k.prototype.__applyText=function(q,l,r,p){var n=this.__parseFont(),o=this.__closestGroupOrSvg(),m=this.__createElement("text",{"font-family":n.family,"font-size":n.size,"font-style":n.style,"font-weight":n.weight,"text-decoration":n.decoration,x:l,y:r,"text-anchor":f(this.textAlign),"dominant-baseline":c(this.textBaseline)},true);m.appendChild(this.__document.createTextNode(q));this.__currentElement=m;this.__applyStyleToCurrentElement(p);o.appendChild(this.__wrapTextLink(n,m))};k.prototype.fillText=function(m,l,n){this.__applyText(m,l,n,"fill")};k.prototype.strokeText=function(m,l,n){this.__applyText(m,l,n,"stroke")};k.prototype.measureText=function(l){this.__ctx.font=this.font;return this.__ctx.measureText(l)};k.prototype.arc=function(t,s,q,r,m,v){if(r===m){return}r=r%(2*Math.PI);m=m%(2*Math.PI);if(r===m){m=((m+(2*Math.PI))-0.001*(v?-1:1))%(2*Math.PI)}var z=t+q*Math.cos(m),w=s+q*Math.sin(m),p=t+q*Math.cos(r),o=s+q*Math.sin(r),n=v?0:1,l=0,u=m-r;if(u<0){u+=2*Math.PI}if(v){l=u>Math.PI?0:1}else{l=u>Math.PI?1:0}this.lineTo(p,o);this.__addPathCommand(g("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:q,ry:q,xAxisRotation:0,largeArcFlag:l,sweepFlag:n,endX:z,endY:w}));this.__currentPosition={x:z,y:w}};k.prototype.clip=function(){var m=this.__closestGroupOrSvg(),l=this.__createElement("clipPath"),o=h(this.__ids),n=this.__createElement("g");this.__applyCurrentDefaultPath();m.removeChild(this.__currentElement);l.setAttribute("id",o);l.appendChild(this.__currentElement);this.__defs.appendChild(l);m.setAttribute("clip-path",g("url(#{id})",{id:o}));m.appendChild(n);this.__currentElement=n};k.prototype.drawImage=function(){var n=Array.prototype.slice.call(arguments),z=n[0],u,t,v,F,x=0,w=0,C,G,s,y,l,q,o,D,p,m,B;if(n.length===3){u=n[1];t=n[2];C=z.width;G=z.height;v=C;F=G}else{if(n.length===5){u=n[1];t=n[2];v=n[3];F=n[4];C=z.width;G=z.height}else{if(n.length===9){x=n[1];w=n[2];C=n[3];G=n[4];u=n[5];t=n[6];v=n[7];F=n[8]}else{throw new Error("Inavlid number of arguments passed to drawImage: "+arguments.length)}}}s=this.__closestGroupOrSvg();o=this.__currentElement;var r="translate("+u+", "+t+")";if(z instanceof k){y=z.getSvg().cloneNode(true);if(y.childNodes&&y.childNodes.length>1){l=y.childNodes[0];while(l.childNodes.length){B=l.childNodes[0].getAttribute("id");this.__ids[B]=B;this.__defs.appendChild(l.childNodes[0])}q=y.childNodes[1];if(q){var E=q.getAttribute("transform");var A;if(E){A=E+" "+r}else{A=r}q.setAttribute("transform",A);s.appendChild(q)}}}else{if(z.nodeName==="CANVAS"||z.nodeName==="IMG"){D=this.__createElement("image");D.setAttribute("width",v);D.setAttribute("height",F);D.setAttribute("preserveAspectRatio","none");if(x||w||C!==z.width||G!==z.height){p=this.__document.createElement("canvas");p.width=v;p.height=F;m=p.getContext("2d");m.drawImage(z,x,w,C,G,0,0,v,F);z=p}D.setAttribute("transform",r);D.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",z.nodeName==="CANVAS"?z.toDataURL():z.getAttribute("src"));s.appendChild(D)}}};k.prototype.createPattern=function(o,m){var n=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),p=h(this.__ids),l;n.setAttribute("id",p);n.setAttribute("width",o.width);n.setAttribute("height",o.height);if(o.nodeName==="CANVAS"||o.nodeName==="IMG"){l=this.__document.createElementNS("http://www.w3.org/2000/svg","image");l.setAttribute("width",o.width);l.setAttribute("height",o.height);l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o.nodeName==="CANVAS"?o.toDataURL():o.getAttribute("src"));n.appendChild(l);this.__defs.appendChild(n)}else{if(o instanceof k){n.appendChild(o.__root.childNodes[1]);this.__defs.appendChild(n)}}return new e(n,this)};k.prototype.setLineDash=function(l){if(l&&l.length>0){this.lineDash=l.join(",")}else{this.lineDash=null}};k.prototype.drawFocusRing=function(){};k.prototype.createImageData=function(){};k.prototype.getImageData=function(){};k.prototype.putImageData=function(){};k.prototype.globalCompositeOperation=function(){};k.prototype.setTransform=function(){};this.YX=k};CanvasXpress.prototype.initInterface=function(){this.NW=function(e){var d=this;var f=d.$w;var b=window;if(d.$p()){b[f(29)](f(4));return}d.M0();d.Sr();var a=new XMLHttpRequest();a.open("GET",e,true);a.onreadystatechange=function(){if(a.readyState==4){if(a.status==200){var c=d.parseJSON(a.responseText);if(c){window.cXMap=c;d.updateData({data:false,config:{graphType:"Map",topoJSON:c,mapId:"cXMap"}});d.PI()}else{d.PI();alert("Oooops! Not a valid CanvasXpress json map file")}}else{d.PI();alert("Oooops! Not a valid CanvasXpress json map file")}}};a.send()};this.VO=function(b){return function(e){b.M0();var k=e.target.files[0];var i=k.type;var l=k.name.split(".");var a=new FileReader();var j=l.pop();if(j=="json"){a.onload=function(){try{var c=b.parseJSON(a.result);b.gl();b.layoutValid=false;for(var p in c.config){b[p]=c.config[p]}if(c.afterRender){for(var f=0;f1){m.name+=e[m.name]}var p=b.tc(m);p.level=l||1;p.parent=i||null;return p}),f.map(function(m){w=Math.max(w,(l||1)+1);if(!m.children){g.push(m.name);q.push(m.value||1)}return C(j(m)||[],j,(l||1)+1,m.name)}))};var d=function d(f){return f.children||null};var h=C(d(k),d).map(function(f){f.n=f.children?f.children.length:0;return delete f.children&&f});var B={y:{vars:["Dummy"],smps:g,data:[q]},x:{}};for(var x=0;x1?u:"")][o]=h[t].name;while(y){t=A[y];u=h[t].level;B.x[z+(u>1?u:"")][o]=h[t].name;y=h[t].parent}}}return{renderTo:"newTree",data:B,config:{graphType:"Tree",hierarchy:n}}};return c(a)};this.z2=function(b){return function(q,z,a,r,B){b.M0();b.Sr();var t=function(c){if(c.config&&c.config.backgroundImage&&!Array.isArray(c.config.backgroundImage)&&c.config.backgroundImage.match(/^javascript:\/\//)&&c.config.backgroundImageSrc){var d=new Image();d.id=c.config.backgroundImage.split("//")[1];d.style.display="none";d.src="data:image/png;base64,"+atob(c.config.backgroundImageSrc);document.body.appendChild(d);CanvasXpress.cacheImages[b.RX(d.src)]=d}else{if(c.config&&c.config.backgroundImage&&Array.isArray(c.config.backgroundImage)){c.config.backgroundImageMD5=b.eI(c.config.backgroundImage);var d=new Image();d.onload=function(){CanvasXpress.cacheImages[c.config.backgroundImageMD5]=this};d.crossOrigin="anonymous";d.src=b.Tx(c.config.backgroundImage)}}};var v=r?r:q.target?q.target.files[0]:q.files[0];var f=v.type;var y=v.name.split(".");var s=new FileReader();var e=window;if(f=="image/png"){var u=function(g,h){var c="";for(var d=0;d<4;d++){c+=String.fromCharCode(g.getUint8(h+d))}return c=="tEXt"};var x=function(d,h,i){var c="";for(var g=0;g0){h=g.fail+" records couldn't be mapped to network data"}alert(g.rows+" "+g.type+" records added to network data\n"+h);if(g.type=="node"){b.I3(g.data)}else{b.XT(g.data)}b.PI();return}else{g=b.arrayToCX(g)}}else{g=b.JQ(b.parseDelimited(c),b.graphType=="Map");if(g&&!b.pv(g)){if(g.addt){alert(g.recs+" records added as an additional data set\n")}else{alert(g.recs+" records added to meta data\n")}b.EZ(g.data,g.addt);b.PI();return}else{g=b.arrayToCX(g)}}g.renderTo=y[0].replace(/\s/g,"").replace(/\(/g,"").replace(/\)/g,"");if(B){g.config.view="table"}b.VP(g,a);b.PI()}catch(d){b.PI();alert("Oooops! Not a valid CanvasXpress delimited file")}}}else{if(A=="esv"){s.onload=function(){try{var c=s.result;var g=b.arrayToCXNetwork(b.parseDelimited(c),false,false,false,b.data,"edge");g.renderTo=y[0];b.VP(g,a);b.PI()}catch(d){b.PI();alert("Oooops! Not a valid CanvasXpress delimited file")}}}else{if(A=="gml"){s.onload=function(){try{var d=b.El(s.result);d.renderTo=y[0];b.VP(d,a);b.PI()}catch(c){b.PI();alert("Oooops! Not a valid gml file for CanvasXpress")}}}else{if(A.match(/ml$/)||A=="gexf"){s.onload=function(){try{CanvasXpress.loadRemoteData(y[0],s.result,false,false,b.updateRemoteData)}catch(c){b.PI();alert("Oooops! Not a valid "+A+" file for CanvasXpress")}}}}}}}}}s.readAsText(v)}}}}}(this);this.HU=function(a){return function(k,i){if(a.editable||i){var m=window;var b=a.$w;if(a.$p()){m[b(29)](b(1));return}a.removeM;var c=a.sv();var l="\n";l+="