From 9e807c62e9776ce8f6bb1170f7f0b31f260066fe Mon Sep 17 00:00:00 2001 From: cb4ds Date: Tue, 28 Aug 2018 18:18:09 +0000 Subject: [PATCH 01/30] 20.6 updates --- DESCRIPTION | 2 +- NEWS.md | 3 + inst/extdata/cX-mtcars-dat.txt | 33 ++++++ inst/htmlwidgets/canvasXpress.yaml | 2 +- .../lib/canvasXpress/canvasXpress.min.js | 4 +- tests/cX-function.R | 110 ++++++++++++++---- tests/testthat/test-scatter2D.R | 2 + 7 files changed, 127 insertions(+), 29 deletions(-) create mode 100644 inst/extdata/cX-mtcars-dat.txt diff --git a/DESCRIPTION b/DESCRIPTION index 3cdff976..9f870a81 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: canvasXpress -Version: 1.20.5 +Version: 1.20.6 Title: Visualization Package for CanvasXpress in R Description: Enables creation of visualizations using the CanvasXpress framework in R. CanvasXpress is a standalone JavaScript library for reproducible research diff --git a/NEWS.md b/NEWS.md index c9222c6e..26cbe88c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,9 @@ information on changes to the stand-alone JavaScript CanvasXpress library see th main website. --- +## v1.20.6 +* Updated CanvasXpress JavaScript and CSS libraries to v20.6 + ## v1.20.5 * Updated CanvasXpress JavaScript and CSS libraries to v20.5 * Tests updated and expanded to match new CX functionality diff --git a/inst/extdata/cX-mtcars-dat.txt b/inst/extdata/cX-mtcars-dat.txt new file mode 100644 index 00000000..9b73c7fa --- /dev/null +++ b/inst/extdata/cX-mtcars-dat.txt @@ -0,0 +1,33 @@ + mpg cyl disp hp drat wt qsec vs am gear carb +Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 +Mazda RX4 Wag 21 6 160 110 3.9 2.875 17.02 0 1 4 4 +Datsun 710 22.8 4 108 93 3.85 2.32 18.61 1 1 4 1 +Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 +Hornet Sportabout 18.7 8 360 175 3.15 3.44 17.02 0 0 3 2 +Valiant 18.1 6 225 105 2.76 3.46 20.22 1 0 3 1 +Duster 360 14.3 8 360 245 3.21 3.57 15.84 0 0 3 4 +Merc 240D 24.4 4 146.7 62 3.69 3.19 20 1 0 4 2 +Merc 230 22.8 4 140.8 95 3.92 3.15 22.9 1 0 4 2 +Merc 280 19.2 6 167.6 123 3.92 3.44 18.3 1 0 4 4 +Merc 280C 17.8 6 167.6 123 3.92 3.44 18.9 1 0 4 4 +Merc 450SE 16.4 8 275.8 180 3.07 4.07 17.4 0 0 3 3 +Merc 450SL 17.3 8 275.8 180 3.07 3.73 17.6 0 0 3 3 +Merc 450SLC 15.2 8 275.8 180 3.07 3.78 18 0 0 3 3 +Cadillac Fleetwood 10.4 8 472 205 2.93 5.25 17.98 0 0 3 4 +Lincoln Continental 10.4 8 460 215 3 5.424 17.82 0 0 3 4 +Chrysler Imperial 14.7 8 440 230 3.23 5.345 17.42 0 0 3 4 +Fiat 128 32.4 4 78.7 66 4.08 2.2 19.47 1 1 4 1 +Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 +Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.9 1 1 4 1 +Toyota Corona 21.5 4 120.1 97 3.7 2.465 20.01 1 0 3 1 +Dodge Challenger 15.5 8 318 150 2.76 3.52 16.87 0 0 3 2 +AMC Javelin 15.2 8 304 150 3.15 3.435 17.3 0 0 3 2 +Camaro Z28 13.3 8 350 245 3.73 3.84 15.41 0 0 3 4 +Pontiac Firebird 19.2 8 400 175 3.08 3.845 17.05 0 0 3 2 +Fiat X1-9 27.3 4 79 66 4.08 1.935 18.9 1 1 4 1 +Porsche 914-2 26 4 120.3 91 4.43 2.14 16.7 0 1 5 2 +Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.9 1 1 5 2 +Ford Pantera L 15.8 8 351 264 4.22 3.17 14.5 0 1 5 4 +Ferrari Dino 19.7 6 145 175 3.62 2.77 15.5 0 1 5 6 +Maserati Bora 15 8 301 335 3.54 3.57 14.6 0 1 5 8 +Volvo 142E 21.4 4 121 109 4.11 2.78 18.6 1 1 4 2 diff --git a/inst/htmlwidgets/canvasXpress.yaml b/inst/htmlwidgets/canvasXpress.yaml index 25170fff..a2de2fd6 100644 --- a/inst/htmlwidgets/canvasXpress.yaml +++ b/inst/htmlwidgets/canvasXpress.yaml @@ -1,6 +1,6 @@ dependencies: - name: canvasXpress - version: 20.5 + version: 20.6 src: "htmlwidgets/lib/canvasXpress" script: canvasXpress.min.js stylesheet: canvasXpress.css diff --git a/inst/htmlwidgets/lib/canvasXpress/canvasXpress.min.js b/inst/htmlwidgets/lib/canvasXpress/canvasXpress.min.js index 252658fc..a2f566ed 100644 --- a/inst/htmlwidgets/lib/canvasXpress/canvasXpress.min.js +++ b/inst/htmlwidgets/lib/canvasXpress/canvasXpress.min.js @@ -1,5 +1,5 @@ /** - * CanvasXpress 20.5 - JavaScript Canvas Library + * CanvasXpress 20.6 - JavaScript Canvas Library * * Copyright (c) 2009-2018 Isaac Neuhaus * @@ -468,4 +468,4 @@ function str_repeat(b,a){for(var c=[];a>0;c[--a]=b){}return(c.join(""))}function * * Copyright (c) 2014 Gliffy Inc. */ -;(function(){var j,k,i,e,a;function g(o,l){var n=Object.keys(l),m;for(m=0;m1){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.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.__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(){};if(typeof window==="object"){window.C2S=k}if(typeof module==="object"&&typeof module.exports==="object"){module.exports=k}}());(function(e,c){var h=e.document,i=function(j){if(!j){return null}var k=j.getBoundingClientRect();return{w:k.width,h:k.height,t:k.top,l:k.left,b:k.bottom,r:k.right,obj:j}},a=function(m,l,q,j){var o="webkit moz ms o ".split(" ");for(var n=0,k=o.length;n=0;r--){p=n[r].style.backgroundPosition.split(" ")[1];v=parseFloat(p.slice(0,p.length-2),10);n[r].style.backgroundPosition="0px "+(v-u)+"px"}break;case"bottom":for(r=0;r=0;r--){s=n[r].style.backgroundPosition.split(" ")[0];x=parseFloat(s.slice(0,s.length-2),10);n[r].style.backgroundPosition=(x-j)+"px 0px"}break;case"right":for(r=0;r=0&&m>v){v=m;this.animationDirection="bottom"}if(this.possibleDirections.indexOf("top")>=0&&q>v){v=q;this.animationDirection="top"}if(this.possibleDirections.indexOf("left")>=0&&x>v){v=x;this.animationDirection="left"}if(this.possibleDirections.indexOf("right")>=0&&t>v){v=t;this.animationDirection="right"}switch(this.animationDirection){case"top":var y=Math.ceil((w.t-j.b)/o);k.style.width=w.w+"px";k.style.height=w.h+"px";k.style.top=w.t+"px";k.style.left=w.l+"px";k.style.position="absolute";k.style.backgroundPosition=r.style.backgroundPosition;k.style.backgroundImage=r.style.backgroundImage;k.style.display=r.style.display;k.style.backgroundPosition="0px 9999px";for(u=-y;u'}k.innerHTML=s;setTimeout(function(){r.style.backgroundPosition="0px 9999px";var F=k.childNodes,D=Math.floor((j.l-w.l)/2),H=Math.floor((j.w-w.w)/2),C=H-j.w+1,I=(Math.PI*2)/(q*2),B=4.7,G=0,E=F.length;for(;G'}k.innerHTML=s;setTimeout(function(){r.style.backgroundPosition="0px -9999px";var F=k.childNodes,D=Math.floor((j.l-w.l)/2),H=Math.floor((j.w-w.w)/2),C=H-j.w+1,I=(Math.PI*2)/(m*2),B=4.7,G=0,E=F.length;for(;G'}k.innerHTML=s;setTimeout(function(){r.style.backgroundPosition="-9999px 0px";var D=k.childNodes,G=Math.floor((j.t-w.t)/2),F=Math.floor((j.h-w.h)/2),H=F-j.h+1,I=(Math.PI*2)/(t*2),B=4.7,E=0,C=D.length;for(;E'}k.innerHTML=s;setTimeout(function(){var D=k.childNodes,G=Math.floor((j.t-w.t)/2),F=Math.floor((j.h-w.h)/2),H=F-j.h+1,I=(Math.PI*2)/(x*2),B=4.7,E=0,C=D.length;for(;E=0&&o>B){B=o;this.animationDirection="bottom"}if(this.possibleDirections.indexOf("top")>=0&&t>B){B=t;this.animationDirection="top"}if(this.possibleDirections.indexOf("left")>=0&&G>B){B=G;this.animationDirection="left"}if(this.possibleDirections.indexOf("right")>=0&&x>B){B=x;this.animationDirection="right"}switch(this.animationDirection){case"bottom":var v=C.t-l.t,K=Math.floor((C.l-l.l)/2),s=Math.floor((C.w-l.w)/2),F=s-C.w+1,q=(Math.PI*2)/(o*2);m.style.width=l.w+"px";m.style.height=l.h+"px";m.style.top=l.t+"px";m.style.left=l.l+"px";m.style.position="absolute";m.style.backgroundPosition=J.style.backgroundPosition;m.style.backgroundImage=J.style.backgroundImage;m.style.display=J.style.display;m.className="genie";for(;A';p+=q}m.innerHTML=w;a(m.childNodes[0],"TransitionEnd",g.call(this,this.expandTransitionEvent));setTimeout(function(){var L=m.childNodes,O,M,N=0,k=L.length;for(;N';p+=q}m.innerHTML=w;a(m.childNodes[0],"TransitionEnd",g.call(this,this.expandTransitionEvent));setTimeout(function(){var L=m.childNodes,O,M,N=0,k=L.length;for(;N';p+=q}m.innerHTML=w;a(m.childNodes[0],"TransitionEnd",g.call(this,this.expandTransitionEvent));setTimeout(function(){var M=m.childNodes,L,O,N=0,k=M.length;for(;N';p+=q}m.innerHTML=w;a(m.childNodes[0],"TransitionEnd",g.call(this,this.expandTransitionEvent));setTimeout(function(){var M=m.childNodes,L,O,N=0,k=M.length;for(;N0?j.shift():[];var o=j.length>0?j.shift():{};if(this.showFunctionNamesAfterRender){this.flashInfoSpan(20,20,n)}this.skipRender=this.skipRenderForce||(!this.showTransition&&k0?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'+serialized+"";var dataUri="data:image/svg+xml;charset=utf-8,"+svg;var img=new Image();img.onload=function(){var canvas=document.createElement("canvas");canvas.width=width;canvas.height=height;canvas.getContext("2d").drawImage(img,0,0);if(callback){callback.call(img,canvas.toDataURL())}};img.onerror=function(evt){console.log("Ooops! Something went wrong!");callback.call(this,img.src)};img.src=dataUri};this.isInIframe=function(){try{return window.self!==window.top}catch(e){return true}};this.initializeBrowser=function(){var getBrowserVersion=function(){var ua=navigator.userAgent;var tem;var m=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(m[1])){tem=/\brv[ :]+(\d+)/g.exec(ua)||[];return"IE "+(tem[1]||"")}if(m[1]==="Chrome"){tem=ua.match(/\b(OPR|Edge)\/(\d+)/);if(tem!=null){return tem.slice(1).join(" ").replace("OPR","Opera")}}m=m[2]?[m[1],m[2]]:[navigator.appName,navigator.appVersion,"-?"];if((tem=ua.match(/version\/(\d+)/i))!=null){m.splice(1,1,tem[1])}return m.join(" ")};var str=getBrowserVersion().split(" ");CanvasXpress.system={browser:str[0],browserVersion:str[1],isjQuery:typeof $==="function"?true:false,isIE:this.browser=="IE"?true:false,isInIframe:str[0].match(/safari/i)?true:this.isInIframe(),isTouchScreen:"ontouchstart" in window||"onmsgesturechange" in window||navigator.maxTouchPoints}};this.setFunctionNames("initDOM");this.initializeBrowser()};CanvasXpress.prototype.initInterface=function(){this.isValidURL=function(b){var a=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;,\\s\\(\\)\\[\\]&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return a.test(b)};this.loadParamsFile=function(a){return function(h){a.removeMenus();a.resetConfigurator(h);var d=h.target.files[0];var g=d.type;var c=d.name.split(".");var b=new FileReader();var f=c.pop();if(f=="json"){b.onload=function(){try{var m=JSON.parse(b.result);a.setConfigDefaults();a.layoutValid=false;for(var o in m.config){a[o]=m.config[o]}if(m.afterRender){for(var k=0;kq?",":"\t";var r;if(a.graphType=="Network"){r=a.delimitedToArray(t,p,false,true);if(r&&!a.isArray(r)){var o="";if(r.fail>0){o=r.fail+" records couldn't be mapped to network data"}alert(r.rows+" "+r.type+" records added to network data\n"+o);if(r.type=="node"){a.appendNodeData(r.data)}else{a.appendEdgeData(r.data)}a.hideMask();return}else{r=a.delimitedToCanvasXpress(r)}}else{r=a.delimitedToArray(t,p,true)}r.renderTo=d[0];r.uploadFile=true;a.remoteServiceType="file";a.updateRemoteData(r,n);a.hideMask()}catch(s){a.hideMask();alert("Oooops! Not a CanvasXpress delimited file")}}}else{if(b=="gml"){j.onload=function(){try{var f=a.parseGML(j.result);f.renderTo=d[0];f.uploadFile=true;a.remoteServiceType="file";a.updateRemoteData(f,n);a.hideMask()}catch(o){a.hideMask();alert("Oooops! Not a gml file for CanvasXpress")}}}else{if(b=="gpml"){j.onload=function(){try{var f=a.parseXML(j.result);var o=a.gpmlToCX(f);o.renderTo=d[0];o.uploadFile=true;a.remoteServiceType="file";a.updateRemoteData(o,n);a.hideMask()}catch(p){a.hideMask();alert("Oooops! Not a "+b+" file for CanvasXpress")}}}else{if(b=="xml"){j.onload=function(){try{var f=a.parseXML(j.result);a.kgmlToCX(f,d[0])}catch(o){a.hideMask();alert("Oooops! Not a "+b+" file for CanvasXpress")}}}}}}}}j.readAsText(h)}}}(this);this.save=function(a){return function(i,d,h){var c=function(f,e){if(f=="state"||f=="stateIndex"){return undefined}return e};a.removeMenus();a.resetConfigurator(i);var j=d?d+".json":a.saveFilename?a.saveFilename+".json":"cX-"+a.target+".json";j=j.replace(/.json.json$/,".json");CanvasXpress.stack[a.target].client=CanvasXpress.factory.client;CanvasXpress.stack[a.target].clientIP=CanvasXpress.geo;var g;if(h){g=a.prettyJSON({config:CanvasXpress.stack[a.target].config,afterRender:CanvasXpress.stack[a.target].afterRender||[]})}else{g=a.prettyJSON(CanvasXpress.stack[a.target],c)}var b=new Blob([g],{type:"text/plain;charset="+document.characterSet});saveAs(b,j)}}(this);this.saveSVG=function(a){return function(h,g){a.removeMenus();a.resetConfigurator(h);CanvasXpress.stack[a.target].client=CanvasXpress.factory.client;CanvasXpress.stack[a.target].clientIP=CanvasXpress.geo;a.isSVG=true;var d=a.showTransition;a.showTransition=false;a.meta.canvas.ctx5=new C2S({width:a.width,height:a.height,desc:a.isReproducibleResearch?JSON.stringify(CanvasXpress.stack[a.target]):""});a.renderGraph(true);var c=a.meta.canvas.ctx5.getSerializedSvg();if(a.isReproducibleResearch){a.flashInfoSpan(100,100,"

Please be aware
the actual data is stored
inside the downloaded image

",5000)}var i=g?g+".svg":a.saveFilename?a.saveFilename+".svg":"cX-"+a.target+".svg";i=i.replace(/.svg.svg$/,".svg");var b=new Blob([c],{type:"image/svg+xml;charset="+document.characterSet});saveAs(b,i);a.showTransition=d;delete (a.meta.canvas.ctx5);a.isSVG=false}}(this);this.parseXML=function(a){var c=null;if(window.DOMParser){try{c=(new DOMParser()).parseFromString(a,"text/xml")}catch(b){c=null}}else{if(window.ActiveXObject){try{c=new ActiveXObject("Microsoft.XMLDOM");c.async=false;if(!c.loadXML(a)){window.alert(c.parseError.reason+c.parseError.srcText)}}catch(b){c=null}}else{alert("cannot parse xml string!")}}return c};this.SVGtoCX=function(b){var d=this.parseXML(b);var a=d.childNodes[0];if(a.tagName.match(/svg/i)){var c=a.getAttribute("desc");if(c){return JSON.parse(c)}}};this.print=function(a){return function(u,t){var i=a.width;var j=a.height;var s=a.printMagnification;var k=a.autoScaleFont;var m=a.showTransition;var p=a.skipStack;var q=["outlineWidth","lineThickness","axisTickThickness","axisMinMaxTickThickness","guidesWidth","boxplotMedianWidth","boxplotConnectWidth","treeLinkWidth","connectByWidth","histogramBarWidth","heatmapCellBoxWidth","heatmapCellBoxHighlightWidth","edgeThickness","maxTextSize"];var n=function(f){if(f){for(var e=0;e>>1)):(w>>>1))}e[v]=w}return e};var d=function(w){var e=window.crcTable||(window.crcTable=c());var v=0^(-1);for(var f=0;f>>8)^e[(v^w.charCodeAt(f))&255]}return(v^(-1))>>>0};var h=function(f,e){var v=new Uint8Array(f.byteLength+e.byteLength);v.set(new Uint8Array(f),0);v.set(new Uint8Array(e),f.byteLength);return v.buffer};var l=function(v){var z="tEXt";var f=v.length;var y=d(z+v);var e=new ArrayBuffer(12+f);var x=new DataView(e);x.setUint32(0,f);for(var w=0;w";a.showTooltipDiv(u,f,a.getTargetEvent(u),{maxWidth:a.width+"px",whiteSpace:"normal"},40,40)};v.readAsDataURL(e)};n();a.removeMenus();a.resetConfigurator(u);CanvasXpress.stack[a.target].client=CanvasXpress.factory.client;CanvasXpress.stack[a.target].clientIP=CanvasXpress.geo;var o=a.isMap?a.getLeafletCanvas():a.meta.canvas.ctx.canvas;o.toBlob(function(f){var e=new FileReader();var v=t?t+".png":a.saveFilename?a.saveFilename+".png":"cX-"+a.target+".png";v=v.replace(/.png.png$/,".png");e.onloadend=function(){var w=new DataView(this.result);var y=w.getUint32(8);var z=8+4+4+y+4;var A=this.result.slice(0,z);var B=this.result.slice(z);var E=l("Software\0CanvasXpress Version: "+CanvasXpress.factory.version);var C=l("ReproducibleResearch\0"+g());var D=b(A,E,C,B);var x=new Blob([D],{type:"image/png"});if(a.printType=="download"){if(a.isReproducibleResearch){a.flashInfoSpan(100,100,"

Please be aware
the actual data is stored
inside the downloaded image

",5000)}saveAs(x,v)}else{r(x)}n(true)};e.readAsArrayBuffer(f)},"image/png");if(a.maximized){a.clickGraphMaxMin(u)}}}(this);this.exportToSVG=function(a){return function(){var b=a.meta.canvas.ctx;a.meta.canvas.ctx=new C2S({width:a.width,height:a.height});a.draw();var c=a.prettyXML(a.meta.canvas.ctx.getSerializedSvg());var d=window.open("",a.target+"-SVG");d.document.write(c);a.meta.canvas.ctx=b;a.draw();return false}}(this);this.exportToExcel=function(i){return this.exportToTabDelimited(i);var g=this.exportToHTML(i,true);var f="data:application/vnd.ms-excel;base64,";var c='{table}
';var b=function(d){return window.btoa(unescape(encodeURIComponent(d)))};var h=function(d,j){return d.replace(/{(\w+)}/g,function(k,l){return j[l]})};var a={worksheet:"Worksheet",table:g};var e=this.$(this.target+"-cX-linkExcel");if(!e){e=this.$cX("a",{id:this.target+"-cX-linkExcel"},{display:"none"});document.body.appendChild(e)}e.href=f+b(h(c,a));e.download=this.target+".xls";e.click()};this.exportToHTML=function(e,b){var c="";for(var a=0;a"}c+="
";c+=e[a].join("");c+="
";return b?c:window.open().document.write(c)};this.exportToTabDelimited=function(e){var c="";for(var a=0;a';c+='
';c+=e[0][0][b];c+="
";c+=""}c+="";for(var b=1;b";for(var a=0;a';c+='
';c+=e[0][b][a];c+="
";c+=""}else{c+='';c+='
';c+=e[0][b][a];c+="
";c+=""}}c+=""}c+="";c+="";c+="";return c};this.prettyJSON=function(b,a,d){return d?this.prettyColoredJSON(b,a):JSON.stringify(b,a?a:null,2)};this.prettyColoredJSON=function(c,b){var a=function(j,g,l,f,h){var m="";var i="";var k="";var e=g||"";if(l){e=e+m+l.replace(/[": ]/g,"")+": "}if(f){e=e+(f[0]=='"'?k:i)+f+""}return e+(h||"")};var d=/^( *)("[\w]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/mg;return JSON.stringify(c,b?b:null,2).replace(/&/g,"&").replace(/\\"/g,""").replace(//g,">").replace(d,a)};this.prettyColoredR=function(b){var a=function(i,f,k,e,g){var l="";var h="";var j="";var d=f||"";if(k){d=d+l+k.replace(/["= ]/g,"")+"= "}if(e){d=d+(e[0]=='"'?j:h)+e+""}return d+(g||"")};var c=/^( *)("[\w]+"= )?("[^"]*"|[\w.+-]*)?([,[{])?$/mg;return b.replace(/&/g,"&").replace(/\\"/g,""").replace(//g,">").replace(c,a)};this.prettyXML=function(n){var f=/(>)\s*(<)(\/*)/g;var t=/ *(.*) +\n/g;var e=/(<.+>)(.+\n)/g;var d=n.replace(f,"$1\n$2$3").replace(t,"$1\n").replace(e,"$1\n$2");var r=0;var b="";var a=d.split("\n");var k=0;var q="other";var v={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0};for(var p=0;p/));var g=Boolean(h.match(/<\/.+>/));var m=Boolean(h.match(/<[^!].*>/));var c=u?"single":g?"closing":m?"opening":"other";var s=q+"->"+c;q=c;var l="";k+=v[s];for(var o=0;oi?",":"\t"};if(!b){k()}for(var g=0;g=0;n--){if(h[n].replace(/"\s+$/,'"').charAt(h[n].length-1)=='"'){var o=h[n].replace(/^\s+"/,'"');if(o.length>1&&o.charAt(0)=='"'){h[n]=h[n].replace(/^\s*"|"\s*$/g,"").replace(/""/g,'"')}else{if(n){h.splice(n-1,2,[h[n-1],h[n]].join(b))}else{h=h.shift().split(b).concat(h)}}}else{h[n].replace(/""/g,'"')}}for(var e=0;ea){a=0;f=0;d=0;l="edge";for(var h=1;hd){a=0;f=0;d=0;l="node";for(var h=1;h5||f>=k.length-1))||(l=="node"&&(a>5||a>=k.length-1))){return{data:g,rows:Math.max(a,f),fail:d,type:l}}else{return k}};this.kgmlToCX=function(e,F){var j=this;var s=e.childNodes[2];var v=[];var c=[];var G,t,g,u,q;var d=function(I,M,h,L){var x={};var J=new RegExp(/(?!xmlns)^.*:/);var w=new RegExp(/^\s+|\s+$/g);if(!M){M={}}if(h&&!M[h]){M[h]=[]}if(I.attributes&&I.attributes.length>0){for(var y=0;y1){l.push(parseInt(B.shift()));k.push(parseInt(B.shift()))}var o=parseInt(this.mean(l));var n=parseInt(this.mean(k));if(l[0]==l[1]){o+=1;m=2;D=k[1]-k[0];p=0}else{if(k[0]==k[1]){n+=1;m=l[1]-l[0];D=2;p=0}else{D=this.lineLength(l[0],k[0],l[1],k[1]);m=2;p=this.getAngle(l[0],k[0],l[1],k[1])}}var z={id:A.id,type:A.type,link:A.link,name:A.graphics[0].name,shape:"rect",color:"rgba(0,0,0,0)",outline:"rgba(0,0,0,0)",x:o,y:n,width:m,height:D,rotate:p,hideLabel:true,fixed:true};v.push(z)}}}break;case"relation":case"reaction":break}}}}else{alert("Ooops! Not a kgml file!")}};this.gpmlToCX=function(v){var k=v.childNodes[0];var E={};var t=[];var ac={};var l={};var u={};var D={};var O=1;var T=0;var f=[];var d={};var F={};var W={};var M="\nWarnings:\n";var R=false;var A,x;var Q={Line:false,Arrow:"arrow",TBar:"square","mim-necessary-stimulation":false,"mim-binding":false,"mim-conversion":"arrow","mim-stimulation":false,"mim-catalysis":"round","mim-modification":false,"mim-inhibition":"square","mim-covalent-bond":false,"mim-transcription-translation":false};var b=function(ak,j){var ad=Number.MAX_VALUE;var s=Number.MAX_VALUE;var ai=-Number.MAX_VALUE;var ah=-Number.MAX_VALUE;var c=[];var p=[];var ag=false;for(var ae=0;ae1&&aj>10?5:0),height:af+(ak.length>1&&af>10?5:0),group:c,hideLabel:true,hideTooltip:R,type:"Group",color:(ag?"rgba(245,245,245,0.5)":"rgba(0,0,0,0)"),outline:(ag?"rgb(0,0,0)":"rgba(0,0,0,0)"),shape:"rectangle",zorder:p[0]};D[j]=T--;E[j]=g;f.push(j)};var r=function(g,i){var c={id:i,x:Math.round(g.x*10)/10,y:Math.round(g.y*10)/10,width:g.width?Math.round(g.width):1,height:g.height?Math.round(g.height):1,hideLabel:g.show?false:true,hideTooltip:!R?false:g.show?false:true,eventless:g.show?false:true,type:g.type||"Anchor",color:g.color||"rgba(0,0,0,0)",outline:g.outline||"rgba(0,0,0,0)",shape:g.shape||"circle",label:g.label||"",labelSize:g.labelSize||0.5,zorder:g.zorder||0};D[i]=O++;E[i]=c;f.push(i)};var q=function(c){switch(c){case"r":case"l":return"rl";case"b":case"t":case"c":return"tb"}};var L=function(c){if(parseInt(c.relx)==1){return"r"}else{if(parseInt(c.relx)==-1){return"l"}else{if(parseInt(c.rely)==1){return"b"}else{if(parseInt(c.rely)==-1){return"t"}else{if(Math.abs(c.relx)>Math.abs(c.rely)){if(parseFloat(c.relx)>0){return"r"}else{return"l"}}else{if(parseFloat(c.rely)>0){return"b"}else{if(parseFloat(c.rely)<0){return"t"}else{return"c"}}}}}}}};var h=function(p,j){var c=function(ae,af,s){switch(ae){case"r":if(parseFloat(af.x)>=parseFloat(s.x)){return 2}break;case"l":if(parseFloat(af.x)<=parseFloat(s.x)){return 2}break;case"t":case"c":if(parseFloat(af.y)<=parseFloat(s.y)){return 2}break;case"b":if(parseFloat(af.y)>=parseFloat(s.y)){return 2}break}return 0};var i=L(p);var ad=L(j);var g=2;if(q(i)==q(ad)){g++}if(i!=ad){g+=c(i,p,j);g+=c(ad,j,p)}return g};var y=function(g,c,i){if(i){switch(g){case"r":return[c[0]+20,c[1]];case"l":return[c[0]-20,c[1]];case"t":case"c":return[c[0],c[1]-20];case"b":return[c[0],c[1]+20]}}else{switch(g){case"r":case"l":return[c[0][0],c[1][1]];case"t":case"b":case"c":return[c[1][0],c[0][1]]}}};var J=function(ad,j){var s=[j[0]];var g=j[0];for(var p=1;p3){if(ad>3){ai.splice(2,0,y(aj,ai[2],true))}if(ad>4){if(ad>4){ai.splice(3,0,[(ai[1][0]+ai[2][0])/2,(ai[1][1]+ai[2][1])/2])}if(ad>5){ai=m(ag);ai=J(af,ai)}}else{ai.splice(2,0,y(ak,[ai[1],ai[2]]))}}else{if((ai[0][0]==ai[1][0]&&ai[1][0]==ai[2][0])||(ai[0][1]==ai[1][1]&&ai[1][1]==ai[2][1])){ai.splice(1,1)}else{ai.splice(2,0,y(ak,[ai[1],ai[2]]))}}}else{if(c.length>ad){ai=J(af,ai)}else{for(var p=0;p0){for(var ae=0;ae0){B+="Number of Failed Edges: "+o.length+"\n";for(var S=0;Sh[0].length){m.shift();if(!m.length==h[0].length){return false}}if(h[0].length!=h[h.length-1].length){h.pop();o.pop();if(h[0].length!=h[h.length-1].length){return false}}var l=[];for(var e=0;e1&&j[c-1][0]=="drawIndicesAfterWheelEvent"){var e=k-j[c-1][3];if(e<1000){j.pop();b.pop()}}CanvasXpress.stack[this.target].afterRender.push([g,i,{varIndicesStart:this.varIndicesStart,smpIndicesStart:this.smpIndicesStart},k]);break;case"drawRangesAfterWheelEvent":var j=CanvasXpress.stack[this.target].afterRender;var b=CanvasXpress.stack[this.target].state;if(c>1&&j[c-1][0]=="drawRangesAfterWheelEvent"){var e=k-j[c-1][3];if(e<1000){j.pop();b.pop()}}CanvasXpress.stack[this.target].afterRender.push([g,i,{},k]);break;case"drawIndicesAfterPannEvent":var j=CanvasXpress.stack[this.target].afterRender;var b=CanvasXpress.stack[this.target].state;if(c>1&&j[c-1][0]=="drawIndicesAfterPannEvent"){var e=k-j[c-1][3];if(e<1000){j.pop();b.pop()}}CanvasXpress.stack[this.target].afterRender.push([g,i,{varIndicesStart:this.varIndicesStart,smpIndicesStart:this.smpIndicesStart},k]);break;case"updateDragScatter":var j=CanvasXpress.stack[this.target].afterRender;var b=CanvasXpress.stack[this.target].state;if(c>1&&j[c-1][0]=="updateDragScatter"&&!i[0].shiftKey){var e=k-j[c-1][3];if(e<1000){j.pop();b.pop()}}CanvasXpress.stack[this.target].afterRender.push([g,i,{moveLegend:this.moveLegend,moveLegendX:this.moveLegendX,moveLegendY:this.moveLegendY,moveLegendCurX:this.moveLegendCurX,moveLegendCurY:this.moveLegendCurY},k]);break;case"updateDragGenome":var j=CanvasXpress.stack[this.target].afterRender;var b=CanvasXpress.stack[this.target].state;if(c>1&&j[c-1][0]=="updateDragGenome"&&!i[0].shiftKey){var e=k-j[c-1][3];if(e<1000){j.pop();b.pop()}}CanvasXpress.stack[this.target].afterRender.push([g,i,{moveGenome:this.moveGenome,setMinX:this.setMinX,setMaxX:this.setMaxX,xMouseDown:this.xMouseDown},k]);break;case"updateDragNetwork":var j=CanvasXpress.stack[this.target].afterRender;var b=CanvasXpress.stack[this.target].state;if(c>1&&j[c-1][0]=="updateDragNetwork"&&!i[0].shiftKey){var e=k-j[c-1][3];if(e<1000){j.pop();b.pop()}}CanvasXpress.stack[this.target].afterRender.push([g,i,{moveLegend:this.moveLegend,moveLegendX:this.moveLegendX,moveLegendY:this.moveLegendY,moveEdge:this.moveEdge,moveEdgeIndex:this.moveEdgeIndex,moveEdgeElbow:this.moveEdgeElbow,moveNode:this.moveNode,moveNodeIndex:this.moveNodeIndex,moveNodeLab:this.moveNodeLab,moveNodeDec:this.moveNodeDec,moveNodeW:this.moveNodeW,moveNodeH:this.moveNodeH,moveNodeX:this.moveNodeX,moveNodeY:this.moveNodeY,xMouseDown:this.xMouseDown,yMouseDown:this.yMouseDown},k]);break;case"handleDragEventOneDimension":CanvasXpress.stack[this.target].afterRender.push([g,i,{moveDendrogram:this.moveDendrogram,moveVarOverlay:this.moveVarOverlay,moveVar:this.moveVar,moveSmpOverlay:this.moveSmpOverlay,moveSmp:this.moveSmp},k]);break;case"updateDragCircular":var j=CanvasXpress.stack[this.target].afterRender;var b=CanvasXpress.stack[this.target].state;if(c>1&&j[c-1][0]=="updateDragCircular"&&!i[0].shiftKey){var e=k-j[c-1][3];if(e<1000){j.pop();b.pop()}}CanvasXpress.stack[this.target].afterRender.push([g,i,{circularRotate:this.circularRotate,moveCircular:this.moveCircular,panningX:this.panningX,panningY:this.panningY,xMouseDown:this.xMouseDown,yMouseDown:this.yMouseDown},k]);break;case"resortSankey":var j=CanvasXpress.stack[this.target].afterRender;var b=CanvasXpress.stack[this.target].state;if(c>1&&j[c-1][0]=="resortSankey"){var e=k-j[c-1][3];if(e<1000){j.pop();b.pop()}}CanvasXpress.stack[this.target].afterRender.push([g,i,{moveSankey:this.moveSankey,moveSankeyY:this.moveSankeyY,moveSankeyMin:this.moveSankeyMin,moveSankeyOrder:this.moveSankeyOrder},k]);break;default:CanvasXpress.stack[this.target].afterRender.push([g,i,{},k]);break}if(CanvasXpress.stack[this.target].stateIndex-1)&&g)||(j=="right"&&!g)){B=B.split("").reverse().join("");if(this.isArray(q)){q=q.reverse()}}A.translate(z,w);C+=(Math.PI*!g);C+=(Math.PI/2)+(p/2);if(j=="center"){for(var k=0;kthis.marginLeft+this.offsetX+this.left+this.x){return}if(nthis.marginTop+this.offsetY+this.top+this.y){return}}if(this.isMultipleLines(q)){return this.getTextMultipleArea(q,o,n,B,D,F,E,g,u,r,k)}var G=[];var p=this.measureText(q,B);var z=this.getFontPt(B);var C,e,A,d;var i=0;if(u){while(p>u&&i<10){q=q.substring(0,q.length-1);p=this.measureText(q,B);i++}}if(F=="left"){C=o;A=C+p}else{if(F=="right"){C=o-p;A=o}else{C=o-(p/2);A=o+(p/2)}}if(E=="top"){e=n;d=e+z}else{if(E=="bottom"){e=n-z;d=n}else{e=n-(z/2);d=n+(z/2)}}G=["rect",C,e,A,d];G=g?v(G):G;if(this.graphType=="Network"){return this.preScaleNetwork&&!this.isAnimation?G:this.adjustNetworkObjects(G)}else{return G}};this.drawText=function(z,q,n,j,k,p,o,d,e,A,u){this.functionCallerDraw="drawText";if(z==undefined){z=""}var v=this.getCanvasContext();var i=0;if(z==null){return}if(this.isMultipleLines(z)){return this.drawTextMultiple(z,q,n,j,k,p,o,d,e,A,u)}if(!v){if(this.debug){alert("Dude, there is no canvas")}return}if(isNaN(q)||isNaN(n)){if(this.debug){alert("Not a valid coordinate ("+q+", "+n+") to draw "+z)}return}if(u){if(qthis.marginLeft+this.offsetX+this.left+this.x){return}if(nthis.marginTop+this.offsetY+this.top+this.y){return}}if(!q){q=0}if(!n){n=0}if(!j){j=this.font}if(!k){k=this.foreground}if(!p){p=this.align}if(!o){o=this.baseline}var r=this.measureText(z,j);var g=this.getFontPt(j);if(e){while(r>e&&i<10){z=z.substring(0,z.length-1);r=this.measureText(z,j);i++}}this.saveCanvas();v.strokeStyle=k;v.fillStyle=k;v.font=j;this.translateCanvas(q,n);v.textAlign=p;v.textBaseline=o;this.setTextShadow(true);if(d){this.rotateCanvas(d)}z=z.toString().replace("\x00","");if(A){v.strokeText(z,0,0)}else{v.fillText(z,0,0)}this.restoreCanvas();this.setTextShadow(false)};this.isMultipleLines=function(b){var a=b.toString().split(/\n/);return a.length-1};this.capitalize=function(a){if(a){return a.charAt(0).toUpperCase()+a.slice(1)}};this.decapitalize=function(a){if(a){return a.charAt(0).toLowerCase()+a.slice(1)}};this.measureTextMultiple=function(e,g){var c=e.split(/\n/);var a=0;var b=this.getCanvasContext();if(!b){return 0}if(!g){g=this.font}b.font=g;for(var d=0;d0){return(this.getFontPt(b)+this.margin)*(l+1)}else{return this.getFontPt(b)}};this.scaleTextToFont=function(b,e,a,c){var d=this.fontStyle+" "+e+"px "+this.fontName;if(b){while(this.measureText(b,d)>a&&e>=this.minTextSize){e-=2;d=this.fontStyle+" "+e+"px "+this.fontName}if(c){while(parseInt(e/1.33)>c-2){e--}d=this.fontStyle+" "+e+"px "+this.fontName}}return d};this.getFontPt=function(a){return a?Math.max(1,parseInt(a.toString().match(/[\-\d]+/)[0])):1};this.scaleTextToSize=function(a){var d=this.scaleTextConstantMult;if(!a){a=1}return Math.ceil(1/Math.sqrt(a)*d)};this.scaleFont=function(a,b){var d=this.getFontPt(a);var c=Math.max(1,parseInt(d*b));return a.replace(d+"px",c+"px")};this.approx=function(g){var e=g;var d=g.toString();var j=d.indexOf("99999");var h=d.indexOf("00000");var i=d.indexOf(".");var b=j>=0&&i=0?h:null;if(b!=null){e=d.substring(0,b);f=Math.pow(10,e.length-(e.indexOf(".")+1));return Number(Math.round(Number(d)*f)/f)}else{return Number(d)}};this.formatNumber=function(b,a){if(a&&Math.abs(b)<99999){return sprintf("%."+a+"f",Number(b)).toString()}else{if(Math.abs(b)<0.0001||Math.abs(b)>99999||b.toString().length>=8){return Number(b).toExponential(2).toString().replace("e+0","").replace(".00","")}else{return b.toString()}}};this.bestFormatNumber=function(b,a){if(typeof b==="number"&&b%1==0){return b}else{if(a!=null&&a<1){return sprintf("%.0f",Number(b))}else{if(Math.abs(b)<0.001){return sprintf("%.2e",Number(b))}else{return sprintf("%.3f",Number(b))}}}};this.getMaxtTextBySampling=function(b,j){var c={};var g=[];var h=[];for(var e=0;ei[1]?1:0});if(!j){j=10}if(g.length0){for(var e=0;eb){g=d[e].toString();b=h}}}}return g};this.shortenText=function(c,b,a){if(!c){return""}c=c.toString();if(a&&c.length>b){return c.substring(0,Math.max(parseInt(a/b)-2,1))+".."}else{if(c.length<=b){return c}else{return c.substring(0,b-3)+"..."}}};this.convertToNumber=function(a){if(!isNaN(a)){return parseFloat(a)}else{return a}};this.stringToHex=function(c){var b="";for(var a=0;athis.times.year*2){d="getYear"}else{if(g>this.times.month*2){d="getYearMonth"}else{if(g>this.times.week*2){d="getYearWeek"}else{if(g=0;a--){var e=this[d](h[a]);if(!b.hasOwnProperty(e)){c.unshift(h[a]);this.timeValueIndices.unshift(a);b[e]=true}}}}else{for(var a=0;a>16)+e;h=h>255?255:h<0?0:h;var f=((i>>8)&255)+e;f=f>255?255:f<0?0:f;var d=(i&255)+e;d=d>255?255:d<0?0:d;j=d|(f<<8)|(h<<16);return this.hexToRgb(j.toString(16))};this.rgbToHex=function(b){var a=function(c){c=parseInt(c,10);if(isNaN(c)){return"00"}c=Math.max(0,Math.min(c,255));return"0123456789ABCDEF".charAt((c-c%16)/16)+"0123456789ABCDEF".charAt(c%16)};if(b&&b.substr(0,1)==="#"){return b}if(b&&b.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/)){return"#"+a(RegExp.$1)+a(RegExp.$2)+a(RegExp.$3)}else{return b}};this.complementaryColor=function(j,e){var d=this.validateColor(j.toString());if(d.match(/^rgba?\((\d{1,3}),(\d{1,3}),(\d{1,3})(?:,([0-9\.]+))?/i)){var i=parseInt(255-RegExp.$1);var f=parseInt(255-RegExp.$2);var a=parseInt(255-RegExp.$3);if(i==f&&f==a){if(i>=127){d="rgb(255,255,255)"}else{d="rgb(0,0,0)"}}else{d="rgb("+i+","+f+","+a+")"}return e?this.rgbToHex(d):d}else{return j}};this.hexToRgb=function(c){var b=function(){return parseInt(c.substring(0,2),16)};var a=function(){return parseInt(c.substring(2,4),16)};var d=function(){return parseInt(c.substring(4,6),16)};c=c.charAt(0)=="#"?c.substring(1,7):c;return"rgb("+b()+","+a()+","+d()+")"};this.addColorTransparency=function(e,d,b){if(!b){e=this.validateColor(e)}if(e){var a=e.match(/^rgba?\((\d{1,3},\d{1,3},\d{1,3})(?:,([0-9\.]+))?/i);return"rgba("+a[1]+","+Math.min(d,(a[2]!=null?a[2]:1))+")"}else{return false}};this.removeColorTransparency=function(d,b){if(!b){d=this.validateColor(d)}if(d){var a=d.match(/^rgba?\((\d{1,3},\d{1,3},\d{1,3})(?:,([0-9\.]+))?/i);return"rgb("+a[1]+")"}else{return false}};this.isColorTransparency=function(b){b=this.validateColor(b);if(b){var a=b.match(/^rgba?\((\d{1,3},\d{1,3},\d{1,3})(?:,([0-9\.]+))?/i);return a[2]!=null?Number(a[2]):null}};this.isColorTransparent=function(d){d=this.validateColor(d);var b;if(d&&d.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/)){return false}else{if(d){var a=d.match(/^rgba?\((\d{1,3},\d{1,3},\d{1,3})(?:,([0-9\.]+))?/i);return a[2]!=null&&a[2]==0?true:false}else{return false}}};this.combineColors=function(j){var e=[];var d=[];var n=[];var k=[];for(var f=0;f0){var a=parseInt(this.mean(e));var h=parseInt(this.mean(d));var m=parseInt(this.mean(n));if(k.length>0){var o=parseFloat(this.mean(k));return"rgba("+a+","+h+","+m+","+o+")"}else{return"rgb("+a+","+h+","+m+")"}}return false};this.colorAsArray=function(f){f=this.validateColor(f);var b=[];if(f){var d=(/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/).exec(f);var e=(/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),([0-9\.]+)\)/).exec(f);if(d!=null){b=[parseInt(d[1]),parseInt(d[2]),parseInt(d[3])]}else{if(e!=null){b=[parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),Number(e[4])]}}}return b};this.disableGradientTransparencyShadow=function(){if(!this.gradientTemp){this.gradientTemp=this.gradient}if(this.transparencyTemp==null){this.transparencyTemp=this.transparency}if(!this.showShadowTemp){this.showShadowTemp=this.showShadow}this.gradient=false;this.transparency=null;this.showShadow=false};this.enableGradientTransparencyShadow=function(){this.gradient=this.gradientTemp;this.transparency=this.transparencyTemp;this.showShadow=this.showShadowTemp};this.resetGradientTransparencyShadow=function(){delete (this.gradientTemp);delete (this.transparencyTemp);delete (this.showShadowTemp)};this.getGradientColor=function(h){if(h.match(/^rgba?\((\d{1,3}),(\d{1,3}),(\d{1,3})(?:,([0-9\.]+))?/i)){var f=Math.floor(parseInt(RegExp.$1)/this.gradientRatio);var e=Math.floor(parseInt(RegExp.$2)/this.gradientRatio);var a=Math.floor(parseInt(RegExp.$3)/this.gradientRatio);var d=RegExp.$4?parseFloat(RegExp.$4):false;if(d){return"rgba("+f+","+e+","+a+","+d+")"}else{return"rgb("+f+","+e+","+a+")"}}else{return false}};this.getGradient=function(e,d,c,b,a){if(this.gradientType=="radial"){return this.getRadialGradient(e,d,c,b,false,false,true)}else{return this.getLinearGradient(e,d,c,b,a,false,true)}};this.getLinearGradient=function(b,i,a,h,d,c,f){if(!f){this.saveCanvas()}var j=this.getCanvasContext();var e=j.createLinearGradient(b,i,a,h);if(!d){d=this.foreground}if(!c){c=this.getGradientColor(d);e.addColorStop(0,c);e.addColorStop(0.6,d);e.addColorStop(1,d)}else{e.addColorStop(0,d);e.addColorStop(0.5,c)}return e};this.getRadialGradient=function(j,h,a,e,d,c,i){if(!i){this.saveCanvas()}var b=a/5.5;var k=this.getCanvasContext();var f=k.createRadialGradient(j-b,h-b,1,j,h,a);if(!e){e=this.foreground}if(!d){if(this.transparency!=null){d="rgba(0,0,0,"+this.transparency+")"}else{d="rgb(0,0,0)"}}if(!c){c="rgba(0,0,0,0)"}f.addColorStop(0,e);f.addColorStop(1,d);f.addColorStop(1,c);return f};this.colorRGBfromString=function(b){var a=b.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);if(a){if(a[1].length===6){this.colorFromRgb(parseInt(a[1].substr(0,2),16)/255,parseInt(a[1].substr(2,2),16)/255,parseInt(a[1].substr(4,2),16)/255)}else{this.colorFromRgb(parseInt(a[1].charAt(0)+a[1].charAt(0),16)/255,parseInt(a[1].charAt(1)+a[1].charAt(1),16)/255,parseInt(a[1].charAt(2)+a[1].charAt(2),16)/255)}}};this.colorFromRgb=function(e,d,a){if(this.colorRGB){if(e!=null){this.colorRGB[0]=Math.min(Math.max(0,e),1)}if(d!=null){this.colorRGB[1]=Math.min(Math.max(0,d),1)}if(a!=null){this.colorRGB[2]=Math.min(Math.max(0,a),1)}var c=this.rgbFromHsv(this.colorRGB[0],this.colorRGB[1],this.colorRGB[2]);if(c[0]!=null){this.colorHSV[0]=c[0]}if(c[2]!=0){this.colorHSV[1]=c[1]}this.colorHSV[2]=c[2]}};this.rgbFromHsv=function(i,f,c){var j=Math.min(Math.min(i,f),c);var d=Math.max(Math.max(i,f),c);var a=d-j;if(a==0){return[null,0,d]}else{var e=i==j?3+(c-f)/a:(f==j?5+(i-c)/a:1+(f-i)/a);return[e==6?0:e,a/d,d]}};this.colorFromHsv=function(c,b,a){if(c!=null){this.colorHSV[0]=Math.min(Math.max(0,c),6)}if(b!=null){this.colorHSV[1]=Math.min(Math.max(0,b),1)}if(a!=null){this.colorHSV[2]=Math.min(Math.max(0,a),1)}this.colorRGB=this.hsvFromRgb(this.colorHSV[0],this.colorHSV[1],this.colorHSV[2])};this.hsvFromRgb=function(e,d,b){if(e==null){return[b,b,b]}var c=Math.floor(e);var g=c%2?e-c:1-(e-c);var a=b*(1-d);var j=b*(1-d*g);switch(c){case 0:return[b,j,a];case 1:return[j,b,a];case 2:return[a,b,j];case 3:return[a,j,b];case 4:return[j,a,b];case 5:return[b,a,j];case 6:return[b,a,j]}};this.colorRGBToString=function(){if(this.colorRGB){return(256|Math.round(255*this.colorRGB[0])).toString(16).substr(1)+(256|Math.round(255*this.colorRGB[1])).toString(16).substr(1)+(256|Math.round(255*this.colorRGB[2])).toString(16).substr(1)}};this.getColorNames=function(){return this.sortObject(CanvasXpress.colorNames)};this.getColorSchemes=function(){return this.sortObject(CanvasXpress.colorSchemes)};this.getHexColor=function(a){var b=/^#?[0-9a-fA-F]{6}$/i;if(b.test(a)){return a.substring(a.length-6,a.length)}else{var c=a.toLowerCase();if(CanvasXpress.colorNames.hasOwnProperty(c)){return CanvasXpress.colorNames[c]}else{throw new Error(a+" is not a valid color.")}}};this.getColorForValue=function(a,c){if(!a){a=this.meta.def.colorBrew}for(var d=0;d=c){return a.colors[d]}}return a.colors[a.colors.length-1]};this.setColorForValues=function(a,d){var g=this;var c=function(l){var j=function(t,q){var n=a.grads[l];var s=n.min;var y=n.max;var p=n.scol.substring(t,q);var z=n.ecol.substring(t,q);var v=dy?y:d;var i=y-s;var w=parseInt(p,16);var m=parseInt(z,16);var u=(m-w)/i;var o=Math.round(u*(v-s)+w);var x=o.toString(16);return x.length==1?"0"+x:x};var k=j(0,2);var h=j(2,4);var b=j(4,6);return g.hexToRgb("#"+k+h+b)};if(!a){a=this.meta.def.colorBrew}if(a.length==1){return c(0)}else{var f=(a.max-a.min)/a.grads.length;var e=Math.min(Math.floor((Math.max(d,a.min)-a.min)/f),a.grads.length-1);return c(e)}};this.getColorBrew=function(L,C,F,g,f,c){var h=L||this.colorSpectrum;if(C!=null&&F!=null&&C==F){F+=0.1}var G=C!=null?C:this.minData!=null?this.minData:0;var t=F!=null?F:this.maxData!=null?this.maxData:100;var J=!c&&this.setMinX!=null?this.setMinX:null;var x=!c&&this.setMaxX!=null?this.setMaxX:null;var D,w;var M=[];if(g==null){zero=(G+t)/2}else{zero=g;var D=g-G;var w=t-g;if(D>w){t=g+D}else{G=g-w}}var u=this[this.axisAlgorithm](Math.min(J||G,x||t),Math.max(J||G,x||t),5,this.axisWilkinsonLoose);var H=(u[u.length-1]-u[0])/(h.length-1);var a=this.getAxisDecimals(u[1]-u[0]);var d=this.getMaxText(u);var I=this.measureText(d.toString(),this.font);var q=u[u.length-1]-u[0];var e=q/this.colorSpectrumNumber;if(f&&f.length>1&&f.length==h.length){for(var E=0;E0){this.colors=a}};this.setFunctionNames("initColor");this.validateUserColors()};CanvasXpress.prototype.initAttributes=function(){this.setStyle=function(c,b,d){var a=this.getCanvasContext();c=this.validateColor(c);if(this.transparency!=null){c=this.addColorTransparency(c,this.transparency)}a.fillStyle=c;a.strokeStyle=c;a.lineWidth=b?b:this.outlineWidth;a.lineCap=d?d:this.capType;this.setShadow(true)};this.setClipBoundaries=function(c){var b,d,a,e;if(c&&c.length==4){b=c[0];d=c[1];a=c[2];e=c[3]}else{b=this.marginLeft+this.offsetX+this.left;d=this.marginTop+this.offsetY+this.top;a=this.x;e=this.y}return[b,d,a,e]};this.setClipArea=function(a){var e=this.getCanvasContext();this.saveCanvas();e.strokeStyle="rgba(255,255,255,0)";var d,f,c,g;if(a){d=a[0];f=a[1];c=a[2];g=a[3]}else{d=this.marginLeft+this.offsetX+this.left;f=this.marginTop+this.offsetY+this.top;c=this.x+1;g=this.y+1}e.rect(d,f,c,g);e.clip();this.meta.state.clip=true};this.resetClipArea=function(){this.restoreCanvas();this.meta.state.clip=false};this.resetStyle=function(){this.setShadow(false)};this.setShadow=function(c){if(this.showShadow){var a=this.getCanvasContext();var b="rgba(255,255,255,0)";if(c){a.shadowOffsetX=this.shadowOffsetX;a.shadowOffsetY=this.shadowOffsetY;a.shadowBlur=this.shadowBlur;a.shadowColor=this.shadowColor}else{a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0;a.shadowColor=this.background;a.strokeStyle="rgba(255,255,255,0)";a.fillStyle="rgba(255,255,255,0)"}}};this.lineTo=function(c,e,b,d){if(c==b){c=(((c+0.5)<<1)>>1)+0.5;b=c}else{if(e==d){e=(((e+0.5)<<1)>>1)+0.5;d=e}}var a=this.getCanvasContext();a.moveTo(c,e);a.lineTo(b,d);a.stroke()};this.bitCode=function(b,c){var a=0;if(b[0]c[2]){a|=2}}if(b[1]c[3]){a|=8}}return a};this.intersect=function(d,c,e,f){return e&8?[d[0]+(c[0]-d[0])*(f[3]-d[1])/(c[1]-d[1]),f[3]]:e&4?[d[0]+(c[0]-d[0])*(f[1]-d[1])/(c[1]-d[1]),f[1]]:e&2?[f[2],d[1]+(c[1]-d[1])*(f[2]-d[0])/(c[0]-d[0])]:e&1?[f[0],d[1]+(c[1]-d[1])*(f[0]-d[0])/(c[0]-d[0])]:null};this.lineClip=function(n,l,h){var k,j,d,m;var g=n.length;var e=this.bitCode(n[0],l);var c=[];if(!l){l=this.setClipBoundaries()}for(var f=1;fa){c=null}if(nm){n=null}u[0].push(c);u[1].push(n)}break;case"box":case"rect":case"rectangle":case"rect2":case"rect3":case"roundrect":d=this.parseInt(f[0]-(f[2]/2));p=this.parseInt(f[1]-(f[3]/2));c=this.parseInt(d+f[2]);n=this.parseInt(p+f[3]);if(c>d){if(n>p){if(d>a+this.outlineWidth||p>m+this.outlineWidth||ca){c=a}if(pm){n=m}}else{if(d>a+this.outlineWidth||n>m+this.outlineWidth||ca){c=a}if(p>m){p=m}if(np){if(c>a+this.outlineWidth||p>m+this.outlineWidth||da){d=a}if(cm){n=m}}else{if(c>a+this.outlineWidth||n>m+this.outlineWidth||da){d=a}if(cm){p=m}if(ne+a||dq+m){return false}u=[d,p];break;case"line":d=parseFloat(f[0]);p=parseFloat(f[1]);c=parseFloat(f[2]);n=parseFloat(f[3]);if(d==c){if(da){return false}else{if(p>n){if(pm){p=m}}if(n>m){return false}else{if(nm){return false}else{if(pm){n=m}}}}}else{if(p==n){if(pm){return false}else{if(d>c){if(da){d=a}}if(c>a){return false}else{if(ca){return false}else{if(da){c=a}}}}}else{if(d>c){if(da){return false}else{if(p>n){if(pm){return false}else{j=p-n;o=d-c;if(d>a){p-=(d-a)*j/o;d=a}if(p>m){d-=(p-m)*o/j;p=m}if(cm){return false}else{j=n-p;o=d-c;if(d>a){p+=(d-a)*j/o;d=a}if(pm){c+=(n-m)*o/j;n=m}}}}}else{if(ca){return false}else{if(p>n){if(pm){return false}else{j=p-n;o=c-d;if(dm){d+=(p-m)*o/j;p=m}if(c>a){n+=(c-a)*j/o;c=a}if(nm){return false}else{j=n-p;o=c-d;if(da){n-=(c-a)*j/o;c=a}if(n>m){c-=(n-m)*o/j;n=m}}}}}}}u=[d,p,c,n];break;default:return false}return u};this.getLineArea=function(G,v,a,u,W,R,F,K,H,S,T,U,I,L,M){var N=Math.max(F,this.lineWidthEvent);var J=[];var z=["poly"];G=this.validateBezier(G,v,a,u,W,H,S);if(G.match(/error/)){if(this.showErrorBars&&this.isNumeric([v,a,u,W,F])){v=Math.ceil(v);u=Math.ceil(u);a=Math.ceil(a);W=Math.ceil(W);F=Math.ceil(F);var B=F/2;if(F>0){z=["poly",v,a-N,u-N,W-N,u-N,W-B,u+N,W-B,u+N,W+B,u-N,W+B,u-N,W+N,v,a+N]}else{z=["poly",u-N,W+N,u-B,W+N,u-B,W-N,u+B,W-N,u+B,W+N,u+N,W+N,v+N,a,v-N,a]}}else{return false}}else{if(G=="spline"||G=="cardinalSpline"){if(v.length<3){return v.length<2?false:this.getLineArea("line",v[0],a[0],v[1],a[1],R,F,K,H,S,T,U,I,L,M)}for(var Q=0;Q0){if(this.isNumeric2DArray(I)){if(G.match(/bezier/i)){var V=[I[0][0],I[0][1]];for(var Q=0;Q2){z=["poly"];var C=[];for(var Q=0;Q=1;Q--){C.push([I[Q][0],I[Q][1]])}J=this.enlargePolygon(C,N,1);for(var Q=0;Qu?false:!G.match(/curvedcc/i)&&u>=v?true:false;var l=u>=v?Math.asin((k[1]-a)/E):Math.asin(-(k[1]-a)/E);var P=o?l-Math.PI:l+Math.PI;z=["poly"];J=this.traceArc(k[0],k[1],E+N,(P+(o?A:-x)),(l+(o?-x:A)),!o);for(var Q=0;Q=Math.abs(f-g)){if(c.match(/beziery/i)){c=c.replace("beziery","bezier");c=c.replace("bezierY","bezier")}}else{if(c.match(/bezierx/i)){c=c.replace("bezierx","beziery");c=c.replace("bezierX","bezierY")}else{if(c.match(/bezier/i)){c=c.replace("bezier","bezierY")}}}if(d!=null&&h!=null){if(c.match(/beziery/i)){if(f>g){if(g+d>f-h){c="line"}}else{if(g-db){if(b+d>a-h){c="line"}}else{if(b-dthis.errorBarsWidth){if(u>0){this.lineTo(M,g-r,M,g+r)}else{this.lineTo(M-r,g,M+r,g)}}}this.resetStyle()}}else{if(y.match(/spline|cardinalSpline/)){if(O.length<3){return O.length<2?false:this.drawLine("line",O[0],h[0],O[1],h[1],N,u,D,B,P,Q,S,C,E,H)}var o=[];var T=[];var d=0;for(var K=0;K0){var l=C.length-1;if(this.isNumeric2DArray(C)){this.setStyle(N,u,D);if(y.match(/bezier/i)){if(!this.isColorTransparent(N)){I.beginPath();I.moveTo(C[0][0],C[0][1]);for(var K=0;KM?false:!y.match(/curvedcc/i)&&M>=O?true:false;var F=M>=O?Math.asin((J[1]-h)/G):Math.asin(-(J[1]-h)/G);var a=F+Math.PI;this.setStyle(N,u,D);if(!this.isColorTransparent(N)){I.beginPath();if(M>=O){I.arc(J[0],J[1],Math.max(0,G),F-j,a+A,R)}else{I.arc(J[0],J[1],Math.max(0,G),F+A,a-j,R)}I.stroke()}this.resetStyle()}else{if(y.match(/bezier/i)){var z=(O+M)/2;var x=(h+g)/2;this.setStyle(N,u,D);if(!this.isColorTransparent(N)){I.beginPath();I.moveTo(O,h);if(y.match(/beziery/i)){I.bezierCurveTo(O,x,M,x,M,g)}else{I.bezierCurveTo(z,h,z,g,M,g)}I.stroke()}this.resetStyle()}else{this.setStyle(N,u,D);if(!this.isColorTransparent(N)){I.beginPath();this.lineTo(O,h,M,g)}this.resetStyle()}}}}else{this.resetDashDot();return false}}}}}this.resetDashDot();var v=y.match(/bezier/i)?true:false;if(H){var L=y.match(/curved/i)&&P?P:false;if(C&&this.isArray(C)&&C.length>0){O=v?C[l][0]:C[l-1][0];h=v?C[l][1]:C[l-1][1];M=v?C[l][4]:C[l][0];g=v?C[l][5]:C[l][1];if(v){v=C[l][0]==C[l][2]?"X":"Y"}}switch(H){case"arrow":this.drawArrowHead(O,h,M,g,N,u,v,L,0);break;case"square":this.drawArrowHead(O,h,M,g,N,u,v,L,1);break;case"round":this.drawArrowHead(O,h,M,g,N,u,v,L,2);break;case"roundDocked":break}}v=y.match(/bezier/i)?true:false;if(E){var L=y.match(/curved/i)&&B?-B:false;if(C&&this.isArray(C)&&C.length>0){O=v?C[0][0]:C[0][0];h=v?C[0][1]:C[0][1];M=v?C[0][4]:C[1][0];g=v?C[0][5]:C[1][1];if(v){v=C[0][4]==C[l][2]?"X":"Y"}}switch(E){case"arrow":this.drawArrowHead(M,g,O,h,N,u,v,L,0,true);break;case"square":this.drawArrowHead(M,g,O,h,N,u,v,L,1,true);break;case"round":this.drawArrowHead(M,g,O,h,N,u,v,L,2,true);break;case"roundDocked":break}}};this.drawArrowHead=function(F,g,D,e,E,r,I,H,m,k){var z=this.getCanvasContext();var B=function(f,K,b,L){var c=[];for(var w=0;wMath.abs(s)){s=0}else{s=D>F?this.arrowPointSize:-this.arrowPointSize}}else{if(Math.abs(s)>Math.abs(q)){q=0}else{q=e>g?this.arrowPointSize:-this.arrowPointSize}}}else{if(H){var p=this.lineLength(F,g,D,e);var G=this.shortenLine(F,g,D,e,0,p/2,"line");var o=G[2];var C=G[3];var y=p/2;var j=H/y;var x=D>F?Math.asin((C-g)/y):Math.asin(-(C-g)/y);var d=k?x+(Math.PI/20):x-(Math.PI/20);if(D>F){F=o+y*Math.cos(d-j);g=C+y*Math.sin(d-j);D=o+y*Math.cos(x-j);e=C+y*Math.sin(x-j)}else{F=o+y*Math.cos((d-j)+Math.PI);g=C+y*Math.sin((d-j)+Math.PI);D=o+y*Math.cos((x-j)+Math.PI);e=C+y*Math.sin((x-j)+Math.PI)}s=D-F;q=e-g}}this.setStyle(E,m==1?r+2:r);if(m<2){var l=B(u,Math.atan2(q,s),D,e);z.beginPath();z.moveTo(l[0][0],l[0][1]);for(var A=1;A=-1;B-=2){for(var z=0;z0){l.push([s.x,s.y,s.z])}else{l.unshift([s.x,s.y,s.z])}}}}return l};this.drawShapeSetShapeStyle=function(j,i,k,d,e,c,b,a,g){var l=this.getCanvasContext();this.saveCanvas();this.translateCanvas(j,i);if(a){this.rotateCanvas(a)}if(this.transparency!=null){e=this.addColorTransparency(e,this.transparency)}if(this.gradient){if(this.gradientType=="radial"){l.fillStyle=this.getGradient(0,0,Math.max(Math.abs(k),Math.abs(d)),e)}else{l.fillStyle=this.getGradient(0,0,k,d,e)}}else{if(b){switch(b){case"closed":case"solid":l.fillStyle=e;break;case"open":break;default:l.fillStyle=CanvasXpress.cachePatterns[b]?CanvasXpress.cachePatterns[b]:e;break}}else{l.fillStyle=e}}l.strokeStyle=c?c:this.foreground;l.lineWidth=g?g:this.outlineWidth;l.lineJoin=this.joinType;if((k&&l.lineWidth>=k)||(d&&l.lineWidth>=d)){l.strokeStyle=e}this.setShadow(true)};this.drawShapeDraw=function(d,c){var b=this.getCanvasContext();if(d&&d.length>1){var a=d.shift();while(a[0]==null||a[1]==null){a=d.shift()}b.beginPath();b.moveTo(a[0]+0.5,a[1]+0.5);while(d.length>0){a=d.shift();while(a[0]==null||a[1]==null){a=d.shift()}b.lineTo(a[0]+0.5,a[1]+0.5)}if(!c){b.closePath()}}};this.drawShapeFillStroke=function(b,d,c){var a=this.getCanvasContext();if(c&&c=="open"){a.stroke()}else{if(d==b||a.strokeStyle==a.fillStyle){a.fill()}else{a.fill();a.stroke()}}};this.drawShapeRestore=function(a,d,c){var b=this.getCanvasContext();this.setShadow(false);if(c){this.rotateCanvas(-c)}this.translateCanvas(-a,-d);this.restoreCanvas()};this.getShapeArea=function(v,m,l,n,G,H,D,C,B,k,L,M,A,I,q,J){var j=this;var F=function(d){if(j.graphType=="Network"){return d}d.shift();var b=["poly"];var f=Math.cos(B);var c=Math.sin(B);for(var e=0;eai?ai/4:R/4;this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);I.beginPath();I.moveTo(-j,-ar+Q);I.lineTo(-j,ar-Q);I.quadraticCurveTo(-j,ar,-j+Q,ar);I.lineTo(j-Q,ar);I.quadraticCurveTo(j,ar,j,ar-Q);I.lineTo(j,-ar+Q);I.quadraticCurveTo(j,-ar,j-Q,-ar);I.lineTo(-j+Q,-ar);I.quadraticCurveTo(-j,-ar,-j,-ar+Q);I.closePath();this.drawShapeFillStroke(aj,Z,Y);break;case"brace":var Q=R>ai?ai/4:R/4;this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);I.beginPath();I.moveTo(-j,-ar);I.bezierCurveTo(-j,0,0,0,0,ar);I.bezierCurveTo(0,0,j,0,j,-ar);this.drawShapeFillStroke(aj,Z,Y);break;case"square":M=[[-j,-j],[j,-j],[j,j],[-j,j]];this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M);this.drawShapeFillStroke(aj,Z,Y);break;case"triangle":if(R==ai){return this.drawShape("equilateral",P,O,R,ai,aj,Z,Y,W,N,ao,aq,V,al,S,am)}M=[[0,-ar],[j,ar],[-j,ar]];this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M);this.drawShapeFillStroke(aj,Z,Y);break;case"triangle2":if(R==ai){return this.drawShape("equilateral2",P,O,R,ai,aj,Z,Y,W,N,ao,aq,V,al,S,am)}M=[[0,ar],[j,-ar],[-j,-ar]];this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M);this.drawShapeFillStroke(aj,Z,Y);break;case"equilateral":var Q=R*Math.sqrt(3)/6;var g=Q/2;var C=Math.sqrt((Q*Q)-(g*g));M=[[0,-ar],[j,ar],[-j,ar]];this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M);this.drawShapeFillStroke(aj,Z,Y);break;case"equilateral2":var Q=R*Math.sqrt(3)/6;var g=Q/2;var C=Math.sqrt((Q*Q)-(g*g));M=[[0,ar],[j,-ar],[-j,-ar]];this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M);this.drawShapeFillStroke(aj,Z,Y);break;case"diamond":case"rhombus":M=[[0,-ar],[j,0],[0,ar],[-j,0]];this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M);this.drawShapeFillStroke(aj,Z,Y);break;case"hexagon":var an=R/3;var q=an-j;M=[[q,-ar],[-q,-ar],[j,0],[-q,ar],[q,ar],[-j,0]];this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M);this.drawShapeFillStroke(aj,Z,Y);break;case"octagon":var au=R/4;var ag=ai/4;M=[[-au,-ar],[au,-ar],[j,-ag],[j,ag],[au,ar],[-au,ar],[-j,ag],[-j,-ag]];this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M);this.drawShapeFillStroke(aj,Z,Y);break;case"oval":this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.saveCanvas();this.scaleCanvas(1,X);I.beginPath();I.arc(0,0,Math.max(0,R/2),0,Math.PI*2,true);I.closePath();this.restoreCanvas();this.drawShapeFillStroke(aj,Z,Y);break;case"oval2":return this.drawShape("oval",P,O,R,R/2,aj,Z,Y,W,N,ao,aq,V,al,S,am);break;case"oval3":return this.drawShape("oval",P,O,R,R/3,aj,Z,Y,W,N,ao,aq,V,al,S,am);break;case"arc":this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.saveCanvas();this.scaleCanvas(1,X);I.beginPath();I.arc(0,0,Math.max(0,R/2),0,Math.PI,true);if(Y!="open"){I.closePath()}this.restoreCanvas();this.drawShapeFillStroke(aj,Z,Y);break;case"arc2":var E=ai*Math.cos(V);var ax=ai*Math.sin(V);var D=ai*Math.cos(al);var av=ai*Math.sin(al);var B=this.shortenLine(0,0,E,ax,0,R,"line");var v=this.shortenLine(0,0,D,av,0,R,"line");this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);I.beginPath();I.moveTo(B[2],B[3]);I.lineTo(E,ax);I.arc(0,0,Math.max(0,ai),V,al,false);I.lineTo(v[2],v[3]);I.arc(0,0,Math.max(0,ai-R),al,V,true);I.closePath();this.drawShapeFillStroke(aj,Z,Y);break;case"arc3":this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.saveCanvas();this.scaleCanvas(1,X);I.beginPath();I.arc(0,0,Math.max(0,R/2),0,Math.PI,true);this.restoreCanvas();this.drawShapeFillStroke(aj,Z,Y);break;case"arch":this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);I.beginPath();I.moveTo(M[0][0],M[0][1]);I.quadraticCurveTo(M[1][0],M[1][1],M[2][0],M[2][1]);I.arc(0,0,Math.max(0,ai[0]),R[3],R[2],true);I.quadraticCurveTo(M[4][0],M[4][1],M[5][0],M[5][1]);I.arc(0,0,Math.max(0,ai[1]),R[1],R[0],true);I.closePath();this.drawShapeFillStroke(aj,Z,Y);break;case"path":this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M,Y=="open");this.drawShapeFillStroke(aj,Z,Y);break;case"polygon":this.drawShapeSetShapeStyle(P,O,R,ai,aj,Z,Y,W,N);this.drawShapeDraw(M,Y=="open");this.drawShapeFillStroke(aj,Z,Y);break;case"spline":var T=[];var ab=[];var F=[];ab.push(ap.shift());ab.push(ap.shift());F.push(ap.pop());F.unshift(ap.pop());var aa=ap.length;for(var ah=0;ah1){G.push([ap.shift(),ap.shift()])}var T=this.hullControlPoints(G);var m=[[G[0][0],G[0][1],T[T.length-1][0],T[T.length-1][1],T[0][0],T[0][1],G[1][0],G[1][1]]];for(var ah=1;ahk){var f=k;d=k;d=f}var j=[];var g=c(k-d,false);var l=c(g/(b-1),true);var a=Math.floor(d/l)*l;var h=Math.ceil(k/l)*l;for(var e=a;e<=h;e+=l){j.push(this.approx(e))}return j};this.wilkinson=function(c,h,a){var b=function(z,B,A,y){var u=[10,1,5,2,2.5,3,4,1.5,7,6,8,9];var w=B-z;var r=A-1;var o=1-Math.abs(A-y)/y;var D=w/r;var t=Math.floor(Math.log(D)/Math.LN10);var E=Math.pow(10,t);var p=null;for(var C=0;C=B){var v=1-(C-(F<=0&&n>=0?1:0))/u.length;var q=(B-z)/(n-F);if(q>0.8){var x=o+v+q;if(p==null||x>p.score){p={lmin:F,lmax:n,lstep:s,score:x}}}}}if(!p){p={lmin:z,lmax:B,lstep:1,score:0}}return p};if(c>h){var g=h;c=h;c=g}var j=[];var e=null;var l=[];for(var f=Math.max(Math.floor(a/2),2);f<=Math.ceil(6*a);f++){l.push(f)}for(var f=0;fe.score)){e=m}}for(var f=e.lmin;f<=e.lmax;f+=e.lstep){j.push(this.approx(f))}return j};this.wilkinsonExtended=function(a,y,R,C){var A=2.22e-14;var f=function(j,g){for(var c=0;c=0?1:0;return 1-s/(k-1)-m+Z};var K=function(s,m,g){var w=m.length;var k=f(s,m);var c=1;return 1-k/(w-1)-g+c};var h=function(c,i,j,g){return 1-0.5*(Math.pow(i-g,2)+Math.pow(c-j,2))/Math.pow(0.1*(i-c),2)};var r=function(c,k,i){var g=k-c;if(i>g){var j=(i-g)/2;return 1-0.5*(Math.pow(j,2)+Math.pow(j,2))/Math.pow(0.1*g,2)}else{return 1}};var o=function(j,c,i,s,w,q){var n=(j-1)/(q-w);var g=(c-1)/(Math.max(q,s)-Math.min(i,w));return 2-Math.max(n/g,g/n)};var X=function(g,c){return g>=c?2-(g-1)/(c-1):1};var e=[1,5,2,2.5,4,3];var G=[0.25,0.2,0.5,0.05];var P=e.length;var L={score:-2};var H=[];if(a>y){var l=a;a=y;y=l}if(y-aO){F++;continue}for(var x=v;x<=O;x++){var t=x*(D/T);var M=t+D*(S-1);var d=D;var I=J(N,e,T,t,M,d);var W=h(a,y,t,M);var V=o(S,R,a,y,t,M);var b=G[0]*I+G[1]*W+G[2]*V+G[3];if(b>L.score&&(!C||(t<=a&&M>=y))){L={lmin:t,lmax:M,lstep:d,score:b}}}F++}S++}}T++}for(var U=L.lmin;U<=L.lmax;U+=L.lstep){H.push(this.approx(U))}return H};this.rPretty=function(o,p,r){if(o>p){var w=p;o=p;o=w}var a,e,b;var l=[];var q=Math.floor(r)-1;var s=Math.floor(q%3);var g=0.75;var v=1.5;var d=0.5+1.5*v;var f=p-o;if(f==0&&p==0){a=1;e=true;b=1}else{a=Math.max(Math.abs(o),Math.abs(p));b=1+d>=1.5*v+0.5?1/(1+v):1.5/1+d;e=f<(a*b*Math.max(1,q)*1e-7*3)}if(e){if(a>10){a=9+a/10}a=a*g;if(s>1){a/=s}}else{a=f;if(q>1){a/=q}}if(a<20*1e-7){a=20*1e-7}var c=Math.pow(10,Math.floor(Math.log(a)/Math.LN10));var j=c;if((2*c)-ao+(1e-7*j)){y--}while(x*j=0){x+=t/2;y=y-t/2+t%2}else{y-=t/2;x=x+t/2+t%2}q=s}else{q=t}for(var u=y*j;u<=x*j;u+=j){l.push(this.approx(u))}return l};this.getAxisDecimals=function(a){a=this.approx(a).toString();return a.indexOf(".")>=0?Math.min(Number(a.length-(a.indexOf(".")+1)),20):0};this.setFunctionNames("initRangeAlgorithms")};CanvasXpress.prototype.initPrimitives=function(){this.initText();this.initTime();this.initColor();this.initAttributes();this.initRangeAlgorithms()};CanvasXpress.prototype.initGeneralUtils=function(){this.modifyObjectArray=function(c,g,h,f,j){this.functionCaller="modifyObjectArray";if(this.isTransition()){return}var e=this[h];if(f){var a={};if(this.isArray(c)){var b=c.length;for(var d=0;d0;d--){var c=Math.floor(this.random()*d);var a=b[--d];b[d]=b[c];b[c]=a}return b};this.toNumber=function(c){var f=[];var d=this.isArray(c);c=this.toArray(c);var b=c.length;for(var e=0;e=a?b:new Array(a-b.length+1).join("0")+b};this.isPivotable=function(){var b=this.data.y.vars.length;var c=this.data.x?this.getKeys(this.data.x):[];var a=c.length;return b+a==3};this.pivotMatrix=function(j,g,l,d){var c={};var f=[];var e=[];var a=j.length;for(var b=0;b>1};this.getIpRangeFromAddressAndNetmask=function(g){var c=g.split("/");var e=c[0].split(".");var d=["0","0","0","0"];if(!/\d+\.\d+\.\d+\.\d+/.test(c[1])){d=("1".repeat(parseInt(c[1],10))+"0".repeat(32-parseInt(c[1],10))).match(/.{1,8}/g);d=d.map(function(h){return parseInt(h,2)})}else{d=c[1].split(".").map(function(h){return parseInt(h,10)})}var b=d.map(function(h){return h^255});var a=e.map(function(i,h){return i&d[h]});var f=e.map(function(i,h){return i|b[h]});return[a.join("."),f.join(".")]};this.int2Ip=function(a){return((a>>>24)+"."+(a>>16&255)+"."+(a>>8&255)+"."+(a&255))};this.ip2Int=function(a){return a.split(".").reduce(function(c,b){return(c<<8)+parseInt(b,10)},0)>>>0};this.setFunctionNames("initGeneralUtils")};CanvasXpress.prototype.initPlotUtils=function(){this.setVideoControls=function(){if(this.isVideo){var b=this;if(typeof _V_=="undefined"||!_V_.autoSetupTimeout){setTimeout(function(){b.setVideoControls()},100)}else{var e=_V_(this.target+"-cX-Video");var a=this.$(this.target+"-cX-Video");if(e&&a){a.style.position="absolute";a.style.background="transparent";this.video=a.childNodes[0];this.video.style.display="none";this.video.style.zIndex=-1;this.video.playbackRate=this.videoPlaybackRate;b.addEvtListener(this.video,"loadeddata",function(){b.addEvtListener(b.video,"play",b.videoPlay,false)},false);if(this.videoAutoplay){e.play();var c=function(){this.play=function(){if(b.video.readyState==4){b.drawVideo(b.video,b.width,b.height);clearInterval(d)}};var d=b.setInterval(this.play,30)};c.call()}}}}};this.drawLayoutCanvasCompartments=function(){this.functionCaller="drawLayoutCanvasCompartments";var n=this.canvasBoxColor;var m=this.height;var s=this.width;var g=this.left;var d=this.right;var p=this.bottom;var u=this.top;var j=this.marginLeft;var e=this.marginRight;var q=this.marginBottom;var a=this.marginTop;var o=this.layoutLeft;var k=this.layoutRight;var f=this.layoutBottom;var i=this.layoutTop;this.addToRender(["drawShape","rectangle",(j+this.offsetX)+(this.layoutWidth/2),(a+this.offsetY)+(this.layoutHeight/2),this.layoutWidth,this.layoutHeight,false,n,"open"]);this.addToRender(["drawLine","line",j,0,j,m,n]);this.addToRender(["drawLine","line",o+j,0,o+j,m,n]);this.addToRender(["drawLine","line",0,a,s,a,n]);this.addToRender(["drawLine","line",0,a+i,s,a+i,n]);this.addToRender(["drawLine","line",s-e,0,s-e,m,n]);this.addToRender(["drawLine","line",s-(e+k),0,s-(e+k),m,n]);this.addToRender(["drawLine","line",0,m-q,s,m-q,n]);this.addToRender(["drawLine","line",0,m-(q+f),s,m-(q+f),n]);this.addToRender(["drawLine","line",o+j+g,0,o+j+g,m,n]);this.addToRender(["drawLine","line",0,a+i+u,s,a+i+u,n]);this.addToRender(["drawLine","line",s-(e+k+d),0,s-(e+k+d),m,n]);this.addToRender(["drawLine","line",0,m-(q+f+p),s,m-(q+f+p),n])};this.drawCanvasBox=function(a){this.functionCaller="drawCanvasBox";if(this.canvasBox&&(this.graphType!="Network"||a)){this.addToRender(["disableGradientTransparencyShadow"]);this.addToRender(["drawShape","rectangle",this.width/2,this.height/2,this.width-2,this.height-2,false,this.canvasBoxColor,"open"]);this.addToRender(["enableGradientTransparencyShadow"])}};this.drawPlotWindow=function(){this.functionCaller="drawPlotWindow";if(this.backgroundType.match("window")){this.addToRender(["disableGradientTransparencyShadow"]);var a=this.marginLeft+this.offsetX+this.left;var b=this.marginTop+this.offsetY+this.top;if(this.backgroundType=="windowSolidGradient"){var c=this.getLinearGradient(a,b,this.gradientOrientation=="vertical"?a:b+this.y,this.gradientOrientation=="vertical"?a+this.x:b,this.backgroundGradient1Color,this.backgroundGradient2Color);this.addToRender(["drawShape","rectangle",a+(this.x/2),b+(this.y/2),this.x,this.y,c,c])}else{if(this.backgroundType=="windowImage"){this.addToRender(["drawShape","image",a+(this.x/2),b+(this.y/2),this.x,this.y,false,false,false,false,false,false,false,false,false,this.backgroundImage])}else{this.addToRender(["drawShape","rectangle",a+(this.x/2),b+(this.y/2),this.x,this.y,this.backgroundWindow,this.backgroundWindow])}}this.addToRender(["enableGradientTransparencyShadow"])}};this.validateSegregation=function(){var e="";var b=this.segregateVariablesBy;var d=this.segregateSamplesBy;if(b.length>0){var a=[];for(var c=0;c0){var a=[];for(var c=0;c0&&d.length>0){if(d.length>1){while(d.length>1){d.pop()}e+="Only one sample segregation when variable segregation is selected\n";e+="segregateSamplesBy was set to: "+d[0]+"\n"}if(b.length>1){while(b.length>1){b.pop()}e+="Only one variable segregation when sample segregation is selected\n";e+="segregateVariblesBy was set to: "+b[0]+"\n"}}else{if(d.length>0){if(d.length>2){while(d.length>2){d.pop()}e+="Maximum of two sample segregations\n";e+="segregateSamplesBy was set to: "+d[0]+","+d[1]+"\n"}}else{if(b.length>0){if(b.length>2){while(b.length>2){b.pop()}e+="Maximum of two variable segregations\n";e+="segregateVariablesBy was set to: "+b[0]+","+b[1]+"\n"}}}}if(e!=""){this.removeMenus();alert(e);return false}return true};this.checkSegregation=function(){if(this.graphType!="Candlestick"&&!this.isDOE){if(this.validateSegregation()){if(this.data.l){if(this.segregateSamplesBy.length==0){}else{if(!this.data.l.smps){this.segregateSamples(this.segregateSamplesBy,true)}}if(this.segregateVariablesBy.length==0){}else{if(!this.data.l.vars){this.segregateVariables(this.segregateVariablesBy,true)}}}else{if(this.segregateSamplesBy.length>0&&this.segregateVariablesBy.length>0){this.segregateSamplesVariables(true)}else{if(this.segregateSamplesBy.length>0){this.segregateSamples(this.segregateSamplesBy,true)}else{if(this.segregateVariablesBy.length>0){this.segregateVariables(this.segregateVariablesBy,true)}}}}}}};this.validateOverlays=function(){if(this.smpOverlays.length>0){var a=[];for(var b=0;b0){var a=[];for(var b=0;bg&&e>this.minTextSize){e--;this[c]=this[c+"Style"]+" "+e+"px "+this.fontName;a=this.measureText(b,this[c])}}};this.setAspectRatioProperties=function(){if(this.adjustAspectRatio){var b=this.meta.config.orig;var g=Math.min(this.width,this.height);var f=this.zoomScale?this.zoom:1;var e=["ringSeparation","margin","marginLeft","marginTop","marginRight","marginBottom","overlaysThickness","dendrogramHeight","heatmapSeparatorThickness","dataPointSize"];if(this.adjustAspectRatioHeatmapIndicator){e.push("heatmapIndicatorHeight");e.push("heatmapIndicatorWidth")}for(var c=0;c50?30:h>30?40:50}}};this.resetAspectRatioProperties=function(){if(this.adjustAspectRatio){if(this.graphType=="Network"&&!this.layoutDone){this.setTimeout(this.resetAspectRatioProperties,50);return}var a=this.meta.config.orig;var c=["ringSeparation","margin","marginLeft","marginTop","marginRight","marginBottom","overlaysThickness","dendrogramHeight","heatmapSeparatorThickness","dataPointSize"];if(this.adjustAspectRatioHeatmapIndicator){c.push("heatmapIndicatorHeight");c.push("heatmapIndicatorWidth")}for(var b=0;bthis.width||e>9){b/=2;this.setPropertyFontSize(this.width,"citationFont",b);a=this.measureText(this.citation,this.citationFont);e++}this.addToRender(["drawText",this.citation,c,d,this.citationFont,this.citationColor,"right","bottom"])}};this.drawCx=function(){var b=this.hexToString("686578546f537472696e67");var e=this[b]("6472617754657874");var c=this[b]("6d657461");if(CanvasXpress[this[b]("666163746f7279")][this[b]("76616c6964")]!=null){switch(CanvasXpress[this[b]("666163746f7279")][this[b]("76616c6964")]){case 0:return;case 1:var a=this[b]("4e6f7420612076616c696420636f7079206f662063616e766173587072657373");this[e](a,this.width/2,this.height/2,this.font,"rgba(0,0,0,0.5)","center","middle");return;case 2:var a=this[b]("556e737570706f727465642063616e7661735870726573732056657273696f6e");this[e](a,this.width/2,this.height/2,this.font,"rgba(0,0,0,0.5)","center","middle");return;case 3:var a=this[b]("63616e76617358707265737320522076657273696f6e206f6e6c79");this[e](a,this.width/2,this.height/2,this.font,"rgba(0,0,0,0.5)","center","middle");return;default:return}}};this.getGroupColor=function(b,e){var h;if(this.isGroupedData){var a=this.data.w.grps[e];this.isGroupedData=false;h=this.getPropertyValue(b,a[0],"colorBy");for(var d=1;d0){for(var b=0;b0&&this.hideDataPoint[a]){if(this.broadcastType=="var"){return false}else{if(this.hideDataPoint[a].hasOwnProperty(b)){return false}}}}return true};this.getVarColor=function(a,c){if(this.isArray(this.highlightVar)){for(var b=0;b-1){return this.getPropertyValue(b,false,"colorVarDendrogramBy")}}return this.getVarColor(a,true)}else{if(this.colorSmpDendrogramBy&&this.data.x&&this.data.x.hasOwnProperty(this.colorSmpDendrogramBy)){var b=this.getSampleIndices(c);if(b>-1){return this.getPropertyValue(false,b,"colorSmpDendrogramBy")}}return this.getSmpColor(c,true)}};this.isStringOverlays=function(c){var a=this.meta.data;if((!c||c=="v")&&a.z&&this.varOverlays.length>0){for(var b=0;b0){for(var b=0;bthis.sizes.length){return this.cloneObject(this.sizes)}else{var e=[];var b=Math.floor(this.sizes.length/g);for(var c=0;cg)?f:g}var d=j*j;var h=e*e;return Math.max(d*f/h,h/(d*b))}};this.adjustTreemapCoords=function(f,e){if(f){var c=this.treemapBorderWidth?1:0;var a=this.treemapBorderWidth;var b=a*2;var d=this.smpLabelFontSize*c;e.left+=a;if(e.height>d+b){e.top+=d+a;e.height-=(d+b);e.border=2}else{if(e.height>b){e.top+=a;e.height-=b;e.border=1}else{if(e.height>a){e.height-=a;e.border=0}else{e.border=-1}}}e.width-=b}};this.setTreemapRowVerticalLayout=function(k,h,g,f){var c=0;for(var b=0;b=2&&c.length==0){c=[a.shift()]}if(a.length==0){if(c.length>0){this.setTreemapRowLayout(c,b,f,h)}return}var d=a[0];if(this.getWorstAspectRatio(c,b)>=this.getWorstAspectRatio([d].concat(c),b)){this.computeTreemapDimensions(a.slice(1),c.concat([d]),b,f,d.title)}else{var g=this.setTreemapRowLayout(c,b,f,h);this.computeTreemapDimensions(a,[],g.orientation,g,d.title)}};this.squarifyTreemap=function(a,g){var f=g.width*g.height;var e=0;var b=[];for(var d=0;d=d.height){this.treemapOrientation="horizontal"}else{this.treemapOrientation="vertical"}if(b.length){this.squarifyTreemap(b,d);for(var c=0;cthis.tagCloudTextRotateRatio){return 0}return(-Math.PI/2)+(this.random()*Math.PI)};this.getCloudTextInfo=function(z,n,o){var a=Math.min(500,Math.floor(this.tagCloudTextWeightFactor*n));var s=document.createElement("canvas");var A=s.getContext("2d",{willReadFrequently:true});var p=a+"px "+this.fontName;A.font=p;var b=this.measureText(z,p);var m=a;var i=b+m*2;var g=m*3;var B=Math.ceil(i/this.tagCloudTextGridSize);var c=Math.ceil(g/this.tagCloudTextGridSize);i=B*this.tagCloudTextGridSize;g=c*this.tagCloudTextGridSize;var t=-b*0.5;var q=-m*0.5;var u=Math.ceil((i*Math.abs(Math.sin(o))+g*Math.abs(Math.cos(o)))/this.tagCloudTextGridSize);var d=Math.ceil((i*Math.abs(Math.cos(o))+g*Math.abs(Math.sin(o)))/this.tagCloudTextGridSize);var v=d*this.tagCloudTextGridSize;var r=u*this.tagCloudTextGridSize;if(v<1||r<1){return{occupied:[],bounds:[0,0,0,0],gw:d,gh:u,fillTextOffsetX:t,fillTextOffsetY:q,fillTextWidth:b,fillTextHeight:m,fontSize:a}}s.setAttribute("width",v);s.setAttribute("height",r);A.save();A.translate(v/2,r/2);A.rotate(-o);A.font=a+"px "+this.fontName;A.fillStyle="#000";A.textBaseline="middle";A.fillText(z,t,q+a*0.5);A.restore();var w=A.getImageData(0,0,v,r).data;var f=[];var l=d,k,j,h;var e=[u/2,d/2,u/2,d/2];while(l--){k=u;while(k--){h=this.tagCloudTextGridSize;singleGridLoop:{while(h--){j=this.tagCloudTextGridSize;while(j--){if(w[((k*this.tagCloudTextGridSize+h)*v+(l*this.tagCloudTextGridSize+j))*4+3]){f.push([l,k]);if(le[1]){e[1]=l}if(ke[2]){e[2]=k}break singleGridLoop}}}}}}return{occupied:f,bounds:e,gw:d,gh:u,fillTextOffsetX:t,fillTextOffsetY:q,fillTextWidth:b,fillTextHeight:m,fontSize:a}};this.canFitCloudText=function(g,f,h,b,a){var e=a.length;while(e--){var d=g+a[e][0];var c=f+a[e][1];if(d>=this.tagCloudGridWidth||c>=this.tagCloudGridHeight||d<0||c<0||!this.tagCloudGrid[d][c]){return false}}return true};this.fillCloudGridAt=function(a,b){if(a>=this.tagCloudGridWidth||b>=this.tagCloudGridHeight||a<0||b<0){return}this.tagCloudGrid[a][b]=false};this.updateCloudGrid=function(e,c,d){var a=d.occupied;var b=a.length;while(b--){this.fillCloudGridAt(e+a[b][0],c+a[b][1])}};this.drawCloudTag=function(c,h,f,d){this.functionCaller="drawCloudTag";var j=this;var k=this.getCloudRotateDeg();var e=this.getCloudTextInfo(c,h,k);if(!e){return false}var b=e.bounds;if((b[1]-b[3]+1)>this.tagCloudGridWidth||(b[2]-b[0]+1)>this.tagCloudGridHeight){return false}var a=this.tagCloudGridMaxRadius+1;var i=this.addColorTransparency(f,0);while(a--){var l=this.getCloudPointsAtRadius(this.tagCloudGridMaxRadius-a);l=[].concat(l);this.shuffleArray(l);var g=l.some(function m(o){var u=Math.floor(o[0]-e.gw/2);var t=Math.floor(o[1]-e.gh/2);var v=e.gw;var q=e.gh;var p=e.fontSize+"px "+j.fontName;var n="1px "+j.fontName;if(!j.canFitCloudText(u,t,v,q,e.occupied)){return false}var s=((u+e.gw/2)*j.tagCloudTextGridSize);var r=((t+e.gh/2)*j.tagCloudTextGridSize);j.renderTagCloud.push([["drawText",c,s,r,p,f,"center","middle",-k],d,false,null,false,[j.width/2,j.height/2,n,i,-Math.PI*2]]);j.updateCloudGrid(u,t,e);return true});if(g){return true}}return false};this.setTagCloud=function(b){this.tagCloudTextGridSize=Math.max(this.tagCloudTextGridSize,4);if(this.colorBy&&this.legendColorsN){this.tagCloudGridWidth=Math.floor(this.x/this.tagCloudTextGridSize);this.tagCloudGridHeight=Math.floor(this.y/this.tagCloudTextGridSize)}else{this.tagCloudGridWidth=Math.floor(this.width/this.tagCloudTextGridSize);this.tagCloudGridHeight=Math.floor(this.height/this.tagCloudTextGridSize)}this.tagCloudGridCenter=[this.tagCloudGridWidth/2,this.tagCloudGridHeight/2];this.tagCloudGridMaxRadius=Math.floor(Math.sqrt(this.tagCloudGridWidth*this.tagCloudGridWidth+this.tagCloudGridHeight*this.tagCloudGridHeight));this.tagCloudGridPoints=[];if(!b){this.setTagCloudTextWeightFactor()}else{this.tagCloudTextWeightFactor*=b}this.tagCloudGrid=[];var c=this.tagCloudGridWidth;var a;while(c--){this.tagCloudGrid[c]=[];a=this.tagCloudGridHeight;while(a--){this.tagCloudGrid[c][a]=true}}};this.setTagCloudTextWeightFactor=function(){var h=0;var b=0;var k=this.varIndices[0];for(var g=0;gb){this.tagCloudTextWeightFactor=(this.width*this.height)/(h*this.tagCloudTries)}else{this.tagCloudTextWeightFactor=(this.width*this.height)/(h*this.tagCloudTries*(b/h))}this.tagCloudTries+=1};this.tryRenderTagCloud=function(g){var e=this.randomSeed;this.renderTagCloud=[];this.setTagCloud(g);var j=this.varIndices[0];for(var b=0;b=this.maxPieSectors-1){b.oprc+=a;b.idso.push(g);b.no++}else{b.ids.push(g)}b.cols.push(n)}}if(b.no){b.ids.push(-1)}return b};this.drawPie=function(t,g,f,q,H,v){this.functionCaller="drawPie";var o=function(){for(var a=0;a-1&&isNaN(t.data[t.ids[a]])){return false}}return true};if(o()){var w,d,m;var k=this.startPieSectors!=null?(this.startPieSectors*Math.PI/180)%360:0;var z=this.pieSegmentLabels=="inside"?q-(q/3):q+(q/6);var F=0;var B=this.layoutComb?this.smpIndices[0]:this.xAxisIndices?this.xAxisIndices[0]:0;for(var D=0;D-1?t.data[h]:t.oprc;var e=t.cols[D];w=d!=null?parseFloat(d):parseFloat((Math.PI*(2*F))-k);d=parseFloat(w+(Math.PI*(2*(u))));var G=(w+d)/2;var A=(d-w)/32;var C=this.pieType=="separated"?this.background:this.pieType=="solid"?this.foreground:this.foreground;this.drawSelectedBackground(h>-1?h:t.idso[0],B,"pie",g,f,(q*2)+10,q+10,false,true,w,d);if(this.graphType=="Network"){this.addToRender(["drawShape","pie",g,f,(q*2),q,e,e,"closed",false,1,false,false,w,d],H[D],v)}else{if(this.graphType!="Pie"){this.addToRender(["drawShape","pie",g,f,(q*2),q,e,e,"closed",false,1,false,false,w,d],H[D],v)}else{if(h>-1){this.addToRender(["drawShape","pie",g,f,(q*2),q,e,e,"closed",false,1,false,false,w,d],[h,B])}else{this.addToRender(["drawShape","pie",g,f,(q*2),q,e,e,"closed",false,1,false,false,w,d],t.idso)}}}var E=t.ids.length>1?g-Math.sin(G-(Math.PI/2))*z:g;var b=t.ids.length>1?f+Math.cos(G-(Math.PI/2))*z:f;if(this.graphType!="Network"&&this.showPieValues&&(d-w)>0.05){if(this.pieLabelType=="value"){this.addToRender(["drawText",t.raw[h],E,b,this.axisTickFont,this.axisTickColor,"center","middle"])}else{this.addToRender(["drawText",sprintf("%."+this.pieSegmentPrecision+"f",u*100)+"%",E,b,this.axisTickFont,this.axisTickColor,"center","middle"])}}F+=u}F=0;d=null;if(t.ids.length>1){for(var D=0;D-1?t.data[h]:t.oprc;w=d!=null?parseFloat(d):parseFloat((Math.PI*(2*F))-k);d=parseFloat(w+(Math.PI*(2*(u))));var C=this.pieType=="separated"?this.background:this.pieType=="solid"?this.foreground:this.foreground;this.addToRender(["drawShape","pie",g,f,(q*2),q,false,C,"open",false,this.pieSegmentSeparation,false,false,w,d],false,false,null,true);F+=u}}if(this.pieInnerRadius>0&&this.pieInnerRadius<1){this.addToRender(["drawShape","circle",g,f,q*this.pieInnerRadius*2,q*this.pieInnerRadius*2,this.background,this.background,"closed"])}}};this.drawBarPlot=function(U,T,N,E,B,I,D,x,M,K,V,J,X,L,R,O){this.functionCaller="drawBarPlot";var C,A,S,H;var j=this;var W=this.getOutlineColor();var F=this.variableSpaceFactor/2;var Q=B/2;if(K=="vertical"||this.graphType=="Network"){for(var P=0;P=0;a--){b[0].push(r[0][a]);b[1].push(r[1][a][1])}}else{for(var a=0;a=0;a--){b[0].push(r[0][a][1]);b[1].push(r[1][a])}}return b};var Q,A,y,x,j,ai,ah,E,ad,I;var K=null;var C=null;var G=L/2;var F=Math.min(10,L/3);var af=P=="open"?ae:this.foreground;var S=ac.length-1;var J=[[],[]];var r=[[],[]];var W=[];var B=this.getVariableIndices(E);if(R=="vertical"){A=U;y=U+Y;if(K==null){K=A}for(var X=1;X0&&isNaN(ai)){var v=this.addColorTransparency(ae,0.3);if(this.lineType=="spline"){this.addToRender(["drawShape","confidence",r[0],r[1],false,false,v,v,"closed"],["Line-Error:"+E+":"+B],false,null,false,W)}else{var D=H();this.addToRender(["drawShape","path",D[0],D[1],false,false,v,v,"closed"],["Line-Error:"+E+":"+B],false,null,false,W)}r=[[],[]];W=[]}A+=Y;y+=Y}if(!isNaN(ai)){if(this.lineDecoration&&O){ad=this.addToRender(["drawShape",O,A,ai,F,F,ae,af,P[S],false,false,Z],ag[S],aa,I,false,[K,C])}else{ad=this.addToRender(["drawShape","sphere",A,ai,F,F,this.addColorTransparency(ae,0),"rgba(0,0,0,0)",P[S],false,false,Z],ag[S],aa,I,false,[K,C])}if(!I){I=ad}if(ab[S]!=null&&!isNaN(ab[S])){ah=(ab[S]/2)*this.isObject(M)?M[S].units:M;if(this.lineErrorType=="bar"){this.addToRender(["drawLine","error",A,ai,A,ai+ah,ae,-G,"butt"],["Line:"+E+":"+B],false,I);this.addToRender(["drawLine","error",A,ai,A,ai-ah,ae,-G,"butt"],["Line:"+E+":"+B],false,I)}else{if(X==ac.length){r[0].push([A,A]);r[1].push([ai+ah,ai-ah]);W.push([A,ai])}}}if(this.lineType=="spline"){J[0].push(A);J[1].push(ai)}}if(this.lineType=="spline"){ad=this.addToRender(["drawLine","spline",J[0],J[1],false,false,ae,this.lineThickness,false,false,false,Z],["Line:"+E+":"+B],false,null,false,[K,C])}if(!I){I=ad}if(r[0].length>0){var v=this.addColorTransparency(ae,0.3);if(this.lineType=="spline"){this.addToRender(["drawShape","confidence",r[0],r[1],false,false,v,v,"closed"],["Line-Error:"+E+":"+B],false,null,false,W)}else{var D=H();this.addToRender(["drawShape","path",D[0],D[1],false,false,v,v,"closed"],["Line-Error:"+E+":"+B],false,null,false,W)}}}else{j=N;ai=N+Y;if(C==null){C=j}for(var X=1;X0&&isNaN(y)){var v=this.addColorTransparency(ae,0.3);if(this.lineType=="spline"){this.addToRender(["drawShape","confidence",r[0],r[1],false,false,v,v,"closed"],["Line-Error:"+E+":"+B],false,null,false,W)}else{var D=H();this.addToRender(["drawShape","path",D[0],D[1],false,false,v,v,"closed"],["Line-Error:"+E+":"+B],false,null,false,W)}r=[[],[]];W=[]}j+=Y;ai+=Y}if(!isNaN(y)){if(this.lineDecoration&&O){this.addToRender(["drawShape",O,y,j,F,F,ae,af,P[S],false,false,Z],ag[S],aa,null,false,[K,C])}else{this.addToRender(["drawShape","sphere",y,j,F,F,this.addColorTransparency(ae,0),"rgba(0,0,0,0)",P[S],false,false,Z],ag[S],aa,null,false,[K,C])}if(ab[S]!=null&&!isNaN(ab[S])){x=(ab[S]/2)*this.isObject(M)?M[S].units:M;if(this.lineErrorType=="bar"){ad=this.addToRender(["drawLine","error",y,j,y+x,j,ae,G,"butt"],["Line:"+E+":"+B],false,I);if(!I){I=ad}this.addToRender(["drawLine","error",y,j,y-x,j,ae,G,"butt"],["Line:"+E+":"+B],false,I)}else{r[0].push([y+x,y-x]);r[1].push([j,j]);W.push([y,j])}}if(this.lineType=="spline"){J[0].push(y);J[1].push(j)}}if(this.lineType=="spline"){ad=this.addToRender(["drawLine","spline",J[0],J[1],false,false,ae,this.lineThickness,false,false,false,Z],["Line:"+E+":"+B],false,null,false,[K,C])}if(!I){I=ad}if(r[1].length>0){var v=this.addColorTransparency(ae,0.3);if(this.lineType=="spline"){this.addToRender(["drawShape","confidence",r[0],r[1],false,false,v,v,"closed"],["Line-Error:"+E+":"+B],false,null,false,W)}else{var D=H();this.addToRender(["drawShape","path",D[0],D[1],false,false,v,v,"closed"],["Line-Error:"+E+":"+B],false,null,false,W)}}}};this.drawStackedPlot=function(N,G,A,s,P,C,K,y,m,D,O,B,Q,F,H,L){this.functionCaller="drawStackedPlot";var h=A;var r=G;var j=this;var J=function(c,e,b,d,a){return j.processTreemap(c,{width:d,height:a,left:e,top:b})};if(D=="vertical"){A=h-m;for(var I=0;I0){var x=C?(N[I]*100/K[0])*y:N[I]*y;if(this.graphType=="Network"){this.addToRender(["drawShape","rectangle",G+(s/2),A-(x/2),s,x,O[I],O[I]],Q[I],F)}else{if(P){var E=J(P[I],G,A-x,s,x);this.drawTreemap(E,0,0)}else{this.addToRender(["drawShape","rectangle",G+(s/2),A-(x/2),s,x,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F,null,false,L)}}A-=x}}A=h-m;for(var I=N.length-1;I>=0;I--){if(N[I]<0){var x=C?(N[I]*100/-K[1])*y:N[I]*y;if(this.graphType=="Network"){this.addToRender(["drawShape","rectangle",G+(s/2),A-(x/2),s,-x,O[I],O[I]],Q[I],F)}else{if(P){var E=J(P[I],G,A-x,s,-x);this.drawTreemap(E,0,0)}else{this.addToRender(["drawShape","rectangle",G+(s/2),A-(x/2),s,-x,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F,null,false,L)}}A-=x}}}else{G=r+m;for(var I=0;I0){var x=C?(N[I]*100/K[0])*y:N[I]*y;if(H){if(this.graphType=="Network"){this.addToRender(["drawShape","rectangle",G+H-(x/2),A+(s/2),x,s,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F)}else{if(P){var E=J(P[I],G+H-x,A,x,s);this.drawTreemap(E,0,0)}else{this.addToRender(["drawShape","rectangle",G+H-(x/2),A+(s/2),x,s,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F,null,false,L)}}G-=x}else{if(this.graphType=="Network"){this.addToRender(["drawShape","rectangle",G+(x/2),A+(s/2),x,s,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F)}else{if(P){var M=J(P[I],G,A,x,s);this.drawTreemap(M,0,0)}else{this.addToRender(["drawShape","rectangle",G+(x/2),A+(s/2),x,s,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F,null,false,L)}}G+=x}}}G=r+m;for(var I=N.length-1;I>=0;I--){if(N[I]<0){var x=C?(N[I]*100/-K[1])*y:N[I]*y;if(H){if(this.graphType=="Network"){this.addToRender(["drawShape","rectangle",G+H-(x/2),A+(s/2),-x,s,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F)}else{if(P){var E=J(P[I],G+H-x,A,-x,s);this.drawTreemap(E,0,0)}else{this.addToRender(["drawShape","rectangle",G+H-(x/2),A+(s/2),-x,s,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F,null,false,L)}}G-=x}else{if(this.graphType=="Network"){this.addToRender(["drawShape","rectangle",G+(x/2),A+(s/2),-x,s,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F)}else{if(P){var M=J(P[I],G,A,-x,s);this.drawTreemap(M,0,0)}else{this.addToRender(["drawShape","rectangle",G+(x/2),A+(s/2),-x,s,O[I],this.objectBorderColor?this.objectBorderColor:this.foreground,B[I]],Q[I],F,null,false,L)}}G+=x}}}}};this.drawAreaPlot=function(ah,Z,S,Q,ad,T,af,V,J,D,m,X,ae,aj,W,al,ak,M,G){this.functionCaller="drawAreaPlot";var Y=ah.length-1;var aa=ae&&this.lineType=="rect"?"path":this.lineType=="rect"?"polygon":"spline";var A=[];var B=[];var U=[];var am=-D*J;var C=m*J;var L=function(b,a){for(var c=a+1;c0){return 1}else{if(ah[b][c]<0){return -1}}}return 0};if(X=="vertical"){for(var ac=0;ac=0&&Y>0&&af!="normal"){var E=U[U.length-1][1];P.shift();var F=[];var an=[];for(var ac=1;ac0||H>0){N.push(A[ab]-R);A[ab]-=R;H=1}else{if(ah[ac][ab]<0||H<0){N.push(B[ab]-R);B[ab]-=R;H=-1}else{var O=L(ac,ab);if(O<0){N.push(B[ab]-R);B[ab]-=R;H=-1}else{if(O>0){N.push(A[ab]-R);A[ab]-=R;H=1}else{N.push(am)}}}}}else{N.push(S-R)}}ag+=T}if(!ae){P.push(Z+Q);N.push(S-am)}U.push([P,N,aj[ac],W[ac],al[ac]])}}else{for(var ac=0;ac=0&&Y>0&&af!="normal"){N.shift();var F=[];var an=[];for(var ac=1;ac0||H>0){P.push(A[ab]+R);A[ab]+=R;H=1}else{if(ah[ac][ab]<0||H<0){P.push(B[ab]+R);B[ab]+=R;H=-1}else{var O=L(ac,ab);if(O<0){P.push(B[ab]+R);B[ab]+=R;H=-1}else{if(O>0){P.push(A[ab]+R);A[ab]+=R;H=1}else{N.push(am)}}}}}}else{P.push(M?Z+M-R:Z+R)}}ag+=T}if(!ae){P.push(M?Z+M:Z+am);N.push(S+ad)}U.push([P,N,aj[ac],W[ac],al[ac]])}}while(Y>=0){var ai,K;var ab=U.pop();if(ae){if(this.lineType=="spline"){this.addToRender(["drawLine",aa,ab[0],ab[1],false,false,ab[2],this.lineThickness],ab[4],ak,null,false,X=="vertical"?S-am:Z+am)}else{var K=null;for(var ac=1;ac=0&&Y>0&&af!="normal"){var E=X=="vertical"?U[U.length-1][1]:U[U.length-1][0];if(X=="vertical"){ab[0].shift();ab[0].pop();var F=[];var an=[];for(var ac=1;ac0){d=f}else{if(O.segregateSamplesBy.length>0){var a=O.data.w.smps[f];var c=O.meta.data.g.smps;for(var b=0;b1){this.drawViolin(B(ae),ab+(R/2),U,R/this.varIndices.length,T,aa,Z,ah[ae],"closed",ap[ae]);if(!this.showBoxplotIfViolin){H=true}}var W=ab+af;var S=[];var A=[];var I=this.showBoxplotOriginalData||this.showViolinBoxplot?ah[ae]:am[ae];for(var ad=0;ad<5;ad++){S.push(P(al[ae][ad]));A.push(S[S.length-1].toString())}if(!H){var J=(ab+V)+((R-this.variableSpaceFactor)/2);var ai=S[3]+((S[2]-S[3])/2);var ag=M;var an=S[2]-S[3];var k=this.boxplotNotched?P(al[ae][7][0]):false;var ac=this.boxplotNotched?P(al[ae][7][1]):false;var ak,G,x;if(this.boxplotNotched){if(this.showViolinBoxplot){G=[ab+(R-V-L)-e,ab+V+L,ab+V+L,ab+(R-V-L),ab+(R-V-L),ab+V+L+e,ab+(R-V-L)-e]}else{G=[ab+V+L+e,ab+V+L,ab+V+L,ab+(R-V-L),ab+(R-V-L),ab+(R-V-L)-e,ab+V+L+e]}x=[S[4],k,S[2],S[2],k,S[4],S[4]];ak=this.addToRender(["drawShape","polygon",G,x,false,false,am[ae],this.objectBorderColor?this.objectBorderColor:am[ae],Y[ae]],ap[ae],false,null,false,U);x=[S[4],ac,S[3],S[3],ac,S[4],S[4]];this.addToRender(["drawShape","polygon",G,x,false,false,am[ae],this.objectBorderColor?this.objectBorderColor:am[ae],Y[ae]],ap[ae],false,ak,false,U)}else{ak=this.addToRender(["drawShape","rectangle",J,ai,ag,an,am[ae],this.objectBorderColor?this.objectBorderColor:am[ae],Y[ae]],ap[ae],false,null,false,U)}if(this.unique(A).length!=1){if(this.boxplotNotched){this.addToRender(["drawLine","median",ab+V+L+e,S[4],ab+(R-V-L)-e,S[4],this.boxplotMedianColor,this.boxplotMedianWidth,"butt"],ap[ae],false,ak)}else{this.addToRender(["drawLine","median",ab+V+L,S[4],ab+(R-V-L),S[4],this.boxplotMedianColor,this.boxplotMedianWidth,"butt"],ap[ae],false,ak)}if(this.boxplotWishkersType=="single"){this.addToRender(["drawLine","line",W,S[2],W,S[0],ao,false,"butt"],ap[ae],false,ak);this.addToRender(["drawLine","line",W,S[3],W,S[1],ao,false,"butt"],ap[ae],false,ak)}else{this.addToRender(["drawLine","error",W,S[2],W,S[0],ao,-K,"butt"],ap[ae],false,ak);this.addToRender(["drawLine","error",W,S[3],W,S[1],ao,-K,"butt"],ap[ae],false,ak)}}if(this.boxplotMean){this.addToRender(["drawShape","rectangle",W,P(al[ae][6]),F,F,this.boxplotMeanColor,this.boxplotMeanColorBorder],ap[ae],false,ak,false,U)}if(al[ae][5]){for(var ad=0;ad1){this.drawViolin(B(ae),ab,U+(R/2),R/this.varIndices.length,T,aa,Z,ah[ae],"closed",ap[ae]);if(!this.showBoxplotIfViolin){H=true}}var W=U+af;var S=[];var A=[];var I=this.showBoxplotOriginalData||this.showViolinBoxplot?ah[ae]:am[ae];for(var ad=0;ad<5;ad++){S.push(P(al[ae][ad]));A.push(S[S.length-1].toString())}if(!H){var J=S[2]+((S[3]-S[2])/2);var ai=(U+V)+((R-this.variableSpaceFactor)/2);var ag=S[3]-S[2];var an=M;var k=this.boxplotNotched?P(al[ae][7][0]):false;var ac=this.boxplotNotched?P(al[ae][7][1]):false;var ak,G,x;if(this.boxplotNotched){G=[S[4],k,S[2],S[2],k,S[4],S[4]];if(this.showViolinBoxplot){x=[U+(R-V-L)-e,U+V+L,U+V+L,U+(R-V-L),U+(R-V-L),U+V+L+e,U+(R-V-L)-e]}else{x=[U+V+L+e,U+V+L,U+V+L,U+(R-V-L),U+(R-V-L),U+(R-V-L)-e,U+V+L+e]}ak=this.addToRender(["drawShape","polygon",G,x,false,false,am[ae],this.objectBorderColor?this.objectBorderColor:am[ae],Y[ae]],ap[ae],false,null,false,U);G=[S[4],ac,S[3],S[3],ac,S[4],S[4]];this.addToRender(["drawShape","polygon",G,x,false,false,am[ae],this.objectBorderColor?this.objectBorderColor:am[ae],Y[ae]],ap[ae],false,ak,false,U)}else{ak=this.addToRender(["drawShape","rectangle",J,ai,ag,an,am[ae],this.objectBorderColor?this.objectBorderColor:am[ae],Y[ae]],ap[ae],false,null,false,ab)}if(this.unique(A).length!=1){if(this.boxplotNotched){this.addToRender(["drawLine","median",S[4],U+V+L+e,S[4],U+(R-V-L)-e,this.boxplotMedianColor,this.boxplotMedianWidth,"butt"],ap[ae],false,ak)}else{this.addToRender(["drawLine","median",S[4],U+V+L,S[4],U+(R-V-L),this.boxplotMedianColor,this.boxplotMedianWidth,"butt"],ap[ae],false,ak)}if(this.boxplotWishkersType=="single"){this.addToRender(["drawLine","line",S[2],W,S[0],W,ao,false,"butt"],ap[ae],false,ak);this.addToRender(["drawLine","line",S[3],W,S[1],W,ao,false,"butt"],ap[ae],false,ak)}else{this.addToRender(["drawLine","error",S[2],W,S[0],W,ao,K,"butt"],ap[ae],false,ak);this.addToRender(["drawLine","error",S[3],W,S[1],W,ao,K,"butt"],ap[ae],false,ak)}}if(this.boxplotMean){this.addToRender(["drawShape","rectangle",P(al[ae][6]),W,F,F,this.boxplotMeanColor,this.boxplotMeanColorBorder],ap[ae],false,ak,false,ab)}if(al[ae][5]){for(var ad=0;ad1){var ak=this.addToRender(["drawLine","line",E[I][0][0],E[I][0][1],E[I][1][0],E[I][1][1],I,this.boxplotConnectWidth,"butt"],["Line:",N[I][0],N[I][1]],false);for(var ae=1;aeq[1]){var k=G+(n/2);var f=q[1]+((q[0]-q[1])/2);var B=this.addToRender(["drawShape","rectangle",k,f,n,q[0]-q[1],false,M,"open"],O[I]);this.addToRender(["drawLine","line",C,q[1],C,q[2],M,false,"butt"],false,false,B,false,A);this.addToRender(["drawLine","line",C,q[3],C,q[0],M,false,"butt"],false,false,B,false,A)}else{var k=G+(n/2);var f=q[0]+((q[1]-q[0])/2);var B=this.addToRender(["drawShape","rectangle",k,f,n,q[1]-q[0],M,M,"closed"],O[I]);this.addToRender(["drawLine","line",C,q[3],C,q[1],M,false,"butt"],false,false,B,false,A);this.addToRender(["drawLine","line",C,q[0],C,q[2],M,false,"butt"],false,false,B,false,A)}}else{this.addToRender(["drawShape","rectangle",G+(n/2),q[0]+((A-q[0])/2),n,A-q[0],M,M,"closed"],O[I])}G+=K}}else{for(var I=0;Iq[0]){var k=q[0]+((q[1]-q[0])/2);var f=A+(n/2);var B=this.addToRender(["drawShape","rectangle",k,f,q[1]-q[0],n,false,M,"open"],O[I]);this.addToRender(["drawLine","line",q[1],C,q[2],C,M,false,"butt"],false,false,B,false,G);this.addToRender(["drawLine","line",q[3],C,q[0],C,M,false,"butt"],false,false,B,false,G)}else{var k=q[1]+((q[0]-q[1])/2);var f=A+(n/2);var B=this.addToRender(["drawShape","rectangle",k,f,q[0]-q[1],n,M,M,"closed"],O[I]);this.addToRender(["drawLine","line",q[3],C,q[1],C,M,false,"butt"],false,false,B,false,G);this.addToRender(["drawLine","line",q[0],C,q[2],C,M,false,"butt"],false,false,B,false,G)}}else{this.addToRender(["drawShape","rectangle",G+((q[0]-G)/2),A+(n/2),q[0]-G,n,M,M,"closed"],O[I])}A+=K}}};this.drawViolin=function(j,C,n,G,k,B,z,H,w,s){this.functionCaller="drawViolin";var e=[];var E=[];var b=[];var A=[];var a=[[],[]];var D,d,g,f;switch(this.violinScale){case"area":D=G/j.density.maxY*j.density.maxY/j.scale*0.9;break;case"count":D=G/j.density.maxY*j.density.sumY/j.area*0.9;break;case"width":D=G/j.density.maxY*0.9;break}var r=this.addColorTransparency(H,0.25);if(this.violinTrim){d=[];for(var F=j.density.trim[0];F1&&E.length>1){this.addToRender(["drawShape","violin",[e,b],[E,A],false,false,r,this.foreground,w],s,false,null,false,a)}};this.drawDotPlot=function(ah,ag,Y,Q,ac,T,P,X,R,V,aj,Z,U,am,N,S,M,I,H){this.functionCaller="drawDotPlot";var L=this;var f=function(){var e=L.jitterColumns%2?L.jitterColumns+2:L.jitterColumns+3;var b=Math.max(ac-L.sizes[0],L.sizes[0])/(e-1);var a=[0];var c=1;for(var d=0;d0){var h=c.arr[j][0];c.arr[j].unshift(h-e);c.n[j]--}break;case"top":case"left":c.arr[j].push(0);c.n[j]--;while(c.n[j]>0){var h=c.arr[j][c.arr[j].length-1];c.arr[j].push(h+e);c.n[j]--}break;case"center":if(c.n[j]%2){c.arr[j].push(0);c.n[j]--}else{c.arr[j].push(-e/2);c.n[j]--;c.arr[j].push(e/2);c.n[j]--}while(c.n[j]>0){var h=c.arr[j][0];c.arr[j].unshift(h-e);c.n[j]--;h=c.arr[j][c.arr[j].length-1];c.arr[j].push(h+e);c.n[j]--}break}}return c.arr};var C=[];var E=f();var ak=this.getOutlineColor();if(V=="vertical"){for(var ab=0;ab1){for(var aa=1;aa1){for(var Z=0;Z0&&B=0.5){this.addToRender(["drawShape","rect",A+((j+s)/2),q+((C+s)/2),j+s,C+s,G,G,x?x[B]:false],I[B],D,null,false,[g,q+((C+s)/2),0,C+s]);n=0}}else{this.addToRender(["drawShape","rect",A+((j+s)/2),q+((C+s)/2),j+s,C+s,G,G,x?x[B]:false],I[B],D,null,false,[g,q+((C+s)/2),0,C+s])}}}if(this.showDataValues){this.addToRender(["drawText",this.approx(k),(A+j)-2,(q+C)-2,this.overlayFont,this.foreground,"right","bottom"])}A+=j;n+=j}};this.drawTreemap=function(B,u,p,C,D){this.functionCaller="drawTreemap";var f=this;var r=this.graphOrientation=="vertical"?this.top+this.y:this.left;var k=function(d,c){f.functionCaller="drawTreemap";if(c){f.addToRender(["drawShape","rectangle",(d.coords.left+u)+(d.coords.width/2),(d.coords.top+p)+(d.coords.height/2),d.coords.width,d.coords.height,false,f.objectBorderColor?f.objectBorderColor:false,"open",false,d.outline,C,D],false,false,null,false,r)}else{f.addToRender(["drawShape","rectangle",(d.coords.left+u)+(d.coords.width/2),(d.coords.top+p)+(d.coords.height/2),d.coords.width,d.coords.height,d.color,f.objectBorderColor?f.objectBorderColor:false,"closed",false,false,C,D],d.index,false,null,false,r)}if(d.label){var b=f.measureText(d.label,f.overlayFont);if(b+f.margin1){this.addToRender(["drawShape","rectangle",m+(n/2),j+((e+(E/2))/2),n,e+(E/2),g,g,"close",false,E,C,D]);this.addToRender(["drawShape","rectangle",m+(n/2),j+(A/2),n,A,false,g,"open",false,E,C,D])}else{if(a.coords.border>0){this.addToRender(["drawShape","rectangle",m+(n/2),(j+(e+E))+((A-(e+E))/2),n,A-(e+E),false,g,"open",false,E,C,D])}else{if(a.coords.border>-1){this.addToRender(["drawShape","rectangle",m+(n/2),(j+(e+E))+((A-(e+E))/2),n,A-(e+E),false,g,"open",false,E,C,D])}}}var z=this.measureText(a.title,this.smpLabelFont);if(z+this.margine+(E/2)){this.addToRender(["drawText",a.title,m+this.margin,j+(this.smpLabelFontSize/2),this.smpLabelFont,this.foreground,"left","middle"])}this.addToRender(["enableGradientTransparencyShadow"])}if(a.children){s(a.children)}else{k(a)}}};this.drawSankey=function(b){this.functionCaller="drawSankey";var f=b.links[0].target.x-b.links[0].source.x;for(var a=0;a360){this[a[b]]-=360}if(this[a[b]]<0){this[a[b]]=360}}};this.set3DParams=function(){var b=this.zoom;var a=this.x;this.perspective=a*this.perspectiveFactor;this.lenX=a/4*b*this.x3DRatio;this.lenY=a/4*b*this.y3DRatio;this.lenZ=a/4*b*this.z3DRatio;this.padX=a/2;this.padY=this.y/2;this.padZ=this.padY};this.get3DTransfrom=function(g,a,k){var f,e,b;var h=[];var n=this.meta.math.sin;var j=this.meta.math.cos;var d=this.perspective;var m=this.xRotate;var l=this.yRotate;var i=this.zRotate;e=a;b=k;a=e*j[parseInt(l)]-b*n[parseInt(l)];k=e*n[parseInt(l)]+b*j[parseInt(l)];f=g;b=k;g=b*n[parseInt(m)]+f*j[parseInt(m)];k=b*j[parseInt(m)]-f*n[parseInt(m)];f=g;e=a;g=f*j[parseInt(i)]-e*n[parseInt(i)];a=f*n[parseInt(i)]+e*j[parseInt(i)];if(this.perspective){g=g*(d/(k+d));a=a*(d/(k+d));k=k*(d/(k+d))}h.push(g+this.padX);h.push(a+this.padY);h.push(k+this.padZ);return h};this.setFunctionNames("init3dUtils")};CanvasXpress.prototype.initApiUtils=function(){this.getValidGraphTypes=function(){return this.validGraphTypes};this.setHeatmapScheme=function(){this.initializeAttributes()};this.hasIndicator=function(){if(this.graphType.match(/Scatter/)||this.graphType=="Bar"){return true}else{return false}};this.hasLegend=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Correlation"&&this.graphType!="Heatmap"){return true}else{return false}};this.hasLegendProperties=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Correlation"&&this.graphType!="Heatmap"&&this.graphType!="Pie"){return true}else{return false}};this.hasData=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Venn"){return true}else{return false}};this.hasDataSamples=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Venn"&&this.graphType!="Pie"&&!this.graphType.match(/Scatter/)){if(this.graphType=="Correlation"&&this.correlationAxis!="samples"){return false}return true}else{return false}};this.hasDataGroups=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Venn"&&this.graphType!="Pie"&&!this.graphType.match(/Scatter/)){if(this.graphType=="Correlation"&&this.correlationAxis!="samples"){return false}if(this.data.x){return true}else{return false}}else{return false}};this.hasDataVariables=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Venn"){if(this.graphType=="Correlation"&&this.correlationAxis!="variables"){return false}return true}else{return false}};this.hasDataProperties=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Heatmap"&&this.graphType!="Venn"&&this.graphType!="Pie"&&this.graphType!="Correlation"){return true}else{return false}};this.hasOrientation=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Venn"&&this.graphType!="Pie"&&this.graphType!="Correlation"&&this.graphType!="Circular"&&!this.graphType.match(/Scatter/)){return true}else{return false}};this.hasOverlays=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Venn"&&this.graphType!="Pie"&&this.graphType!="Correlation"&&!this.graphType.match(/Scatter/)){return true}else{return false}};this.hasDendrograms=function(){if(this.graphType!="Heatmap"&&(this.smpDendrogramNewick||this.varDendrogramNewick)){return true}else{return false}};this.hasDecorations=function(){return this.decorations&&(this.decorations.nlfit||this.decorations.line||this.decorations.reg||this.decorations.nor||this.decorations.area)?true:false};this.isSegregable=function(){if(this.graphType!="Network"&&this.graphType!="Genome"&&this.graphType!="Venn"&&this.graphType!="Pie"&&this.graphType!="Correlation"&&!this.graphType.match(/Scatter/)){return true}else{return false}};this.getLineTypes=function(){var e=["line"];var c=["","dashed","dotted","bezierY","bezierX","curved"];var a=["arrow","arrowHead","arrowTail","arrowHeadSquareTail","arrowTailSquareHead","square","squareHead","squareTail","squareHeadArrowTail","squareTailArrowHead"];for(var d=0;d1){b=f.shift();if(!c[b]){c[b]={}}c=c[b]}b=f.shift();c[b]=b=="showLegend"?!c[b]:isNaN(a)?a:Number(a);this.draw()};this.modifySmpOverlays=function(b,a){this.modifyObjectArray(b,a,"smpOverlays")};this.modifyVarOverlays=function(b,a){this.modifyObjectArray(b,a,"varOverlays")};this.getSmpOverlays=function(){return this.getObjectArray(this.smpOverlays)};this.getVarOverlays=function(){return this.getObjectArray(this.varOverlays)};this.getXData=function(){var b=[];if(this.data.x){for(var a in this.data.x){b.push(a)}}return b};this.getZData=function(){var b=[];if(this.data.z){for(var a in this.data.z){b.push(a)}}return b};this.getXZData=function(){return this.graphType.match(/Scatter/)?this.getZData():this.getXData()};this.getSamplesVariablesAsArray=function(){return this.graphType.match(/scatter/i)?this.getSamplesAsArray():this.getVariablesAsArray};this.getSamplesAsArray=function(){var d=this.getSamples();var b=[];for(var c=0;c-1){b={};b[n]={o:{},t:"numeric"};if(p){var d=this.meta.data.y.range[n];b[n]["o"]={min:d.min,max:d.max}}else{var f=[];if(j){for(var e=0;e0){for(var c=0;c0){this.getAdditionalData(d,b,this[g+"Properties"])}}this.isBooleanData(b[g]);for(var h in b[g]){if(b[g][h]["t"]=="numeric"){var f=[];for(var c in b[g][h]["o"]){f.push(c)}var a=this.range(f);b[g][h]["o"]={min:a[0],max:a[1]}}}}return b[g]};this.getFeatureData=function(a){if(!this.featuresData){var h={};var d=this.skipConfigurableProperties?this.getObjectArray(this.featureConfigurableProperties):{};for(var g=0;g0){this.getAdditionalData(b,h,this.featuresProperties)}}this.featuresData=h}return a?this.featuresData:this.getKeys(this.featuresData)};this.getAdditionalData=function(d,e,h){for(var f=0;f0){for(var c=0;c",">=","<","<=","==","null","not null"]};this.zoonIn=function(a){this.handleWheelEvent(a,1)};this.zoonOut=function(a){this.handleWheelEvent(a,-1)};this.clusterSamples=function(b,a){this.functionCaller="clusterSamples";if(this.isTransition()){return}this.clusterAxis="samples";if(b||!this.smpDendrogramNewick){this.smpDendrogramNewick=this.cluster()}if(!a){this.draw()}};this.clusterVariables=function(b,a){this.functionCaller="clusterVariables";if(this.isTransition()){return}this.clusterAxis="variables";if(b||!this.varDendrogramNewick){this.varDendrogramNewick=this.cluster()}if(!a){this.draw()}};this.kmeansSamples=function(e,d){this.functionCaller="kmeansSamples";if(this.isTransition()){return}this.clusterAxis="samples";if(!this.data.x){this.data.x={}}if(e||!this.data.x["k-Means-S"]){var a=this.kmeans();this.data.x["k-Means-S"]=[];for(var b=0;be?e:this.legendColumns;var a=Math.ceil(e/v);var b=Math.max(y,(g+u+(this.margin*2))*v);var x=b+(this.margin*(v+2));var o=j.title?(a*(Math.max(u,p)+this.margin))+p+(this.margin*2):(a*(Math.max(u,p)+this.margin))+(this.margin*1);this["legend"+j.id+"Width"]=x;this["legend"+j.id+"Height"]=o};this.setPropertyLegendDimensions=function(c,n,b){var a=this.decapitalize(c)+"By";if(this[a]&&(this[a+"ShowLegend"]||this.graphType=="Network")){var r,g,o;if(n){r=this[a];g=n;o=b&&b.sizes?b.sizes:this.sizes}else{if(this.data.x&&this.data.x.hasOwnProperty(this[a])){r=this[a];g=this.meta.data.x[this[a]].maxLevStr;o=this.meta.data.x[this[a]].sizes||this.sizes}else{if(this.data.z&&this.data.z.hasOwnProperty(this[a])){r=this[a];g=this.meta.data.z[this[a]].maxLevStr;o=this.meta.data.z[this[a]].sizes||this.sizes}else{if(a.match("Node")){r=this[a];g=this.meta.data.nodes[this[a]].maxLevStr;o=this.meta.data.nodes[this[a]].sizes||this.sizes}else{if(a.match("Edge")){r=this[a];g=this.meta.data.edges[this[a]].maxLevStr;o=this.meta.data.edges[this[a]].sizes||this.sizes}else{r=0;g=0;o=this.sizes}}}}}var k=this.getDiameterLegend();if(c=="Size"||c=="SizeNode"||c=="SizeEdge"){for(var h=0;hthis["legend"+(c=="Outline"?"Color":c)+"sN"]?this["legend"+(c=="Outline"?"Color":c)+"sN"]:this.legendColumns;var e=Math.ceil(this["legend"+(c=="Outline"?"Color":c)+"sN"]/t);var q=this.measureText(r,this.legendFont);var s=(this.measureText(g,this.legendFont)+k+(this.margin*2))*t;this["legend"+(c=="Outline"?"Color":c)+"Width"]=Math.max(q,s)+(this.margin*(t+2));this["legend"+(c=="Outline"?"Color":c)+"Height"]=(e*(Math.max(k,j)+this.margin))+j+(this.margin*3)}};this.setPropertyLegendIndicatorDimensions=function(e,b){var j=this.decapitalize(e)+"By";var d=0;var g=0;var i=this.getFontPt(this.legendFont);if(this[j]){switch(e){case"Color":case"ColorNode":case"ColorEdge":case"Outline":var a=this.measureText(this.colorBy||this.outlineBy||this.colorNodeBy||this.colorEdgeBy,this.legendFont);var c=b.maxLevLen;if(this.legendPosition.match(/top|bottom/)){g=this.heatmapIndicatorHeight+(this.margin*4)+(i*2);g+=i+this.margin;d=this.heatmapIndicatorWidth+Math.max(a,c)}else{g=this.heatmapIndicatorWidth+(this.margin*3)+(i*2);d=this.heatmapIndicatorHeight+(this.margin*4)+Math.max(a,c)}break;case"Shape":case"ShapeNode":case"ShapeEdge":case"Size":case"SizeNode":case"SizeEdge":this.setPropertyLegendDimensions(e,b.maxLevStr,b);return;case"Pattern":case"PatternNode":case"PatternEdge":d=0;g=0;break}}this["legend"+(e=="Outline"?"Color":e)+"Width"]=d;this["legend"+(e=="Outline"?"Color":e)+"Height"]=g};this.setDecorationsLegendDimensions=function(){this.legendDecorationWidth=0;this.legendDecorationHeight=0;this.legendDecorationMaxLabel=0;if(this.showDecorations&&this.showDecorationsLegend&&this.decorations){if(!this.legendInside){if(this.decorationsPosition!="right"&&this.decorationsPosition!="bottom"&&this.graphType!="Network"){this.decorationsPosition="bottom"}}var f=this.getFontPt(this.decorationFont);var h=this.decorations;var b=0;if(h.nlfit){var g=this.measureText(sprintf("%96s","X"),this.decorationFont)+(this.margin*5);var a=0;for(var e=0;e0){b=Math.max(b,this.margin+a+this.margin);this.legendDecorationHeight+=(h.line.length*f*2)+this.margin}}if(h.reg){var g=this.measureText(sprintf("%45s","X"),this.decorationFont)+(this.margin*2);var a=0;for(var e=0;e1){if(this.xAxisIndices.length==this.yAxisIndices.length&&this.xAxisIndices.length>1){for(var c=0;cthis.yAxisIndices.length){b=this.measureText(this.shortenText(this.getMaxText(this.xAxis),this.maxSmpStringLen)+" vs "+this.shortenText(this.yAxis[0],this.maxSmpStringLen),this.legendFont)}else{if(this.yAxisIndices.length>this.xAxisIndices.length){if(this.isHistogram){b=this.measureText(this.shortenText(this.getMaxText(this.yAxis),this.maxSmpStringLen),this.legendFont)}else{b=this.measureText(this.shortenText(this.getMaxText(this.yAxis),this.maxSmpStringLen)+" vs "+this.shortenText(this.xAxis[0],this.maxSmpStringLen),this.legendFont)}}}}this.legendSampleWidth=(d-1)+b+(this.margin*3);this.legendSampleHeight=(Math.max(this.xAxisIndices.length,this.yAxisIndices.length)*(d+this.margin))+this.margin}else{if(this.isHistogram){b=this.measureText(this.shortenText(this.getMaxText(this.yAxis),this.maxSmpStringLen),this.legendFont);this.legendSampleWidth=(d-1)+b+(this.margin*3);this.legendSampleHeight=(Math.max(this.xAxisIndices.length,this.yAxisIndices.length)*(d+this.margin))+this.margin}}}};this.setVariableLegendDimension=function(){this.legendVariableWidth=0;this.legendVariableHeight=0;var a=this.isDOE&&this.layoutCurrentDOE?this.meta.data.x[this.layoutCurrentDOE]:this.meta.data.y;var f=this.getFontPt(this.legendFont);if(this.graphType=="Pie"){var g=this.varIndices.length>this.maxPieSectors?this.maxPieSectors:this.varIndices.length;var d=this.isDOE&&this.layoutCurrentDOE?this.shortenText(a.maxLevStr,this.maxVarStringLen):this.shortenText(a.maxVarStr,this.maxVarStringLen);if(this.maxPieSectorsthis.width/2){this.legendFont=this.scaleTextToFont(b,f,this.width/2)}this.legendVariableWidth=this.measureText(d,this.legendFont)+f+(this.margin*3);this.legendVariableHeight=((f+this.margin)*g)+this.margin}else{if(this.layoutValid&&this.segregateVariablesBy.length>0&&!this.graphType.match(/Scatter/)){if(this.segregateVariablesBy[0]=="variable"||(this.segregateVariablesBy.length>1&&this.segregateVariablesBy[1]=="variable")){return}else{if(!this.colorBy||(this.colorBy&&this.colorBy=="variable")){var c=a.maxVarChr>this.maxVarStringLen?a.maxVarStr.substring(0,this.maxVarStringLen):a.maxVarStr;this.legendVariableWidth=((this.margin*3)+(f*2)+this.measureText(c,this.legendFont))*this.legendColumns;this.legendVariableHeight=(Math.ceil(this.data.y.vars.length/this.legendColumns)*f*1.5)+this.margin}else{return}}}else{if((this.colorBy&&this.colorBy=="variable")||(this.shapeBy&&this.shapeBy=="variable")||(this.sizeBy&&this.sizeBy=="variable")||(this.patternBy&&this.patternBy=="variable")){var c=this.sizeBy&&this.sizeBy=="variable"?Math.max(this.sizes[this.varIndices.length-1],this.getFontPt(this.legendFont)):this.getFontPt(this.legendFont);var d=this.shortenText(a.maxVarStr,this.maxVarStringLen);this.legendVariableWidth=((c-1)+this.measureText(d,this.legendFont)+(this.margin*3))*this.legendColumns;this.legendVariableHeight=(Math.ceil(this.varIndices.length/this.legendColumns)*(c+this.margin))+this.margin}else{if(this.graphType=="BarLine"||this.graphType=="DotLine"||this.graphType=="AreaLine"||this.graphType=="StackedLine"||this.graphType=="StackedPercentLine"){var c=a.maxVarChr>this.maxVarStringLen?a.maxVarStr.substring(0,this.maxVarStringLen):a.maxVarStr;this.legendVariableWidth=((this.margin*3)+(f*2)+this.measureText(c,this.legendFont))*this.legendColumns;this.legendVariableHeight=(Math.ceil((this.xAxisVarIndices.length+this.xAxis2VarIndices.length)/this.legendColumns)*f*1.5)+this.margin}else{if(!this.colorBy&&(this.graphType=="Bar"||this.graphType=="Line"||this.graphType=="Area"||this.graphType=="Dotplot"||this.graphType=="Stacked"||this.graphType=="StackedPercent"||this.graphType=="Boxplot")){var c=a.maxVarChr>this.maxVarStringLen?a.maxVarStr.substring(0,this.maxVarStringLen):a.maxVarStr;this.legendVariableWidth=((this.margin*3)+(f*2)+this.measureText(c,this.legendFont))*this.legendColumns;this.legendVariableHeight=(Math.ceil(this.varIndices.length/this.legendColumns)*f*1.5)+this.margin}else{if(this.graphType=="Circular"&&!this.showIdeogram){var c=a.maxVarChr>this.maxVarStringLen?a.maxVarStr.substring(0,this.maxVarStringLen):a.maxVarStr;var e=this.rAxisIndex>=0?this.varIndices.length-1:this.varIndices.length;this.legendVariableWidth=((this.margin*3)+(f*2)+this.measureText(c,this.legendFont))*this.legendColumns;this.legendVariableHeight=(Math.ceil(e/this.legendColumns)*f*1.5)+this.margin}}}}}}};this.setVennLegendDimension=function(){var a=this.data.venn.legend?this.getMaxText(this.data.venn.legend):"N/A";this.legendWidth=this.measureText(a,this.legendFont)+(this.margin*6);this.legendHeight=this.margin+this.margin+((this.getFontPt(this.legendFont)+this.margin)*this.vennGroups)};this.setOverlaysLegendDimensions=function(){var b=this.getFontPt(this.legendFont);var s=this.getDiameterLegend();var k=Math.max(b,s);var d=["varOverlays","smpOverlays"];var e=["varOverlayProperties","smpOverlayProperties"];var y=["showVarOverlaysLegend","showSmpOverlaysLegend"];this.legendOverlaysLayout=[];this.legendOverlaysWidth=0;this.legendOverlaysHeight=0;var q=this.margin;var n=this.margin;var a=0;var g=0;var l=0;var B=false;if(this.showOverlays&&(this.showVarOverlaysLegend||this.showSmpOverlaysLegend)){for(var v=0;v0&&this[y[v]]){for(var t=0;t(this.height-(this.top+this.bottom))){q+=this.margin+f;a=f;g=x;if(this.legendOverlaysLayout[l]){l++}this.legendOverlaysLayout[l]=[[A,p,f,x]]}else{if(f>a){q+=(f-a);a=f}g+=x;if(!this.legendOverlaysLayout[l]){this.legendOverlaysLayout[l]=[]}this.legendOverlaysLayout[l].push([A,p,f,x])}}else{if(a+this.margin+f>(this.width-(this.left+this.right))){n+=this.margin+x;a=f;g=x;if(this.legendOverlaysLayout[l]){l++}this.legendOverlaysLayout[l]=[[A,p,f,x]]}else{if(x>g){n+=(x-g);g=x}a+=f;if(!this.legendOverlaysLayout[l]){this.legendOverlaysLayout[l]=[]}this.legendOverlaysLayout[l].push([A,p,f,x])}}}}}}}}if(this.overlaysLegendPosition.match(/right/i)){this.legendOverlaysWidth=B?q+this.margin:0;this.legendOverlaysHeight=B?g+this.margin:0}else{this.legendOverlaysWidth=B?a+this.margin:0;this.legendOverlaysHeight=B?n+this.margin:0}};this.setLegendDimensions=function(){if(this.showDecorations&&this.showDecorationsLegend&&this.decorations){this.decorationLayout=[0]}if(this.showLegend){this.legendLayout=[];this.legendWidth=0;this.legendHeight=0;var a=this.margin;var k=this.margin;var b=0;var j=0;var g=0;var e=this.graphType=="Network"?["ColorNode","ShapeNode","SizeNode","PatternNode","ColorEdge","SizeEdge"]:this.scatterPlotMatrix?["Color","Shape","Size","Pattern","Variable"]:["Color","Shape","Size","Pattern","Variable","Sample"];for(var c=0;c0){if(this.legendPosition.match(/right|left/i)){if(j+this.margin+d>this.height){a+=this.margin+f;b=f;j=d;this.legendLayout[g]=[e[c]];g++}else{if(f>b){a+=(f-b);b=f}j+=d;if(!this.legendLayout[g]){this.legendLayout[g]=[]}this.legendLayout[g].push(e[c])}}else{if(b+this.margin+f>this.width){k+=this.margin+d;b=f;j=d;this.legendLayout[c]=[e[c]];g++}else{if(d>j){k+=(d-j);j=d}b+=f;if(!this.legendLayout[g]){this.legendLayout[g]=[]}this.legendLayout[g].push(e[c])}}}}for(var c=0;cthis.height){a+=this.margin+f;b=f;j=d;this.legendLayout[g]=[this.legend[c].id];g++}else{if(f>b){a+=(f-b);b=f}j+=d;if(!this.legendLayout[g]){this.legendLayout[g]=[]}this.legendLayout[g].push(this.legend[c].id)}}else{if(b+this.margin+f>this.width){k+=this.margin+d;b=f;j=d;this.legendLayout[c]=[this.legend[c].id];g++}else{if(d>j){k+=(d-j);j=d}b+=f;if(!this.legendLayout[g]){this.legendLayout[g]=[]}this.legendLayout[g].push(this.legend[c].id)}}}this.legendWidth=b==0&&a==this.margin?0:this.legendPosition.match(/right|left/i)?a+this.margin:b+this.margin;this.legendHeight=j==0&&k==this.margin?0:this.legendPosition.match(/right|left/i)?j+this.margin:k+this.margin}};this.setLegends=function(){var h=this;var g=this.graphType=="Network"?["ColorNode","ShapeNode","SizeNode","PatternNode","ColorEdge","SizeEdge"]:["Color","Shape","Size","Pattern","Outline"];var q=["shapeByData","sizeByData","patternByData","outlineByData"];var n=function(a,o,t,v){var u=o=="Outline"?"Color":o;var s=(h.decapitalize(u)+"s").replace("Node","").replace("Edge","");delete (h["legend"+u+"sS"]);h["legend"+u+"Meta"]=a;if(t){h["legend"+u+"Meta"].vals=h.rPretty(t[0],t[1],5);h["legend"+u+"Meta"].decs=h.getAxisDecimals(t[1]-t[0]);h["legend"+u+"Meta"].maxLevStr=h.getMaxText(h["legend"+(o=="Outline"?"Color":o)+"Meta"].vals);h["legend"+u+"Meta"].maxLevLen=h.measureText(h["legend"+u+"Meta"].maxLevStr,h.font);h["legend"+u+"Meta"].maxLevChr=h["legend"+u+"Meta"].maxLevStr.toString().length}h["legend"+u+"sMax"]=h["legend"+u+"Meta"].maxLevStr;h["legend"+u+"sN"]=h["legend"+u+"Meta"].vals.length;for(var p=0;pE){E=G;h["legend"+C+"sMax"]=v}B[v]=(A.type=="Numeric"?A.orderS[v]:A.order[v])%a.length;h["legend"+C+"s"][v]=a[B[v]];u++}h["legend"+C+"sS"]=r;z=H=="m"||H=="modified"?h["legend"+C+"sMax"]:false;h["legend"+C+"sN"]=u;h["legend"+C+"Meta"]=A;h.setPropertyLegendDimensions(C,z,A)};this.validateLegendPositions();this.setLegendFont();if(this.graphType=="Venn"){this.setVennLegendDimension();return}else{if(this.graphType=="Network"){for(var f=0;f-1&&this.meta.data.y.range[this[b]]){var d=this.meta.data;if(d.modified&&d.modified.z&&d.modified.z[this[b]]){d=d.modified.z;if(!d.meta){d.meta={}}d.meta[this[b]]={levels:d[this[b]]};j(d.meta[this[b]],"modified",b,e)}else{d=d.y.range[this[b]];n(d,e,[d.min,d.max])}}else{if(this[b]=="variable"){h["legend"+e+"sN"]=this.varIndices.length}}}}}}}}}this.setDecorationsLegendDimensions();this.setSampleLegendDimension();this.setVariableLegendDimension();this.setOncoprintLegendDimension();this.setOverlaysLegendDimensions();this.setLegendDimensions()};this.addLegend=function(c,b){if(c){if(b){var a=this.findXYCoordinates(b);c.x=a.x;c.y=a.y}this.legend.push(c)}};this.deleteLegend=function(c){if(c&&c.id){var b=[];for(var a=0;a0){if(aa>0){var av=E[aa-1];var ay=this.getDataAtPos(av,V);if(ay>0){var P=(O-ay)/this.functionIntervals;for(var Z=0;Z0){this.addToRender(["drawShape","path",aw,au,false,false,L,L,"open",false,false,true],["Decor-Non-Lin-"+aa+"-"+ab]);if(af.nlfit[ab].type=="reg"){N=a+((aI-a)/(1+aH/(Math.pow(aH,aF))))}else{N=a+((aI-a)/(1+(Math.pow((aH/aH),aF))))}if(this.xAxisTransform){aH=this.xAxisTransform=="percentile"?this.percentile(f,M,aH):this.transformValue(this.xAxisTransform,aH)}H=Y+((aH-this.xAxisMin)*this.xAxisUnit);g=(U+this.y)-((N-this.yAxisMin)*this.yAxisUnit);var ar=this.addToRender(["drawLine","dottedLine",Y,g,H,g,L],["Decor-Non-Lin-EC-h"+aa+"-"+ab]);this.addToRender(["drawLine","dottedLine",H,g,H,(U+this.y),L],["Decor-Non-Lin-EC-v"+aa+"-"+ab],false,ar)}}}if(af.line){for(var ab=0;ab=this.marginTop+this.offsetY+this.top?true:false}else{H=this.marginLeft+this.offsetX+this.left+((S-this.xAxisMin)*this.xAxisUnit);F=H;g=this.marginTop+this.offsetY+this.top;e=g+this.y;ak=H<=this.marginLeft+this.offsetX+this.left+this.x&&this.marginLeft+this.offsetX+this.left?true:false}if(ak){if(n){if(this.graphOrientation=="vertical"){if(az=="right"){this.addToRender(["drawText",n,F-this.margin,e-this.margin,this.decorationFont,this.decorationColor,"right","bottom"])}else{if(az=="center"){this.addToRender(["drawText",n,H+(this.x/2),e-this.margin,this.decorationFont,this.decorationColor,"center","bottom"])}else{this.addToRender(["drawText",n,H+this.margin,e-this.margin,this.decorationFont,this.decorationColor,"left","bottom"])}}}else{if(az=="right"){this.addToRender(["drawText",n,F+(this.margin*2),e-this.margin,this.decorationFont,this.decorationColor,"left","middle"])}else{if(az=="center"){this.addToRender(["drawText",n,F+(this.margin*2),g+(this.y/2),this.decorationFont,this.decorationColor,"left","middle"])}else{this.addToRender(["drawText",n,F+(this.margin*2),g+this.margin,this.decorationFont,this.decorationColor,"left","middle"])}}}}this.addToRender(["drawLine",ah,H,g,F,e,z,ap],["Decor-Line"+ab])}}}if(af.marker){this.drawMarkers()}}}};this.drawOncoprintLegend=function(){this.functionCaller="drawOncoprintLegend";if(this.isOncoprint){var a=this.marginLeft+this.offsetX+this.left+15;var g=this.marginTop+this.offsetY+this.top+this.y+this.bottom+this.margin-30;var d=this.measureText("Amplification",this.legendFont);var i=this.measureText("Deletion",this.legendFont);var f=this.measureText("Mutation",this.legendFont);if(this.legendOncoprintX&&this.legendOncoprintY){a=this.legendOncoprintX;g=this.legendOncoprintY}else{if(this.showLegend){if(!this.legendInside&&this.legendPosition=="bottom"){g-=this.legendHeight}}}this.legendOncoprintCurX=a;this.legendOncoprintCurY=g;var h=this.legendOncoprintCurX-10;var e=g-20;var c=100+d+i+f+(this.margin*2);var b=30+(this.margin*2);this.addToRender(["drawShape","rect",h+(c/2),e+(b/2),c,b,this.background,this.background],[-1],["-legend-oncoprint"]);this.addToRender(["drawShape","rect",a,g,10,30,"rgb(255,0,0)"],["Onc-Amplification"]);a=a+10+this.margin;this.addToRender(["drawText","Amplification",a,g,this.legendFont,this.legendColor,"left","middle"]);a=a+d+25;this.addToRender(["drawShape","rect",a,g,10,30,"rgb(0,0,255)"],["Onc-Deletion"]);a=a+10+this.margin;this.addToRender(["drawText","Deletion",a,g,this.legendFont,this.legendColor,"left","middle"]);a=a+i+25;this.addToRender(["drawShape","rect",a,g,10,30,"rgb(220,220,220)"],["Onc-Mutation"]);this.addToRender(["drawShape","rect",a,g,10,10,"rgb(0,153,0)"]);a=a+10+this.margin;this.addToRender(["drawText","Mutation",a,g,this.legendFont,this.legendColor,"left","middle"])}};this.drawStockIndicatorsLegend=function(){this.functionCaller="drawStockIndicatorsLegend";var d=this.marginLeft+this.offsetX+this.left;var n=this.marginTop+this.offsetY+this.top;if(this.summaryType=="candle"&&this.stockIndicators.length>0){var a=this.getFontPt(this.legendFont);var f=a/2;var b=this.measureText(this.getMaxText(this.stockIndicators),this.legendFont)+a+(this.margin*2);var k=this.graphOrientation=="vertical"?d+(this.margin*2):d+this.x-b;var j=n+this.margin+a;for(var e=0;ethis.yAxisIndices.length?this.yAxis[this.yAxisCurrent]:this.yAxis[f];var k=this.xAxisIndices.length==this.yAxisIndices.length?this.xAxis[f]:this.xAxisIndices.length>this.yAxisIndices.length?this.xAxis[f]:this.xAxis[this.xAxisCurrent];var g=this.xAxisIndices.length==this.yAxisIndices.length?"Series:"+this.xAxisIndices[f]+":"+this.yAxisIndices[f]:this.xAxisIndices.length>this.yAxisIndices.length?"Series:"+this.xAxisIndices[f]+":0":"Series:0:"+this.yAxisIndices[f];var n=this.isHistogram?this.shortenText(h,this.maxSmpStringLen):this.shortenText(h,this.maxSmpStringLen)+" vs "+this.shortenText(k,this.maxSmpStringLen);var e=b+q+this.margin;var a=m+q+this.margin;if(this.colorBy){this.addToRender(["drawShape",this.shapes[p],e,m,r-1,r-1,this.background,this.colors[c],"open"],[g])}else{this.addToRender(["drawShape",this.shapes[p],e,m,r-1,r-1,this.colors[c],this.foreground,j],[g])}this.addToRender(["drawText",n,e+q+this.margin,m,this.legendFont,this.legendColor,"left","middle"],[g]);m+=r+this.margin}this.drawLegendBackgroundBox(l,d,this.legendSampleWidth,this.legendSampleHeight)};this.drawVariableLegend=function(B,c){this.functionCaller="drawVariableLegend";var o=B;var D=c;var n=this.getFontPt(this.legendFont);var t=n/2;var a=n*2;var d=n*1.5;var u=0;if(this.legendVariableWidth==0||this.legendVariableHeight==0){return}else{if(this.graphType=="Circular"&&this.circularType=="sunburst"){return}else{if(this.graphType=="Pie"){this.drawLegendBackgroundBox(o,D,this.legendVariableWidth,this.legendVariableHeight,true,"-legend-variable");var A=!this.layoutComb?this.width-(B+(this.margin*1.5)):this.isDOE?this.layoutWidth-((B-this.offsetX)+(this.margin*1.5)):999999;B+=t+this.margin;c+=n;for(var x=0;x-1?this.shortenText(this.data.y.vars[m],this.maxVarStringLen):"Other";this.addToRender(["drawShape","square",B,c,n,n,g,this.foreground,"closed"],["PieVar-"+m]);if(A>0){while(this.measureText(q,this.legendFont)>A&&q.length>1){q=q.substring(0,q.length-1);f=true}if(f){q=q+"..."}this.addToRender(["drawText",q,B+n,c,this.legendFont,this.legendColor,"left","middle"],["PieVar-"+m])}c+=n+this.margin;if(this.layoutComb){if((c-this.offsetY)>this.layoutHeight){this.addToRender(["drawText","...",B+n,c,this.legendFont,this.legendColor,"left","bottom"]);break}}else{if(c>this.height){this.addToRender(["drawText","...",B+n,c,this.legendFont,this.legendColor,"left","bottom"]);break}}}this.drawLegendBackgroundBox(o,D,this.legendVariableWidth,this.legendVariableHeight)}else{if((this.colorBy&&this.colorBy=="variable")||(this.shapeBy&&this.shapeBy=="variable")||(this.sizeBy&&this.sizeBy=="variable")||(this.patternBy&&this.patternBy=="variable")){this.drawLegendBackgroundBox(o,D,this.legendVariableWidth,this.legendVariableHeight,true,"-legend-variable");var w=this.sizeBy&&this.sizeBy=="variable"?Math.max(this.sizes[this.varIndices.length-1],n):n;var C=w/2;var z=this.legendVariableWidth/this.legendColumns;var b=Math.ceil(this.varIndices.length/this.legendColumns);c+=this.margin+this.margin;for(var x=0;xr||this.legendVariableHeight>r){return}this.drawLegendBackgroundBox(o,D,this.legendVariableWidth,this.legendVariableHeight,true,"-legend-variable");var e=[];if(this.rAxisIndex>=0){for(var x=0;x0&&this.validateColor(this.vennColors[0])?this.validateColor(this.vennColors[0]):"rgb(255,0,0)");h.push(this.vennColors.length>1&&this.validateColor(this.vennColors[1])?this.validateColor(this.vennColors[1]):"rgb(0,153,51)");h.push(this.vennColors.length>2&&this.validateColor(this.vennColors[2])?this.validateColor(this.vennColors[3]):"rgb(153,204,0)");h.push(this.vennColors.length>3&&this.validateColor(this.vennColors[3])?this.validateColor(this.vennColors[2]):"rgb(0,0,255)")}else{if(this.vennGroups==3){h.push(this.vennColors.length>0&&this.validateColor(this.vennColors[0])?this.validateColor(this.vennColors[0]):"rgb(255,0,0)");h.push(this.vennColors.length>1&&this.validateColor(this.vennColors[1])?this.validateColor(this.vennColors[1]):"rgb(0,255,0)");h.push(this.vennColors.length>2&&this.validateColor(this.vennColors[2])?this.validateColor(this.vennColors[2]):"rgb(0,0,255)")}else{if(this.vennGroups==2){h.push(this.vennColors.length>0&&this.validateColor(this.vennColors[0])?this.validateColor(this.vennColors[0]):"rgb(0,0,255)");h.push(this.vennColors.length>1&&this.validateColor(this.vennColors[1])?this.validateColor(this.vennColors[1]):"rgb(255,0,0)")}else{h.push(this.vennColors.length>0&&this.validateColor(this.vennColors[0])?this.validateColor(this.vennColors[0]):"rgb(255,0,0)")}}}for(var f=0;fthis.x)?this.scaleTextToFont(b,j,this.x-this.margin):this.legendFont;if(!this.vennLegendColors){this.addToRender(["drawText",b,c,g,e,this.legendColor,"left","middle"])}else{this.addToRender(["drawText",b,d,g,e,h[f],"left","middle"])}g+=this.margin+j}}};this.drawColorIndicator=function(B,f,o,H,E,g){this.functionCaller="drawColorIndicator";if(g||E||this.colorBy||this.outlineBy||this.colorNodeBy||this.colorEdgeBy||this.colorNodeBy||this.colorEdgeBy){var r=H||this.colorBy||this.outlineBy||this.colorNodeBy||this.colorEdgeBy;var m=g?"-legend-"+g+"-color":E?"-legend-indicator-color":"-legend-color";var h=g?"overlaysLegendPosition":E?"heatmapIndicatorPosition":"legendPosition";var G=g?g:E?0:this.legendColorWidth?this.legendColorWidth/2:10;var s=B;var F=f;var b=0;var A=this.heatmapIndicatorHeight;var e=this.heatmapIndicatorHeight;var u=o.min;var y=o.max;var a=o.decs;var q=o.vals;var p=this.heatmapIndicatorWidth/(y-u);var D=this.graphType=="Circular"?o:o.colorBrew?o.colorBrew:this.meta.def.colorBrew;var l=this.heatmapIndicatorWidth/this.colorSpectrumNumber;var t=h=="overlaysLegendPosition"&&this[h]=="topRight"?true:false;var d=this.heatmapIndicatorHeight+(this.getFontPt(this.legendFont)*((r)?2:1))+(this.margin*2);if(this[h]&&this[h].toString().match(/top|bottom/)&&!t){this.drawLegendBackgroundBox(s-(this.margin*2),F-this.margin,this.heatmapIndicatorWidth+(this.margin*3)+this.legendFontSize,d,true,"-legend-indicator-color",false,true);if(r){this.addToRender(["drawText",r,B+(this.heatmapIndicatorWidth/2),f,this.legendFont,this.legendColor,"center","top"]);b=this.margin+this.getFontPt(this.legendFont);f+=b}for(var x=0;x0?this.getColorForValue(D,D.breaks[x]):D.legend[x];var C=this.transparency!=null?this.addColorTransparency(n,this.transparency):n;this.addToRender(["drawLine","line",B,f,B,f+e,C,Math.round(l+1.5)]);B+=l}B=s;f+=e;if(D.stops&&D.stops.length>0){var z=B+(this.measureText(D.breaks[0].toString(),this.legendFont)/2);this.addToRender(["drawText",D.breaks[0],B,f,this.legendFont,this.legendColor,"center","top"]);for(var x=0;x=D.stops[x]){B=s+(w*l);var k=(this.measureText(D.breaks[x].toString(),this.legendFont)/2);if(B-k>z){this.addToRender(["drawText",D.stops[x],B,f,this.legendFont,this.legendColor,"center","top"]);z=B+k}break}}}B=s+(this.colorSpectrumNumber*l);this.addToRender(["drawText",D.stops[D.stops.length-1],B,f,this.legendFont,this.legendColor,"center","top"])}else{this.addToRender(["drawText",u,B,f,this.legendFont,this.legendColor,"center","top"]);B=s+(this.heatmapIndicatorWidth/2);this.addToRender(["drawText",(u+y)/2,B,f,this.legendFont,this.legendColor,"center","top"]);B=s+((this.colorSpectrumNumber-1)*l);this.addToRender(["drawText",y,B,f,this.legendFont,this.legendColor,"center","top"])}if(this.graphType=="Heatmap"&&this.heatmapIndicatorHistogram){this.drawHeatmapIndicatorHistogram(s,F+b)}}else{this.drawLegendBackgroundBox(s,F,this.legendColorWidth,this.heatmapIndicatorWidth+(this.margin*3)+this.legendFontSize,true,m,false,true);if(r){this.addToRender(["drawText",r,B+G+this.margin,f,this.legendFont,this.legendColor,"center","top"]);f+=(this.margin*1.5)+this.getFontPt(this.legendFont)}for(var x=0;x=u&&q[x]<=y){var e=f+((q[x]-u)*p);this.addToRender(["drawText",q[x],B+this.margin,e,this.legendFont,this.legendColor,"left","middle"])}}}}};this.drawHeatmapIndicatorHistogram=function(x,b){this.functionCaller="drawHeatmapIndicatorHistogram";var w,a;var o=x;var z=b+this.heatmapIndicatorHeight;var y=[];for(var u=0;u-1))}}else{if(this.graphType=="Network"){return(this.colorEdgeBy&&this.meta.data.edges[this.colorEdgeBy])||(this.colorNodeBy&&this.meta.data.nodes[this.colorNodeBy])}else{return(this.outlineBy&&this.isMultidimensionalData)||(this.colorBy&&((this.data.x&&this.data.x.hasOwnProperty(this.colorBy))||(this.data.z&&this.data.z.hasOwnProperty(this.colorBy))||this.getSampleIndices(this.colorBy)>-1))}}};this.drawColorLegend=function(a,b,d,c){if(this.isMap){a+=parseInt(this.meta.canvas.ctx2.canvas.style.left);b+=parseInt(this.meta.canvas.ctx2.canvas.style.top)}if(this.isDrawPropertyLegend()){if(d.type=="Numeric"&&!d.colorBy){this.drawColorIndicator(a,b,d)}else{this.drawPropertyLegend(c,a,b,d)}}};this.drawShapeLegend=function(a,b,d,c){this.drawPropertyLegend(c,a,b,d)};this.drawSizeLegend=function(a,b,d,c){this.drawPropertyLegend(c,a,b,d)};this.drawPatternLegend=function(a,b,d,c){this.drawPropertyLegend(c,a,b,d)};this.drawPropertyLegend=function(f,B,h,q){this.functionCaller="drawPropertyLegend";var t=this.decapitalize(f);if(this.isDrawPropertyLegend(t)){var C=f.replace("Node","").replace("Edge","")=="Size"?0:this.getDiameterLegend();if(f.replace("Node","").replace("Edge","")=="Size"){for(var A=0;A<(this.legendSizesN||q.levels.length);A++){C=Math.max(C,q.sizes?q.sizes[A]:this.sizes[A])}}var v=this.getFontPt(this.legendFont);var j=v/2;var b=this.legendColumns>this["legend"+f+"sN"]?this["legend"+f+"sN"]:this.legendColumns;var e=Math.ceil(this["legend"+f+"sN"]/b);var m=this["legend"+f+"Width"]/b;var g=h+this.margin+j;var z=Math.max(C,v);var l=this.graphType=="Boxplot"?"rectangle":"circle";var x=0;this.drawLegendBackgroundBox(B,h,this["legend"+f+"Width"],this["legend"+f+"Height"],true,"-legend-"+t);var F=f.replace("Node","").replace("Edge","")=="Color"&&this.outlineBy?this.outlineBy:this[t+"By"];this.addToRender(["drawText",F,B+(this["legend"+f+"Width"]/2),g,this.legendFont,this.legendColor,"center","middle"]);g+=j+this.margin;this.disableGradientTransparencyShadow();if(this.legendBox){this.addToRender(["drawLine","line",B,g,B+this["legend"+f+"Width"],g,this.legendBoxColor])}this.enableGradientTransparencyShadow();g+=this.margin+(z/2);var a=this["legend"+f+"sS"]||this.sortObject(this["legend"+f+"s"]);var E=q.origin?q.origin:this.meta.data.modified?"modified":"y";for(var s=0;sw?w:this.legendColumns;var d=Math.ceil(w/k);var l=j/k;var B=a+this.margin+b;var p=Math.max(y,f);var g=0;this.drawLegendBackgroundBox(C,a,j,E,true,"-legend-"+u.id);if(u.title){this.addToRender(["drawText",u.title,C+(j/2),B,this.legendFont,this.legendColor,"center","middle"]);B+=b+this.margin;this.disableGradientTransparencyShadow();if(this.legendBox){this.addToRender(["drawLine","line",C,B,C+j,B,this.legendBoxColor])}this.enableGradientTransparencyShadow();B+=this.margin+(p/2)}else{B+=(p/2)-b}var x=false;for(var t=0;t-1&&g>-1){var o=0;var d=0;if(this.legendPosition.match(/right|left/i)){for(var e=0;ethis.maxY-this.minY){e=this.margin;b=this.margin*5}else{e=this.width-(this.legendWidth+this.margin);b=this.margin*5}}else{if(this.graphType=="Circular"){if(this.circularType=="sunburst"&&this.colorBy){e=this.legendPosition=="top"?this.marginLeft+this.left:this.width-(this.legendColorWidth+this.right+this.marginRight);b=this.legendPosition=="top"?this.marginTop+this.top:this.height-(this.legendColorHeight+this.bottom+this.marginBottom)}else{e=this.legendPosition=="top"?this.marginLeft+this.left:this.width-(this.legendVariableWidth+this.right+this.marginRight);b=this.legendPosition=="top"?this.marginTop+this.top:this.height-(this.legendVariableHeight+this.bottom+this.marginBottom)}}else{if(this.legendInside){if(this.legendDecorationWidth>0&&this.legendDecorationHeight>0){var d=this.legendDecorationWidth+(this.margin*2);switch(this.decorationsPosition){case"bottomRight":h=c+this.x-d;f=i+this.y-(this.legendDecorationHeight+this.margin);break;case"bottom":h=c+(this.x/2)-(this.legendDecorationWidth/2);f=i+this.y-(this.legendDecorationHeight+this.margin);break;case"bottomLeft":h=c+this.margin;f=i+this.y-(this.legendDecorationHeight+this.margin);break;case"left":h=c+this.margin;f=i+(this.y/2)-(this.legendDecorationHeight/2);break;case"topLeft":h=c+this.margin;f=i+(this.margin*2);break;case"top":h=c+(this.x/2)-(this.legendDecorationWidth/2);f=i+(this.margin*2);break;case"topRight":h=c+this.x-d;f=i+(this.margin*2);break;default:h=c+this.x-d;f=i+(this.y/2)-(this.legendDecorationHeight/2);break}}if(this.legendWidth>0&&this.legendHeight>0){switch(this.legendPosition){case"bottomRight":e=c+this.x-this.legendWidth;b=i+this.y-this.legendHeight;break;case"bottom":e=c+(this.x/2)-(this.legendWidth/2);b=i+this.y-this.legendHeight;break;case"bottomLeft":e=c;b=i+this.y-this.legendHeight;break;case"left":e=c;b=i+(this.y/2)-(this.legendHeight/2);break;case"topLeft":e=c;b=i;break;case"top":e=c+(this.x/2)-(this.legendWidth/2);b=i;break;case"topRight":e=c+this.x-this.legendWidth;b=i;break;default:e=c+this.x-this.legendWidth;b=i+(this.y/2)-(this.legendHeight/2);break}}}else{switch(this.decorationsPosition){case"bottom":h=c+(this.x/2)-(this.legendDecorationWidth/2);f=i+this.y+this.bottom-this.legendDecorationHeight;break;default:h=c+this.x+this.right-(this.legendDecorationWidth+(this.margin*2));f=i+(this.y/2)-(this.legendDecorationHeight/2);break}a=this.legendPosition==this.decorationsPosition?this.legendDecorationWidth:0;g=this.legendPosition==this.decorationsPosition?this.legendDecorationHeight:0;switch(this.legendPosition){case"bottom":e=c+(this.x/2)-(this.legendWidth/2);b=i+this.y+this.bottom-(this.legendHeight+(g?g+this.margin:0));if(this.graphType=="Scatter3D"||this.is3DPlot){b+=this.legendHeight}break;default:e=c+this.x+this.right-(this.legendWidth+a);b=i+(this.y/2)-(this.legendHeight/2);if(this.graphType=="Scatter3D"||this.is3DPlot){e+=this.legendWidth}break}}}}}return[h,f,e,b]};this.drawIndicator=function(a,b,c){delete (this.legendColorIndicatorCurX);delete (this.legendColorIndicatorCurY);this.drawColorIndicator(a,b,false,c)};this.drawLegend=function(a){if(this.graphType=="Venn"){this.drawVennLegend()}else{if(this.graphType=="Circular"){if(this.circularType=="sunburst"){this.drawScatterLegend(a)}else{this.drawOverlaysLegend();var b=this.getVariableLegendPosition();this.drawVariableLegend(b[0],b[1])}}else{if(this.graphType=="Network"){this.drawScatterLegend()}else{if(this.graphType.match(/Scatter/)||this.is3DPlot||((this.colorBy||this.shapeBy||this.sizeBy||this.patternBy)&&this.graphType.match(/^Bar$|Boxplot|Dotplot|Treemap|TagCloud|ParallelCoordinates|Sankey|Tree|Line|Heatmap|Stacked|Map/))){this.drawScatterLegend(a);if(this.isOncoprint){this.drawOncoprintLegend()}this.drawOverlaysLegend()}else{this.draw1DLegend();this.drawOverlaysLegend()}}}}};this.draw1DLegend=function(){this.drawStockIndicatorsLegend();if(this.showLegend&&((this.graphType!="Heatmap")||(this.graphType=="Heatmap"&&(this.colorBy||this.shapeBy||this.sizeBy||this.patternBy)))){if(this.isMultidimensionalData||((this.colorBy||this.shapeBy||this.sizeBy||this.patternBy)&&this.graphType.match(/^Bar$|Boxplot|Dotplot|Treemap|TagCloud|ParallelCoordinates|Sankey|Tree|Line|Heatmap|Stacked/))){if(this.isOncoprint){this.drawOncoprintLegend()}this.drawScatterLegend()}else{if(this.graphType=="Treemap"||this.graphType=="TagCloud"){return}var c=this.getVariableLegendPosition();var a=c[0];var b=c[1];if(this.legendVariableX&&this.legendVariableY){a=this.legendVariableX;b=this.legendVariableY}this.legendVariableCurX=a;this.legendVariableCurY=b;this.drawVariableLegend(a,b)}}else{if(this.isOncoprint){this.drawOncoprintLegend()}}};this.drawOverlaysLegend=function(){var s,e;if(this.overlaysLegendPosition.match(/right/i)){s=this.layoutValid?this.marginTop+this.layoutTop:this.marginTop+this.offsetY+this.top;if(this.overlaysLegendPosition=="right"){s+=(this.y/2)-(this.legendOverlaysHeight/2)}e=this.layoutValid?this.width-(this.marginRight+this.layoutRight+this.legendOverlaysWidth):this.width-(this.marginRight+this.legendOverlaysWidth)}else{s=this.layoutValid?this.height-(this.marginBottom+this.layoutBottom+this.legendOverlaysHeight):this.height-(this.marginBottom+this.legendOverlaysHeight);e=this.layoutValid?this.marginLeft+this.layoutLeft:this.marginLeft+this.offsetX+this.left;if(this.overlaysLegendPosition=="bottom"){e+=(this.x/2)-(this.legendOverlaysWidth/2)}}var v=s;var f=e;for(var k=0;k0){if(e){this.setPropertyLegendDimensions(j[f]);q=this["legend"+j[f]+"Width"];g=this["legend"+j[f]+"Height"]}var c=("draw"+j[f]+"Legend").replace("Node","").replace("Edge","");var b=this["legend"+j[f]+"Meta"];var o=this.getXYLegendCoords(j[f],d,n);if(p&&k){this[c](p,k,b,j[f]);this["legend"+j[f]+"CurX"]=p;this["legend"+j[f]+"CurY"]=k}else{this[c](o[0],o[1],b,j[f]);this["legend"+j[f]+"CurX"]=o[0];this["legend"+j[f]+"CurY"]=o[1]}if(this.legendPosition.match(/right|left/i)){n=o[3]+this.margin}else{d=o[2]+this.margin}}}for(var f=0;f0&&d.ty0&&d.txa[3]+e.len){g=(a[2]+a[4])/2;this.addToRender(["drawLine","line",a[3]+this.margin,a[2],a[3]+this.margin,a[4],n],false,q);this.addToRender(["drawLine",e.type,e.tx,e.ty,a[3]+this.margin,g,n],false,q)}else{if(e.ty>a[4]+(e.width*0.2)){g=(a[1]+a[3])/2;this.addToRender(["drawLine","line",a[1],a[4]+this.margin,a[3],a[4]+this.margin,n],false,q);this.addToRender(["drawLine",e.type,e.tx,e.ty,g,a[4]+this.margin,n],false,q)}else{if(e.ty=",max:"<=",like:"like",exact:"exact"};for(var f=0;f0){this.groupSamples(this.groupingFactors,false,false,true,false,false,true)}else{this.draw()}};this.filterData=function(D,G){if(this.isDOE){return}var w={};var K={};var e={};var H=false;var E=this;var F=function(s,v,g){if(v.hasOwnProperty(s)){return v[s]}else{if(s.match(":::")){var d=s.split(":::");if(g[d[1]]){d[1]=parseInt(d[1]);for(var k=0;k"){return parseFloat(j)-parseFloat(h)>0}else{if(s==">="){return parseFloat(j)-parseFloat(h)>0||parseFloat(j)-parseFloat(h)==0}else{if(s=="<"){return parseFloat(j)-parseFloat(h)<0}else{if(s=="<="){return parseFloat(j)-parseFloat(h)<0||parseFloat(j)-parseFloat(h)==0}else{if(s=="="||s=="=="){return parseFloat(j)-parseFloat(h)==0}else{if(s=="null"){return j==null}else{if(s=="not null"){return j!=null}else{if(s=="exact"){for(var d=0;d0){for(var O=0;O0||this.filterEdgeBy.length)){for(var O=0;O0){for(var O=0;O0){var R=this.dataStndBy;var P=this.data.y.histogram}}else{if(this.filterSmpBy.length>0){var S=-1;var x=[];for(var O=0;O=0){H=true;for(var N=0;N=0){if(!G){this.hiddenVars=x;for(var O=0;O0){var S=-1;var x=[];for(var O=0;O=0){H=true;for(var N=0;N=0){if(!G){this.hiddenSmps=x;for(var O=0;O0){this.filterSmpBy.splice(a,1);this.filterSmpByOp.splice(a,1);this.filterSmpByValue.splice(a,1);this.filterSmpByCase.splice(a,1);this.filteredSmpIndices.splice(a,1)}else{this.filterSmpBy=[];this.filterSmpByOp=[];this.filterSmpByValue=[];this.filterSmpByCase=[];this.filteredSmpIndices=[]}};this.resetVarFilters=function(a){if(a!=null&&this.filterVarBy.length>0){this.filterVarBy.splice(a,1);this.filterVarByOp.splice(a,1);this.filterVarByValue.splice(a,1);this.filterVarByCase.splice(a,1);this.filteredVarIndices.splice(a,1)}else{this.filterVarBy=[];this.filterVarByOp=[];this.filterVarByValue=[];this.filterVarByCase=[];this.filteredVarIndices=[]}};this.resetNodeFilters=function(a){if(a!=null&&this.filterNodeBy.length>0){this.filterNodeBy.splice(a,1);this.filterNodeByOp.splice(a,1);this.filterNodeByValue.splice(a,1);this.filterNodeByCase.splice(a,1)}else{this.filterNodeBy=[];this.filterNodeByOp=[];this.filterNodeByValue=[];this.filterNodeByCase=[]}};this.resetEdgeFilters=function(a){if(a!=null&&this.filterEdgeBy.length>0){this.filterEdgeBy.splice(a,1);this.filterEdgeByOp.splice(a,1);this.filterEdgeByValue.splice(a,1);this.filterEdgeByCase.splice(a,1)}else{this.filterEdgeBy=[];this.filterEdgeByOp=[];this.filterEdgeByValue=[];this.filterEdgeByCase=[]}};this.resetFeatureFilters=function(a){if(a!=null&&this.filterFeatureBy.length>0){this.filterFeatureBy.splice(a,1);this.filterFeatureByOp.splice(a,1);this.filterFeatureByValue.splice(a,1);this.filterFeatureByCase.splice(a,1)}else{this.filterFeatureBy=[];this.filterFeatureByOp=[];this.filterFeatureByValue=[];this.filterFeatureByCase=[]}};this.resetFilters=function(e,d){var a=[];if(!e){a=["filterSmpBy","filterVarBy","filterNodeBy","filterEdgeBy","filterFeatureBy"]}else{a=[e]}delete (this.hiddenLegends);for(var b=0;b0){var C={};b[b.length-1].children.push(C);u=C}else{y++}break;case")":u=b.pop();u.nodeId=this[d+"NodeId"]++;break;case":":break;default:var m=q[z-1];if(m==")"||m=="("||m==","){u.name=h;if(h&&!u.children){var s=d=="smpDendrogram"?this.getSampleIndices(h):this.getVariableIndices(h);if(s==-1){s=parseInt(h);u.name=d=="smpDendrogram"?this.data.y.smps[s]:this.data.y.vars[s];u.idx=s}else{u.idx=s}j.push(u.idx);u.ord=c++;u.mid=u.ord}}else{if(m==":"){u.height=parseFloat(h);B++}}}}else{if(y<3){this.parseNewick("("+a+")",d);return}else{alert(d+"is not in a valid Newick format");this[d]=false;if(d=="varDendrogram"){this.varDendrogramNewick=false}else{this.smpDendrogramNewick=false}return}}}o(u);e(u);u.max=A+1;u.leafs=v;u.useHeight=B==p;u.mid=l(u.children);u.axis=d;this[d]=u;var r={labl:d=="varDendrogram"?"variable":"sample",show:d=="varDendrogram"?"showVarDendrogram":"showSmpDendrogram",data:d=="varDendrogram"?"vars":"smps",indx:d=="varDendrogram"?"varIndices":"smpIndices",strt:d=="varDendrogram"?"varIndicesStart":"smpIndicesStart"};if(this[r.show]){var f;if(this[r.strt]<0){if(v!=this.data.y[r.data].length){f="Dude! The length of the "+r.labl+" nodes in the dendrogram ("+v+") is different to that one in the data ("+this.data.y[r.data].length+"). This ain't gonna work!";if(this.warnings){t.flashInfoSpan(100,100,f,3000)}this[r.show]=false}else{if(v!=this[r.indx].length){f="Ooops! Cannot show dendrogram with "+v+" nodes when only "+this[r.indx].length+" "+r.labl+" are visible.";if(this.warnings){t.flashInfoSpan(100,100,f,3000)}this[r.show]=false}else{this[r.indx]=j}}}else{var w=this[r.strt]+this[r.indx].length;this[r.indx]=[];for(var z=this[r.strt];z0){d="("+a.join(",")+")"}}else{d=b.idx}if(b.height){d+=":"+sprintf("%.1f",b.height)}return d};this.euclidianDistance=function(b,a,h,g){var e=this.cleanArrays(b,a,h,g);b=e[0];a=e[1];var f=0;if(b.length==a.length){for(var c=0;cc){return null}var l=[];var f=[];var a={};var m=0;var o=0;var j,b;while(o=0){return true}else{if(i<0&&d<0){return d>i}else{if(i>=0&&d>=0){return i>d}else{return false}}}};var h;var A=this.getDataForClustering();var w=this.getIdsForClustering();var o=[];var e=[];var C=[];var a=[];if(!this.meta.tree){this.meta.tree={}}var v=this.meta.tree;v[this.clusterAxis]=[];for(var z=0;zo[z][y]){e[z]=y}}}for(var z=0;zo[r][y]){o[y][s]=o[s][y]=o[r][y]}}else{if(this.linkage=="complete"){if(o[s][y]this.maxIterations){w=false}}var r=[];for(var e=0;e9){m[e]="K"+u}else{m[e]="K-0"+u}}return m};this.setFunctionNames("initClusterUtils")};CanvasXpress.prototype.initSortUtils=function(){this.sortNetworkIndices=function(h){this.functionCaller="sortNetworkIndices";if(this.isTransition()){return}var g=this.data[this.networkShowDataTable];var c=[h]?h:this.networkShowDataTable=="nodes"?"id":"id1";var b=[];var f=[];for(var e=0;ef[i]?1:f[j]0){if(this.tmpAsciiArrayAscii1){return e.sortAsciibetically1(d,c)}else{return e.sortNumerically1(d,c)}}else{return((this.tmpAsciiArray[d]>this.tmpAsciiArray[c])?1:(this.tmpAsciiArray[d]0){if(this.tmpAsciiArrayAscii2){return e.sortAsciibetically2(d,c)}else{return e.sortNumerically2(d,c)}}else{return((this.tmpAsciiArray1[d]>this.tmpAsciiArray1[c])?1:(this.tmpAsciiArray1[d]this.tmpAsciiArray2[c])?1:(this.tmpAsciiArray2[d]0){if(this.tmpAsciiArrayAscii1){return f.sortAsciibetically1(e,d)}else{return f.sortNumerically1(e,d)}}else{return(this.tmpAsciiArray[e]||c)-(this.tmpAsciiArray[d]||c)}};this.sortNumerically1=function(e,d){var f=this;var c=Number.MAX_VALUE*-1;if((this.tmpAsciiArray1[e]||c)-(this.tmpAsciiArray1[d]||c)==0&&this.tmpAsciiArray2.length>0){if(this.tmpAsciiArrayAscii2){return f.sortAsciibetically2(e,d)}else{return f.sortNumerically2(e,d)}}else{return(this.tmpAsciiArray1[e]||c)-(this.tmpAsciiArray1[d]||c)}};this.sortNumerically2=function(e,d){var c=Number.MAX_VALUE*-1;return(this.tmpAsciiArray2[e]||c)-(this.tmpAsciiArray2[d]||c)};this.sortArray=function(a,b){var d=[];if(a.length!=b.length){return a}for(var c=0;c\d+/)){a=d[b].split(/\>/);c[b]=Number(a[1])+1e-8}else{if(d[b].match(/^\<\d+/)){a=d[b].split(/\>8)&255;m=(n[p]>>16)&255;o=(n[p]>>24)&255^128;f[i]++;g[k]++;j[m]++;l[o]++}for(p=0;p<256;p++){i=a+f[p];k=b+g[p];m=c+j[p];o=d+l[p];f[p]=a;g[p]=b;j[p]=c;l[p]=d;a=i;b=k;c=m;d=o}for(p=0;p>8)&255;n[g[k]]=e[p];g[k]++}for(p=0;p>16)&255;e[j[m]]=n[p];j[m]++}for(p=0;p>24)&255^128;n[l[o]]=e[p];l[o]++}return n};this.setFunctionNames("initSortUtils")};CanvasXpress.prototype.initMathUtils=function(){this.isNaN=function(a){return isNaN(a)?true:a==Number.POSITIVE_INFINITY?true:a==Number.NEGATIVE_INFINITY?true:false};this.isFinite=function(a){if(this.isArray(a)){for(var b=0;b=(d+360)){b-=360}return b};this.getRadians=function(d,f,c,e){var b=Math.atan2(e-f,c-d);if(b<0){b+=(2*Math.PI)}return b};this.rotatePoint=function(c,h,b,g,d){var f=Math.cos(d)*(c-b)-Math.sin(d)*(h-g)+b;var e=Math.sin(d)*(c-b)+Math.cos(d)*(h-g)+g;return[f,e]};this.lineLength=function(b,d,a,c){return Math.sqrt(Math.pow(a-b,2)+Math.pow(c-d,2))};this.lineMidPoint=function(b,d,a,c){return[(b+a)/2,(d+c)/2]};this.parallelLinePoints=function(r,d,p,b,n){var i=p-r;var h=b-d;var o=this.lineLength(r,d,p,b);var u=i/o;var t=h/o;var s=-t;var q=u;var c=r+n*s;var f=d+n*q;var a=r-n*s;var e=d-n*q;var j=p+n*s;var m=b+n*q;var g=p-n*s;var k=b-n*q;return[c,f,a,e,j,m,g,k]};this.shortenLine=function(b,j,a,i,k,f,l){if(this.isNumeric([b,j,a,i,k,f])){if(l.match(/bezier/i)){if(l.match(/beziery/i)){return i>j?[b,j+k,a,i-f]:[b,j-k,a,i+f]}else{return a>b?[b+k,j,a-f,i]:[b-k,j,a+f,i]}}else{if(l.match(/curved/i)){return[b,j,a,i]}else{var c=Math.atan2(i-j,a-b);var d=Math.cos(c);var h=Math.sin(c);var g=this.lineLength(b,j,a,i);if(g){while(g<(k+f)){k/=1.1;f/=1.1}b+=d*k;j+=h*k;a-=d*f;i-=h*f}}}return[b,j,a,i]}};this.traceArc=function(c,b,a,m,h,d){if(m>h){var k=m;m=h;h=k}var l=[];var g=Math.PI;var i=h-m;var f=i=0};var t=[];var g=z(o)?x:c;for(var u=0;u0)?u-1:o.length-1];var h=o[u];var f=o[(u0)?J[0].x:undefined;var v=(J.length>0)?J[0].y:undefined;var s=D;var d=v;for(var E=0;E1||d>1){return null}return{x:p.v1.x+i*(p.v2.x-p.v1.x),y:p.v1.y+i*(p.v2.y-p.v1.y)}};var c=function(L,E,d,K,F,s){var J=Math.PI*2;var H=Math.atan2(K.y-E.y,K.x-E.x);var D=Math.atan2(F.y-E.y,F.x-E.x);if(H<0){H+=J}if(D<0){D+=J}var G=((H>D)?(H-D):(H+J-D));var e=((s)?-G:J-G)/q;L.push(K);for(var p=1;pa){b=Math.floor((d+1)*this.random());e=f[b];f[b]=f[d];f[d]=e}return f.slice(a)}else{return[]}};this.seq=function(e,b,d,a){var c=[];if(a||d){if(a){d=(b-e)/(Math.abs(a)-1)}else{if(b0?b>=e:b<=e){c.push(e);e+=d}}}return c};this.rnorm=function(h,b,d){var g=this;var c=[];if(b==null){b=0}if(d==null){d=1}var f=function(){var j,i;var a=2;while(a>1){j=g.random()*2-1;i=g.random()*2-1;a=j*j+i*i}return b+d*j*Math.sqrt(-2*Math.log(a)/a)};for(var e=0;e=1){return a[a.length-1]}var c=a.length*f;var b=Math.floor(c);var d=b+1;var e=c%1;if(d>=a.length){return a[b]}else{return a[b]*(1-e)+a[d]*e}};this.percentRank=function(a,c){if(typeof c!=="number"){throw new TypeError("v must be a number")}for(var d=0,b=a.length;d0){d+=b[c]}}else{if(f){if(b[c]<0){d+=b[c]}}else{d+=b[c]}}}return d};this.sumSquared=function(b,a,f,e){b=this.cleanArray(b,a,f);var d=0;for(var c=0;c0){d+=b[c]*b[c]}}else{d+=b[c]*b[c]}}return d};this.sumSquaredError=function(b,a,g){b=this.cleanArray(b,a,g);var c=this.mean(b);var f=0;for(var e=0;e0){c/=f}return c};this.range=function(c,b,f){c=this.cleanArray(c,b,f);var e=Number.MAX_VALUE;var a=Number.MAX_VALUE*-1;for(var d=0;d0){e[1]=g;d.sort(function(i,h){return i-h});if(g%2){e[0]=d[parseInt(g/2)]}else{e[0]=(d[parseInt((g-1)/2)]+d[g/2])/2}}return e};this.Abs=function(b,a,e){b=this.cleanArray(b,a,e);var d=[];for(var c=0;c0){var e=[];var l=[];var b=this.fivenum(a);var g=this.boxplotHingeFunction=="summary"?this.quantile(a,[0.25,0.75]):[b[1],b[3]];var u=b[0];var q=g[0];var o=b[2];var s=b[2];var n=g[1];var t=b[4];var k=n-q;var p=q-this.boxplotCoef*k;var m=n+this.boxplotCoef*k;var j=(b[3]-b[1])/Math.sqrt(a.length);for(var r=0;rm){e.push(a[r])}else{l.push(a[r])}}if(e.length>0){var f=this.range(l);u=f[0];t=f[1]}var h=[s-1.58*j,s+1.58*j];return[s,q,o,n,u,t,e,a.length,h]}return[NaN,NaN,NaN,NaN,NaN,NaN,NaN]};this.quantileBin=function(b,a){if(a=b[0]&&a=b[1]&&a=b[2]){return 3}}}}};this.quantile=function(b,c){b=this.cleanArray(b);b=b.slice().sort(function(f,e){return f-e});var d=b.length-1;var a=c||[0.25,0.5,0.75];return a.map(function(j){if(j===0){return b[0]}else{if(j===1){return b[d]}else{var f=1+j*d;var i=Math.floor(f);var g=f-i;var e=b[i-1];return g===0?e:e+g*(b[i]-e)}}})};this.iqr=function(a){var b=this.quantile(a,[0.25,0.75]);return b[1]-b[0]};this.variance=function(e,f,c,a){e=this.cleanArray(e,f,c);var b=e.length;if(b<1){return a?[NaN,NaN,NaN]:NaN}else{if(b==1){return a?[e[0],0,1]:0}else{var j=this.mean(e);var h=0;var d=b;while(--d>=0){if(!this.isNaN(e[d])){var g=e[d]-j;h+=g*g}}if(a){return this.standardDeviationType=="unbiased"?[j,h/(b-1),b]:[j,h/b,b]}else{return this.standardDeviationType=="unbiased"?h/(b-1):h/b}}}};this.deviation=function(b,a,f){b=this.cleanArray(b,a,f);var g=b.length;if(g<1){return[NaN]}else{if(g==1){return[0]}else{var c=this.mean(b);var d=[];for(var e=0;e0){return l/(this.standardDeviationType=="unbiased"?b-1:b)}else{return NaN}};this.correlation=function(c,b,a,e,d){if(d&&d=="spearman"){return this.correlationSpearman(c,b,a,e)}else{return this.correlationPearson(c,b,a,e)}};this.correlationSpearman=function(m,l,h,f){var k=this.cleanArrays(m,l,h,f);m=k[0];l=k[1];var a=m.length;var b=0;var e=this.rank2(m);var c=this.rank2(l);for(var g=0;g2){o=(s*B-r*q)/(s*l-r*r);j=(q-o*r)/s;b=(B-(r*q/s))/Math.sqrt((l-Math.pow(r,2)/s)*(w-Math.pow(q,2)/s));d=r/s;h=this.tinv(0.05,s-2,true);for(var x=0;x=0?j:2-j};var l=function(d){if(d>=2){return -100}if(d<=0){return 100}var aa=(d<1)?d:2-d;var k=Math.sqrt(-2*Math.log(aa/2));var y=-0.70711*((2.30753+k*0.27061)/(1+k*(0.99229+k*0.04481))-k);for(var i=0;i<2;i++){var w=W(y)-aa;y+=w/(1.1283791670955126*Math.exp(-(y*y))-y*w)}return(d<1)?y:-y};var X=function(i,j,d){var k=Math.sqrt(j);return i-k*Math.sqrt(2)*l(2*d)};var O=function(d){var y=Math.ceil(0.1*d.length);var k=F.cloneObject(d);k=k.sort(function(i,aa){return i-aa});for(var j=0;j1){for(var ad=ac;ad=ae});var ad=i>1?ab[ab.length-1][0]*i:ab[w][0];return a(aa.map(function(af){return q(af,ad,3)}),j)})};var s=function(ad,ac){var ab=ad.length;var k=ad[0].length;var w=ac.length;var ae=ac[0].length;var j=new Array(ab);for(var d=0;d2){this.loessDegree=2}this.loessBandWidth=Number(this.loessBandwidth);if(this.loessBandwidth<0||this.loessBandwidth>1){this.loessBandwidth=0.8}this.loessSpan=Number(this.loessSpan);if(this.loessSpan<0||this.loessSpan>1){this.loessSpan=0.8}var z=[Y[0]];var t=[this.loessSteps];var G=Y[1];if(Y[2]){z.push(Y[2]);t.push(this.loessSteps)}if(!H){H=Array(Y[0].length).fill(1)}var Z=o(z,this.loessDegree);var c=z.map(O);var L=z.map(function(i,d){return c[d](i)});var h=this.transposeMatrix(L);var E=[];var J=[];z.forEach(function(ac,ad){var d=ac.sort(function(ae,i){return ae-i});var j=d[0];var y=d[d.length-1];var k=(y-j)/(t[ad]-1);J.push([]);for(var w=0;w=0;w--){aa*=t[w]}for(var w=ad+1;wn.lambda.x[1]?0:1;var e=n.lambda.x[0]h[1]?Math.sqrt(n.lambda.x[f])*l:Math.sqrt(n.lambda.x[e])*l;var a=h[1]>i[1]?Math.sqrt(n.lambda.x[f])*l:Math.sqrt(n.lambda.x[e])*l;var c=Math.atan2(n.E.x[f][1],n.E.x[f][0]);if(c<0){c+=Math.PI/2}var d={rx:b,ry:a,cx:i[0],cy:h[0],rot:c};return d};this.errorEllipse3D=function(m,l,j){var p=this.variance(m,false,false,true);var o=this.variance(l,false,false,true);var n=this.variance(j,false,false,true);var c=this.covariance(m,l);var b=this.covariance(m,j);var i=this.covariance(l,j);var t=[[p[1],c,b],[c,o[1],i],[b,i,n[1]]];var k=numeric.eig(t);var a=Math.sqrt(2*this.gammaPinv(this.errorEllipseConfidence,1));var f=this.rank(k.lambda.x);var s=f[2];var q=f[1];var r=f[0];var h=Math.sqrt(k.lambda.x[s])*a;var e=Math.sqrt(k.lambda.x[q])*a;var d=Math.sqrt(k.lambda.x[r])*a;var w=Math.atan2(k.E.x[2][s]*-1,k.E.x[1][s]*-1);var v=Math.atan2(k.E.x[2][s]*-1,k.E.x[0][s]*-1);var u=Math.atan2(k.E.x[1][s]*-1,k.E.x[0][s]*-1);if(w<0){}if(v<0){v+=Math.PI/2}if(u<0){}var g={rx:[h],ry:[e],rz:[d],cx:p[0],cy:o[0],cz:n[0],rot:[w,v,u]};return g};this.uniformKernel=function(a){return(a<=1&&a>=-1)?0.5:0},this.triangularKernel=function(a){return(a<=1&&a>=-1)?1-Math.abs(a):0},this.epanechnikovKernel=function(a){return(a<=1&&a>=-1)?0.75*(1-a*a):0},this.quarticKernel=function(a){if(a<=1&&a>=-1){var b=1-a*a;return(15/16)*b*b}else{return 0}},this.triweightKernel=function(a){if(a<=1&&a>=-1){var b=1-a*a;return(35/32)*b*b*b}else{return 0}},this.gaussianKernel=function(a){return 1/Math.sqrt(2*Math.PI)*Math.exp(-0.5*a*a)},this.cosineKernel=function(a){return(a<=1&&a>=-1)?Math.PI/4*Math.cos(Math.PI/2*a):0};this.silvermanRule=function(c){var a=Math.sqrt(this.variance(c));var b=4*Math.pow(a,5);var d=3*c.length;return Math.pow(b/d,0.2)};this.nrd0Rule=function(d){var a=Math.sqrt(this.variance(d));var e=this.iqr(d)/1.34;var c=Math.pow(d.length,-0.2);var b=e>0?Math.min(a,e):a;return 0.9*b*c};this.nrdRule=function(d){var a=Math.sqrt(this.variance(d));var e=this.iqr(d)/1.34;var c=Math.pow(d.length,-0.2);var b=e>0?Math.min(a,e):a;return 1.6*b*c};this.getBandwidthEstimate=function(a){return this[this.bandwidthRule+"Rule"](a)};this.kernelDensityEstimator=function(a,c){var b=this[this.densityKernel+"Kernel"];return function(e,d){return a.map(function(f){var g=-1;var j=0;var h=e.length;while(++gs&&h[w][0]=y){d=w;f.push(h[w][0]);e.push(h[w][1]);b+=h[w][1];p=Math.max(p,h[w][1]);c=Math.min(c,h[w][1]);break}}}var l=this.boxplot(f);var k=this.boxplot(e);var o=[];for(var w=0;w<6;w++){for(var u=0;u=l[w]){o.push(e[u]);break}}}return{range:g,trim:[r,Math.max(r,d)],xy:h,bw:q,quantilesX:l,quantilesY:k,indecesY:o,sumY:b,maxY:p,minY:c,histogram:this.hist(A,B),name:B,n:A.length}};this.freedmanDiaconis=function(b,a,c){if(b&&b.length>1){b=this.cleanArray(b,a,c);var d=this.iqr(b);return d==0?1:Math.ceil(2*d*Math.pow(b.length,-1/3))}else{if(b&&b.length==1){return Number(b[0])}else{return 1}}};this.sturges=function(b,a,d){if(b&&b.length>1){b=this.cleanArray(b,a,d);var c=this.range(b);return Math.ceil(Math.log(b.length)/Math.LN2)+1}else{if(b&&b.length==1){return Number(b[0])}else{return 1}}};this.scott=function(b,a,e){if(b&&b.length>1){b=this.cleanArray(b,a,e);var c=this.range(b);var d=Math.sqrt(this.vriance(b));return Math.ceil((c[1]-c[0])/(3.5*d*Math.pow(b.length,-1/3)))}else{if(b&&b.length==1){return Number(b[0])}else{return 1}}};this.histBin=function(e,d,f,c){var a=Math.floor((e-d)/f);if(e==c[a]&&a>0){a--}return a};this.hist2D=function(h,a,m){if(this.isArray(h)&&this.isArray(h[0])&&h.length>1){var k={count:[],idxs:[],maxY:0};var e=[];for(var f=0;ff){r.unshift(r[0]-n)}if(r[r.length-1]1){c.push([a.shift(),a.shift()])}}}var b=c.reduce(function(d,e){return[d[0]+e[0]/c.length,d[1]+e[1]/c.length]},[0,0]);return b};this.centroidArea=function(a){var b=this.cloneObject(a);b.shift();return this.centroid(b)};this.prufer=function(c){var b=[];var e=Array.apply(null,Array(c.length+2)).map(function(a,j){return j});var h=Array.apply(null,Array(1*e.length)).map(function(){return 1});c.map(function(a){h[a]++});for(var f=0;fC?1:D>=C?0:NaN};var f=function(H,F){var E=0,G=H.length,C,D=-1;if(F==null){while(++D=C){D=C;break}}while(++EC){D=C}}}else{while(++E=C){D=C;break}}while(++EC){D=C}}}return D};var x=function(D,C){return D=+D,C-=D,function(E){return D+C*E}};var v="$";function j(){}j.prototype=A.prototype={constructor:j,has:function(C){return(v+C) in this},get:function(C){return this[v+C]},set:function(C,D){this[v+C]=D;return this},remove:function(C){var D=v+C;return D in this&&delete this[D]},clear:function(){for(var C in this){if(C[0]===v){delete this[C]}}},keys:function(){var C=[];for(var D in this){if(D[0]===v){C.push(D.slice(1))}}return C},values:function(){var C=[];for(var D in this){if(D[0]===v){C.push(this[D])}}return C},entries:function(){var C=[];for(var D in this){if(D[0]===v){C.push({key:D.slice(1),value:this[D]})}}return C},size:function(){var C=0;for(var D in this){if(D[0]===v){++C}}return C},empty:function(){for(var C in this){if(C[0]===v){return false}}return true},each:function(D){for(var C in this){if(C[0]===v){D(this[C],C.slice(1),this)}}}};function A(C,F){var G=new j;if(C instanceof j){C.each(function(K,J){G.set(J,K)})}else{if(Array.isArray(C)){var E=-1,I=C.length,H;if(F==null){while(++E=G.length){return H!=null?H(P):(F!=null?P.sort(F):P)}var O=-1,J=P.length,T=G[N++],M,R,K=A(),S,U=L();while(++OG.length){return K}var M,J=I[L-1];if(H!=null&&L>=G.length){M=K.entries()}else{M=[],K.each(function(O,N){M.push({key:N,values:C(O,L)})})}return J!=null?M.sort(function(O,N){return J(O.key,N.key)}):M}return E={object:function(J){return D(J,0,r,o)},map:function(J){return D(J,0,s,B)},entries:function(J){return C(D(J,0,s,B),0)},key:function(J){G.push(J);return E},sortKeys:function(J){I[G.length-1]=J;return E},sortValues:function(J){F=J;return E},rollup:function(J){H=J;return E}}};function r(){return{}}function o(C,D,E){C[D]=E}function s(){return A()}function B(E,C,D){E.set(C,D)}var l={};var e=12;var i=5;var m=[1,1];var p=[];var d=[];l.nodeWidth=function(C){if(!arguments.length){return e}e=+C;return l};l.nodePadding=function(C){if(!arguments.length){return i}i=+C;return l};l.nodes=function(C){if(!arguments.length){return p}p=C;return l};l.links=function(C){if(!arguments.length){return d}d=C;return l};l.size=function(C){if(!arguments.length){return m}m=C;return l};l.layout=function(C){c();k();a();g(C);b();u();return l};l.relayout=function(){b();u();return l};l.link=function(){var D=0.5;function C(L){var I=L.source.x+L.source.dx,H=L.target.x,G=x(I,H),F=G(D),E=G(1-D),K=L.source.y+L.sy+L.dy/2,J=L.target.y+L.ty+L.dy/2;return"M"+I+","+K+"C"+F+","+K+" "+E+","+J+" "+H+","+J}C.curvature=function(E){if(!arguments.length){return D}D=+E;return C};return C};function u(){var C=0.5;d.forEach(function(K){var H=K.source.x+K.source.dx,G=K.target.x,F=x(H,G),E=F(C),D=F(1-C),J=K.source.y+K.sy+K.dy/2,I=K.target.y+K.ty+K.dy/2;K.bezier=[[H,E,D,G],[J,J,I,I]]})}function c(){p.forEach(function(C){C.sourceLinks=[];C.targetLinks=[]});d.forEach(function(C){var D=C.source,E=C.target;if(typeof D==="number"){D=C.source=p[C.source]}if(typeof E==="number"){E=C.target=p[C.target]}D.sourceLinks.push(C);E.targetLinks.push(C)})}function k(){p.forEach(function(C){C.value=Math.max(f(C.sourceLinks,q),f(C.targetLinks,q))})}function a(){var D=p,E,C=0;while(D.length){E=[];D.forEach(function(F){F.x=C;F.breadth=C;F.dx=e;F.sourceLinks.forEach(function(G){E.push(G.target)})});D=E;++C}w(C);n((m[0]-e)/(C-1))}function w(C){p.forEach(function(D){if(!D.sourceLinks.length){D.x=C-1}})}function n(C){p.forEach(function(D){D.x*=C})}function g(H){var C=z().key(function(K){return K.x}).sortKeys(h).entries(p).map(function(K){return K.values});F();J();for(var I=1;H>0;--H){D(I*=0.99);J();E(I);J()}function F(){var K=t(C,function(L){return(m[1]-(L.length-1)*i)/f(L,q)});C.forEach(function(L){L.forEach(function(N,M){N.y=M;N.dy=N.value*K})});d.forEach(function(L){L.dy=L.value*K})}function E(L){C.forEach(function(M,N){M.forEach(function(O){if(O.targetLinks.length){var P=f(O.targetLinks,K)/f(O.targetLinks,q);O.y+=(P-y(O))*L}})});function K(M){return y(M.source)*M.value}}function D(L){C.slice().reverse().forEach(function(M){M.forEach(function(N){if(N.sourceLinks.length){var O=f(N.sourceLinks,K)/f(N.sourceLinks,q);N.y+=(O-y(N))*L}})});function K(M){return y(M.target)*M.value}}function J(){C.forEach(function(L){var O,K,N=0,P=L.length,M;L.sort(G);for(M=0;M0){O.y+=K}N=O.y+O.dy+i}K=N-i-m[1];if(K>0){N=O.y-=K;for(M=P-2;M>=0;--M){O=L[M];K=O.y+O.dy+i-N;if(K>0){O.y-=K}N=O.y}}})}function G(L,K){return L.y-K.y}}function b(){p.forEach(function(E){E.sourceLinks.sort(C);E.targetLinks.sort(D)});p.forEach(function(F){var G=0,E=0;F.sourceLinks.forEach(function(H){H.sy=G;G+=H.dy});F.targetLinks.forEach(function(H){H.ty=E;E+=H.dy})});function D(F,E){return F.source.y-E.source.y}function C(F,E){return F.target.y-E.target.y}}function y(C){return C.y+C.dy/2}function q(C){return C.value}return l};this.setSankey=function(){var a=this.getD3Sankey();a.nodeWidth(this.sankeyNodeWidth);a.nodePadding(this.margin);a.size([this.x,this.y]);a.nodes(this.data.sankey.nodes);a.links(this.data.sankey.links);a.layout(this.sankeyIterations);this.data.sankey.object=a};this.getD3Tree=function(){var b=this;var l=function(y,x,w){var z=w/(x.i-y.i);x.c-=z;x.s+=w;y.c+=z;x.z+=w;x.m+=w};var f=function(z){var y=0;var C=0;var B=z.children;var A=B.length;var x;while(--A>=0){x=B[A];x.z+=y;x.m+=y;y+=x.s+(C+=x.c)}};var a=function(x,w,y){return x.a.parent===w.parent?x.a:y};var r=function(w){var x=w.children;return x?x[0]:w.t};var v=function(w){var x=w.children;return x?x[x.length-1]:w.t};var e=function(x,w){return x.parent===w.parent?1:2};var i=1;var g=1;var n=null;var h=function(z,x){if(z===x){return z}var y=z.ancestors();var w=x.ancestors();var A=null;z=y.pop();x=w.pop();while(z===x){A=z;z=y.pop();x=w.pop()}return A};var d=function(w){w.data=w.data.data};var j=function(x){var w=0;do{x.height=w}while((x=x.parent)&&(x.height<++w))};var c=function(C,y){var F=new u(C);var D=+C.value&&(F.value=C.value);var A;var w=[F];var x;var E;var B;var z;if(y==null){y=function(G){return G.children}}while(A=w.pop()){if(D){A.value=+A.data.value}if((E=y(A.data))&&(z=E.length)){A.children=new Array(z);for(B=z-1;B>=0;--B){w.push(x=A.children[B]=new u(E[B]));x.parent=A;x.depth=A.depth+1}}}return F.eachBefore(j)};var u=function(w){this.data=w;this.depth=0;this.height=0;this.parent=null;if(this.nid==null){this.id=b.treeNodeId++}};u.prototype=c.prototype={constructor:u,count:function(){return this.eachAfter(count)},each:function(C){var z=this;var A;var y=[z];var x,w,B;do{A=y.reverse();y=[];while(z=A.pop()){C(z);x=z.children;if(x){for(w=0,B=x.length;w=0;--x){w.push(y[x])}}}return this},sum:function(w){return this.eachAfter(function(A){var z=+w(A.data)||0;var y=A.children;var x=y&&y.length;while(--x>=0){z+=y[x].value}A.value=z})},sort:function(w){return this.eachBefore(function(x){if(x.children){x.children.sort(w)}})},path:function(w){var A=this;var z=h(A,w);var y=[A];while(A!==z){A=A.parent;y.push(A)}var x=y.length;while(w!==z){y.splice(x,0,w);w=w.parent}return y},ancestors:function(){var x=this;var w=[x];while(x=x.parent){w.push(x)}return w},descendants:function(){var w=[];this.each(function(x){w.push(x)});return w},leaves:function(){var w=[];this.eachBefore(function(x){if(!x.children){w.push(x)}});return w},links:function(){var w=this;var x=[];w.each(function(y){if(y!==w){x.push({source:y.parent,target:y})}});return x},copy:function(){return c(this).eachBefore(d)}};var p=function(x,w){this._=x;this.parent=null;this.children=null;this.A=null;this.a=this;this.z=0;this.m=0;this.c=0;this.s=0;this.t=null;this.i=w};p.prototype=Object.create(u.prototype);var q=function(x){var w=new p(x,0);var B;var y=[w];var D;var A;var z;var C;while(B=y.pop()){if(A=B._.children){B.children=new Array(C=A.length);for(z=C-1;z>=0;--z){y.push(D=B.children[z]=new p(A[z],z));D.parent=B}}}(w.parent=new p(null,0)).children=[w];return w};function k(B){var D=q(B);D.eachAfter(t),D.parent.m=-D.z;D.eachBefore(o);if(n){B.eachBefore(s)}else{var x=B;var C=B;var w=B;B.eachBefore(function(F){if(F.xC.x){C=F}if(F.depth>w.depth){w=F}});var E=x===C?1:e(x,C)/2;var y=E-x.x;var A=i/(C.x+E+y);var z=g/(w.depth||1);B.eachBefore(function(F){F.x=(F.x+y)*A;F.y=F.depth*z})}return B}function t(y){var A=y.children;var B=y.parent.children;var x=y.i?B[y.i-1]:null;if(A){f(y);var z=(A[0].z+A[A.length-1].z)/2;if(x){y.z=x.z+e(y._,x._);y.m=y.z-z}else{y.z=z}}else{if(x){y.z=x.z+e(y._,x._)}}y.parent.A=m(y,x,y.parent.A||B[0])}function o(w){w._.x=w.z+w.parent.m;w.m+=w.parent.m}function m(I,H,C){if(H){var z=I;var y=I;var B=H;var A=z.parent.children[0];var E=z.m;var D=y.m;var G=B.m;var F=A.m;var x;while(B=v(B),z=r(z),B&&z){A=r(A);y=v(y);y.a=I;x=B.z+G-z.z-E+e(B._,z._);if(x>0){l(a(B,I,C),I,x);E+=x;D+=x}G+=B.m;E+=z.m;F+=A.m;D+=y.m}if(B&&!v(y)){y.t=B;y.m+=G-D}if(z&&!r(A)){A.t=z;A.m+=E-F;C=I}}return C}function s(w){w.x*=i;w.y=w.depth*g}k.separation=function(w){return arguments.length?(e=w,k):e};k.size=function(w){return arguments.length?(n=false,i=+w[0],g=+w[1],k):(n?null:[i,g])};k.nodeSize=function(w){return arguments.length?(n=true,i=+w[0],g=+w[1],k):(n?[i,g]:null)};k.setTree=function(x,w){return c(x,w)};k.collapse=function(w){k.collapseTree(w);k.update(w)};k.expand=function(w){k.expandTree(w);k.update(w)};k.collapseTree=function(w){if(w.children){w._children=w.children;w._children.forEach(k.collapseTree);w.children=null}};k.expandTree=function(w){if(w._children){w.children=w._children;w.children.forEach(k.expandTree);delete w._children}};return k};this.setTree=function(){var b=[];if(this.treeCircular){b=this.x>this.y?[360,this.y/2]:[360,this.x/2]}else{b=[this.graphOrientation=="vertical"?this.x:this.y,this.graphOrientation=="vertical"?this.y:this.x]}var a=function(d,c){return(d.parent==c.parent?1:2)/d.depth};this.data.tree.object=this.treeCircular?this.getD3Tree().size(b).separation(a):this.getD3Tree().size(b);if(!this.data.tree.root){this.data.tree.root=this.getD3Tree().setTree(this.data.tree.data,function(c){return c.children})}this.data.tree.plot=this.data.tree.object(this.data.tree.root);this.data.tree.plot.size=b};this.getD3CirclePack=function(){var l=this;var r=function(K,I){if(K===I){return K}var J=K.ancestors();var H=I.ancestors();var L=null;K=J.pop();I=H.pop();while(K===I){L=K;K=J.pop();I=H.pop()}return L};var o=function(H){H.data=H.data.data};var w=function(I){var H=0;do{I.height=H}while((I=I.parent)&&(I.height<++H))};var m=function(N,J){var Q=new F(N);var O=+N.value&&(Q.value=N.value);var L;var H=[Q];var I;var P;var M;var K;if(J==null){J=function(R){return R.children}}while(L=H.pop()){if(O){L.value=+L.data.value}if((P=J(L.data))&&(K=P.length)){L.children=new Array(K);for(M=K-1;M>=0;--M){H.push(I=L.children[M]=new F(P[M]));I.parent=L;I.depth=L.depth+1}}}return Q.eachBefore(w)};var F=function(H){this.data=H;this.depth=0;this.height=0;this.parent=null;if(this.nid==null){this.id=l.treeNodeId++}};F.prototype=m.prototype={constructor:F,count:function(){return this.eachAfter(count)},each:function(N){var K=this;var L;var J=[K];var I,H,M;do{L=J.reverse();J=[];while(K=L.pop()){N(K);I=K.children;if(I){for(H=0,M=I.length;H=0;--I){H.push(J[I])}}}return this},sum:function(H){return this.eachAfter(function(L){var K=+H(L.data)||0;var J=L.children;var I=J&&J.length;while(--I>=0){K+=J[I].value}L.value=K})},sort:function(H){return this.eachBefore(function(I){if(I.children){I.children.sort(H)}})},path:function(H){var L=this;var K=r(L,H);var J=[L];while(L!==K){L=L.parent;J.push(L)}var I=J.length;while(H!==K){J.splice(I,0,H);H=H.parent}return J},ancestors:function(){var I=this;var H=[I];while(I=I.parent){H.push(I)}return H},descendants:function(){var H=[];this.each(function(I){H.push(I)});return H},leaves:function(){var H=[];this.eachBefore(function(I){if(!I.children){H.push(I)}});return H},links:function(){var H=this;var I=[];H.each(function(J){if(J!==H){I.push({source:J.parent,target:J})}});return I},copy:function(){return m(this).eachBefore(o)}};var e=null;var s=1;var q=1;var h=function(H){this._=H;this.next=null};var g=function(M){var I;var L=(M=M.slice()).length;var H=null;var K=H;while(L){var J=new h(M[L-1]);if(K){K=K.next=J}else{K=H=J}M[I]=M[--L]}return{head:H,tail:K}};var t=function(H){return G(g(H),[])};var d=function(J,H){var K=H.x-J.x;var I=H.y-J.y;var L=J.r-H.r;return L*L+0.000001>K*K+I*I};var G=function(I,O){var M;var K=null;var J=I.head;var H;var N;switch(O.length){case 1:M=y(O[0]);break;case 2:M=x(O[0],O[1]);break;case 3:M=u(O[0],O[1],O[2]);break}while(J){N=J._;H=J.next;if(!M||!d(M,N)){if(K){I.tail=K;K.next=null}else{I.head=I.tail=null}O.push(N);M=G(I,O);O.pop();if(I.head){J.next=I.head;I.head=J}else{J.next=null;I.head=I.tail=J}K=I.tail;K.next=H}else{K=J}J=H}I.tail=K;return M};var y=function(H){return{x:H.x,y:H.y,r:H.r}};var x=function(S,P){var I=S.x;var R=S.y;var K=S.r;var H=P.x;var O=P.y;var J=P.r;var N=H-I;var Q=O-R;var L=J-K;var M=Math.sqrt(N*N+Q*Q);return{x:(I+H+N/M*L)/2,y:(R+O+Q/M*L)/2,r:(M+K+J)/2}};var u=function(ag,ae,ad){var ac=ag.x;var L=ag.y;var X=ag.r;var aa=ae.x;var K=ae.y;var V=ae.r;var Y=ad.x;var I=ad.y;var U=ad.r;var aj=2*(ac-aa);var N=2*(L-K);var T=2*(V-X);var ak=ac*ac+L*L-X*X-aa*aa-K*K+V*V;var ah=2*(ac-Y);var M=2*(L-I);var S=2*(U-X);var ai=ac*ac+L*L-X*X-Y*Y-I*I+U*U;var af=ah*N-aj*M;var Z=(N*ai-M*ak)/af-ac;var W=(M*T-N*S)/af;var J=(ah*ak-aj*ai)/af-L;var H=(aj*S-ah*T)/af;var R=W*W+H*H-1;var Q=2*(Z*W+J*H+X);var P=Z*Z+J*J-X*X;var O=(-Q-Math.sqrt(Q*Q-4*R*P))/(2*R);return{x:Z+W*O+ac,y:J+H*O+L,r:O}};var n=function(M,K,I){var H=M.x;var Q=M.y;var R=K.r+I.r;var P=M.r+I.r;var S=K.x-H;var O=K.y-Q;var N=S*S+O*O;if(N){var L=0.5+((P*=P)-(R*=R))/(2*N);var J=Math.sqrt(Math.max(0,2*R*(P+N)-(P-=N)*P-R*R))/(2*N);I.x=H+L*S+J*O;I.y=Q+L*O-J*S}else{I.x=H+P;I.y=Q}};var a=function(J,H){var K=H.x-J.x;var I=H.y-J.y;var L=J.r+H.r;return L*L-0.000001>K*K+I*I};var A=function(M,I,O){var K=M._;var H=M.next._;var N=K.r+H.r;var L=(K.x*H.r+H.x*K.r)/N-I;var J=(K.y*H.r+H.y*K.r)/N-O;return L*L+J*J};var i=function(H){this._=H;this.next=null;this.previous=null};var k=function(P){if(!(N=P.length)){return 0}var U,N,R,V,V,T;var X=P[0];X.x=0;X.y=0;if(!(N>1)){return X.r}var W=P[1];X.x=-W.r;W.x=X.r;W.y=0;if(!(N>2)){return X.r+W.r}n(W,X,U=P[2]);var Y=X.r*X.r;var L=W.r*W.r;var M=U.r*U.r;var Q=Y+L+M;var K=Y*X.x+L*W.x+M*U.x;var J=Y*X.y+L*W.y+M*U.y;var I,H,S,R,O,V,T;X=new i(X);W=new i(W);U=new i(U);X.next=U.previous=W;W.next=X.previous=U;U.next=W.previous=X;B:for(var S=3;Se?e:a;this.data.bubble.object=this.getD3CirclePack().size([c,c]).padding(2);if(!this.data.bubble.root){this.data.bubble.root=this.getD3CirclePack().setPack(this.data.bubble.data)}this.data.bubble.plot=this.data.bubble.object(this.data.bubble.root);this.data.bubble.plot.diameter=c};this.setFunctionNames("initMathUtils")};CanvasXpress.prototype.initLayout=function(){this.isValidLayout=function(){var b=this.layoutTopology?this.layoutTopology.split(/X/i):this.layout.split(/X/i);if(this.layoutTopology){this.layoutRows=b[0];this.layoutCols=b[1]}else{if(this.layout){this.layoutRows=b[0];this.layoutCols=b[1]}else{this.layoutRows=1;this.layoutCols=1;this.layoutValid=false}}if(!this.scatterPlotMatrix&&this.layoutComb&&this.data.l&&(this.data.l.vars||this.data.l.smps)&&this.data.l.weight&&this.data.l.type){this.data.l.comp=[];if(this.data.l.vars&&this.data.l.smps){var m={};for(var l=0;l0){if(this.graphOrientation!="vertical"){a=this.getSampleLabelLength()}else{a=this.getAxisTitleTickLength()}}else{if(this.segregateSamplesBy.length>0){if(this.graphOrientation=="vertical"){a=this.getAxisTitleTickLength()}}}}else{if(this.graphOrientation!="vertical"&&this.segregateVariablesBy.length){a=this.getSampleLabelLength()}}if(this.graphOrientation=="vertical"){a+=this.getLayoutAxisTitleHeight()}else{a+=this.smpTitle?this.smpTitleFontSize+(this.margin*2):0}}}}}}return a};this.setLayoutRight=function(){var a=0;if(this.isDOE){a=0}else{if(this.graphType.match(/Scatter/)){if(this.showLegend){a=this.legendPosition=="right"?this.legendWidth:this.margin}if(!this.layoutAdjust||this.segregateVariablesBy.length||this.segregateSamplesBy.length){a+=this.get2DYAxisWidth(true)}}else{if(this.graphType=="Pie"){if(this.showLegend&&this.legendPosition=="right"){a=this.legendVariableWidth}}else{if(this.graphType=="Heatmap"){return 0}else{if(!this.layoutAdjust){if(this.graphOrientation=="vertical"){a=this.getAxisTitleTickLength(true)}}else{a=0}if(this.graphOrientation=="vertical"){a+=this.getLayoutAxisTitleHeight(true)}if(this.showLegend&&this.legendPosition=="right"){a+=this.getLegendWidth();if(this.graphOrientation!="vertical"){a+=this.margin}}}}}}return a};this.setLayoutTop=function(){if(this.isDOE){return 0}var a=this.getTitleSubtitleHeight();if(this.graphType=="Pie"){a+=this.getFontHeight()+(this.margin*2)}else{if(this.graphType=="Scatter2D"){if(!this.layoutAdjust||this.segregateVariablesBy.length||this.segregateSamplesBy.length){a+=this.get2DXAxisHeight(true)}}else{if(this.graphType!="Heatmap"){if(!this.layoutAdjust){if(this.graphOrientation!="vertical"){a+=this.getAxisTitleTickLength()}}if(this.graphOrientation!="vertical"){a+=this.getLayoutAxisTitleHeight()}}}}return a};this.setLayoutBottom=function(){var a=0;if(this.isDOE){a=0}else{if(this.graphType=="Scatter2D"){if(!this.layoutAdjust){a=this.segregateVariablesBy.length||this.segregateSamplesBy.length?this.get2DXAxisTitleHeight():this.get2DXAxisHeight()}if(this.showLegend&&this.legendPosition=="bottom"){a+=this.legendHeight}a+=this.getLayoutAxisTitleHeight()}else{if(this.graphType=="Pie"){if(this.showLegend&&this.legendPosition=="bottom"){var c=this.getPieLegendDimensions();a=c[1]}}else{if(this.graphType=="Candlestick"&&this.graphOrientation=="vertical"){this.setTimeAxis();a=this.getSampleLabelLength()}else{if(this.graphType=="Heatmap"){a=this.getHeatmapIndicatorHeight()}else{if(!this.layoutAdjust){if(this.graphOrientation!="vertical"){a=this.getAxisTitleTickLength(true)}}if(this.graphOrientation=="vertical"){if(this.segregateVariablesBy.length>0){a=this.getSampleLabelLength()}a+=this.smpTitle?this.smpTitleFontSize+(this.margin*2):0}else{a+=this.getLayoutAxisTitleHeight(true)}if(this.showLegend&&this.legendPosition=="bottom"){if(this.graphType!="Scatter2D"){a+=this.getLegendHeight()}}}}}}}return a};this.drawLayoutSampleOverlays=function(b){var a=this.smpIndices;this.smpIndices=b;this.smpIndices=a;this.showSampleNames=true;this.showOverlays=true;this.draw1DYLayout()};this.setLayoutDimensions=function(){var c=this.isGroupedData;this.offsetX=0;this.offsetY=0;this.isGroupedData=false;this.setLayoutFonts();this.setLayoutLegendDimensions();this.isGroupedData=c;this.layoutLeft=this.setLayoutLeft();this.layoutRight=this.setLayoutRight();this.layoutTop=this.setLayoutTop();this.layoutBottom=this.setLayoutBottom();if(this.layoutCanvasCompartments){var a=this.width-(this.marginLeft+this.layoutLeft+this.marginRight+this.layoutRight);var b=this.height-(this.marginTop+this.layoutTop+this.marginBottom+this.layoutBottom);this.addToRender(["drawShape","rectangle",this.marginLeft+this.layoutLeft+(a/2),this.marginTop+this.layoutTop+(b/2),a,b,false,this.canvasBoxColor,"open"])}};this.setLayoutLegendDimensions=function(){if(this.graphType=="Pie"||this.isDOE){this.setVariableLegendDimension()}else{if(this.graphType=="Scatter2D"||this.isMultidimensionalData||((this.colorBy||this.shapeBy||this.sizeBy||this.patternBy)&&this.graphType.match(/^Bar$|Boxplot|Dotplot|Treemap|Heatmap/))){this.validatePropertyValues(true)}else{this.setVariableLegendDimension()}}};this.drawLabelsTitlesLayout=function(){this.functionCaller="drawLabelsTitlesLayout";var g=0;var f=0;var p=0;var A=0;var B=this.width-(this.marginLeft+this.layoutLeft+this.layoutRight+this.marginRight);var b=this.height-(this.marginTop+this.layoutTop+this.layoutBottom+this.marginBottom);if(this.graphType=="Treemap"){return}if(this.graphType=="Pie"&&(this.showPieGrid||this.showPieSampleLabel)){var v,m;var z=0;this.setFont();var q=this.getFontPt(this.font);var d=this.marginTop+this.layoutTop;var a=this.marginLeft+this.layoutLeft;var n=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];for(var u=0;u=h?this.layoutRows-1:this.layoutRows;this.layout=this.layoutRows+"X"+this.layoutCols;for(var c=0;c0){return this[c+"Axis"]}else{return this.data.y.smps}}};this.drawLayoutCompartments=function(g){this.functionCaller="drawLayoutCompartments";var m=["left","right","top","bottom","x","y","offsetX","offsetY","graphType","summaryType","transformType","smpInfo","varInfo","minData","maxData","xAxisMin","xAxisMax","xAxisRange","xAxis2Min","xAxis2Max","xAxis2Range","yAxisMin","yAxisMax","yAxisRange","zAxisMin","zAxisMax","zAxisRange","xAxisAbsMin","xAxisAbsMax","xAxis2AbsMin","xAxis2AbsMax","yAxisAbsMin","yAxisAbsMax","zAxisAbsMin","zAxisAbsMax","xAxisUnit","xAxis2Unit","yAxisUnit","zAxisUnit"];var e=["weight","graphType","varIndices","smpIndices","grpIndices","varIndicesStart","smpIndicesStart","setMin","setMax","setMin2","setMax2","setMinX","setMaxX","setMinY","setMaxY","setMinZ","setMaxZ"];if(this.layoutComb){if(this.isDOE){m.push("data");this.setDOE()}this.removeEmptyCompartments();if(this.graphType.match(/Scatter/)){this.xAxisTmp=this.cloneObject(this.xAxis);this.yAxisTmp=this.cloneObject(this.yAxis);this.xAxis=this.getLayoutAxisSamples("x");this.yAxis=this.getLayoutAxisSamples("y");this.initAxes();this.xAxis=this.xAxisTmp;this.yAxis=this.yAxisTmp;this.xAxisIndices=this.getSampleIndices(this.xAxis);this.yAxisIndices=this.getSampleIndices(this.yAxis)}else{if(this.data.l&&this.data.l.group){this.groupSamples(this.data.l.group,false,false,true,true);this.meta.data.g=this.data.w;this.initAxes()}else{this.initAxes(true)}}this.setLayoutDimensions();var s=this.marginLeft+this.layoutLeft+this.layoutRight+this.marginRight;var p=this.marginTop+this.layoutTop+this.layoutBottom+this.marginBottom;this.setLayoutRestore();this.setLayoutParams();this.title="";this.subtitle="";this.offsetX=this.layoutLeft;this.offsetY=this.graphType=="Pie"?0:this.layoutTop;this.setLayoutWeights();this.setLayoutGraphTypes();this.setLayoutIndices(e);var q=0;for(var o=0;o0&&this.smpIndices.length>0){g.call(this)}for(var l=0;lthis.data.l.weight.length){a=true}}}else{if(n==0){a=true}}if(a){this.showSampleNames=this.layoutRestore.showSampleNames;this.draw1DYLayout()}}if(this.graphType!="Candlestick"){this.drawTrellisLabels(q)}}}this.offsetX+=this.layoutWidth;q++}this.offsetX=this.layoutLeft;this.offsetY+=this.layoutHeight}this.layoutCurrent=false;this.restoreLayoutParameters();if(this.isDOE){this.data=this.dataStndBy;this.graphType=this.data.l.type[0]}else{this.drawTitle();this.drawLabelsTitlesLayout();if(this.showLegend){if(this.isDOE||this.graphType!="Pie"){this.drawLegend(true)}}}if(this.meta.data.g){this.data.w=this.meta.data.g;delete (this.meta.data.g)}else{this.isGroupedData=false}}};this.restoreLayoutParameters=function(){for(var a in this.layoutRestore){this[a]=this.layoutRestore[a]}};this.setLayoutGraphDimensions=function(a,b,d){this.layoutWidth=(this.width-a)*this.layoutParams[d].weight[0];this.layoutHeight=(this.height-b)*this.layoutParams[d].weight[1];this.layoutParams[d].width=this.layoutWidth;this.layoutParams[d].height=this.layoutHeight};this.setLayoutLabels=function(a){this.layoutLabels=[];if(this.segregateSamplesBy.length>0&&this.segregateVariablesBy.length>0){this.layoutLabels.push(this.data.l.name[a][0]);this.layoutLabels.push(this.data.l.name[a][1])}else{if(this.segregateSamplesBy.length>1||this.segregateVariablesBy.length>1){this.layoutLabels.push(this.data.l.name[a][1]);this.layoutLabels.push(this.data.l.name[a][0])}else{if(this.scatterPlotMatrix){}else{this.layoutLabels.push(this.data.l.name[a])}}}};this.drawLayoutCompartmentsDOE=function(a,b,d){this.legendPosition="right";this.graphOrientation="vertical";if(d==0&&this.showDOEData){this.isShowDOEData=true;this.showLegend=this.layoutRestore.showLegend;if(this.graphType.match(/Scatter/i)){this.isHistogram=false;this.xAxis=this.configStndBy.xAxis;this.yAxis=this.configStndBy.yAxis;this.xAxisTitle=this.configStndBy.xAxisTitle;this.yAxisTitle=this.configStndBy.yAxisTitle;this.initAxes();this.initializeData(this.dataStndBy);this.varIndices=this.dataStndBy.l.doe}else{this.initializeData(this.dataStndBy);this.smpIndices=this.dataStndBy.l.doe}this.showLegend=false;if(this.graphType=="Scatter3D"){this.draw3DPlot()}else{if(this.graphType.match(/Scatter/i)){this.draw2DPlot()}else{this.plotByVariable=this.configStndBy.plotByVariable;if(this.configStndBy.groupingFactors.length>0){this.isGroupedData=true;if(this.dataStndBy.y.smps.length!=this.smpIndices.length){this.layoutComb=false;this.groupSamples(this.configStndBy.groupingFactors,false,false,true,true);this.layoutComb=true}this.draw1DPlot();this.isGroupedData=false;this.groupingFactors=[]}else{this.draw1DPlot()}this.plotByVariable=false}}this.showLegend=true;this.isShowDOEData=false}else{this.drawDOELabelsLayout(this.dataStndBy.l.smps[d][0]);this.top=5;this.bottom=5;this.right=5;this.left=5;if(this.dataStndBy.l.type[d]=="Pie"){this.showLegend=true;this.createPie(this.dataStndBy.l.smps[d][0]);this.graphType="Pie";this.layoutCurrentDOE=this.dataStndBy.l.smps[d][0];this.legendBox=false;this.drawPiePlot()}else{if(this.dataStndBy.l.type[d]=="Treemap"){this.createTreemap(this.dataStndBy.l.smps[d][0]);this.graphType="Treemap";this.draw1DPlot()}else{if(this.dataStndBy.l.type[d]=="Scatter2D"){this.createHistogram(this.dataStndBy.l.smps[d][0]);this.graphType="Scatter2D";this.initAxes();this.showLegend=false;this.xAxisTitle="";this.yAxisTitle="";this.draw2DPlot()}}}}};this.drawLayoutCompartmentsScatter=function(a,e,d,b,f){if(this.segregateVariablesBy.length&&this.segregateSamplesBy.length){this.xAxis=[this.data.l.smps[Math.floor(f/this.data.l.smps.length)][0]];this.yAxis=[this.data.l.smps[Math.floor(f/this.data.l.smps.length)][1]];this.xAxisIndices=this.getSampleIndices(this.xAxis);this.yAxisIndices=this.getSampleIndices(this.yAxis);this.setLayoutLabels(f)}else{if(this.data.l.smps&&this.data.l.smps[f].xAxis&&this.data.l.smps[f].yAxis){this.xAxis=this.data.l.smps[f].xAxis;this.yAxis=this.data.l.smps[f].yAxis;this.xAxisIndices=this.getSampleIndices(this.xAxis);this.yAxisIndices=this.getSampleIndices(this.yAxis)}else{if(!this.scatterPlotMatrix&&this.data.l.smps&&this.data.l.smps[f]){this.xAxis=[this.data.l.smps[f][0]];this.yAxis=[this.data.l.smps[f][1]];this.xAxisIndices=this.getSampleIndices(this.xAxis);this.yAxisIndices=this.getSampleIndices(this.yAxis);this.setLayoutLabels(f)}else{if(this.data.l.vars&&this.data.l.vars[f]){this.setLayoutLabels(f)}else{this.xAxis=false;this.yAxis=false;this.xAxisIndices=false;this.yAxisIndices=false}}}}if(this.layoutAdjust&&this.xAxis&&this.yAxis){this.initAxes();this.layoutAxis=3}else{this.layoutAxis=b==0?2:0;this.layoutAxis=d==this.layoutRows&&this.layoutAxis?3:d==this.layoutRows?1:0}if(this.data.l.reg){if(this.data.l.reg[f]){if(this.decorations){delete (this.decorations)}this.addRegressionDecoration(this.data.l.reg[f].reg,this.data.l.reg[f].lab,this.data.l.reg[f].col)}}this.showLegend=false;this.legendInside=true;this.showDecorationsLegend=true;this.xAxisTitle="";this.yAxisTitle="";if(!this.layoutAdjust){this.xAxisShow=false;this.yAxisShow=false;this.xAxisS2Show=false;this.yAxisS2Show=false;if(d==0&&b%2>0){this.xAxisS2Show=true}if(d==this.layoutRows-1&&b%2==0){this.xAxisShow=true}if(b==0&&d%2>0){this.yAxisShow=true}if(b==this.layoutCols-1&&d%2==0){this.yAxisS2Show=true}}};this.drawLayoutCompartmentsPie=function(a,b,d){this.smpIndices=[this.getSampleIndices(this.data.l.smps[d])];this.showLegend=true};this.drawLayoutCompartmentsOneD=function(b,d,e){if(this.graphType=="Candlestick"){this.xAxisShow=true;this.xAxis2Show=true;this.xAxisTitle=true;this.xAxis2Title=true;if(e==1){this.summaryType="volume";if(this.showVolume){this.showSampleNames=true}}else{this.summaryType="candle";this.showSampleNames=false}}else{this.showLegend=false;this.showOverlays=true;this.isGroupedData=false;this.xAxisTitle=false;this.xAxis2Title=false;this.smpTitle=false;this.adjustAspectRatioXTries=0;this.adjustAspectRatioYTries=0;this.setLayoutLabels(e);if(this.varIndices.length>0&&this.smpIndices.length>0){if(this.data.l.group){var a=this.layoutParams[e].dragged?this.layoutParams[e].grpIndices:false;this.groupSamples(this.data.l.group,false,a,true,true,true);this.layoutParams[e].grpIndices=this.grpIndices;if(this.colorBy&&this.isInArray(this.colorBy,this.groupingFactors)&&this.layoutRestore.showLegend){}if(this.data.w.smps.length==1&&this.graphType!="Heatmap"&&this.isInArray(this.data.l.group,this.segregateSamplesBy)){this.showSampleNames=false}}else{if(this.smpIndices.length==1&&this.graphType!="Heatmap"){}}if(this.segregateVariablesBy.length>0&&this.graphType!="Heatmap"){this.showSampleNames=false}if(this.layoutAdjust){this.layoutAxis=3;if(this.varIndices.length>0&&this.smpIndices.length>0){this.initAxes()}}else{if(this.graphOrientation=="vertical"){this.xAxisShowLayout=!(e%this.layoutCols)?true:false}else{this.xAxisShowLayout=e=this.layoutCols*(this.layoutRows-1)?true:false}this.xAxisShow=false;this.xAxis2Show=false}}}};this.drawTrellisLabels=function(j){this.functionCaller="drawTrellisLabels";if(this.layoutValid){var e=this.layoutCollapse?this.marginLeft+this.offsetX:this.marginLeft+this.offsetX+this.margin;var o=this.marginTop+this.offsetY;var k=this.layoutWidth;var d=k/2;var g=this.getFontHeight()+(this.margin*2);var b=g/2;var a=this.layoutHeight-((this.layoutLabels.length*g)+(this.margin*(this.layoutCollapse?0:1)));if(j>=this.layoutCols){if(this.graphOrientation!="vertical"&&this.graphType!="Heatmap"&&!this.layoutAdjust&&!this.graphType.match(/Scatter/)){a-=this.getAxisTitleTickLength()}else{if(this.graphType.match(/Scatter/)&&(this.segregateVariablesBy.length||this.segregateSamplesBy.length)){}}}if(!this.layoutCollapse){if(this.layoutAdjust){k=this.x;e+=this.left-this.margin;d=k/2;a=this.y}else{k-=(this.graphType.match(/Scatter/)&&(this.segregateVariablesBy.length||this.segregateSamplesBy.length)?this.margin:this.margin*2)}}for(var f=0;fs?s:a.length;if(a.length>s){k.rawMenu=a;k.rawMenuIndex=0;this.addMenuItemScroller(k,"Top")}for(var r=0;rs){this.addMenuItemScroller(k,"Bottom")}}return o};this.pageMenuItem=function(e,f){var g,j,a,i;var h=e.rawMenuMatch||e.rawMenu;if(h){var d=e.childNodes.length-2;if(f=="Top"&&e.rawMenuIndex>0){g=e.childNodes[e.childNodes.length-2];j=h[e.rawMenuIndex-1];a=e.childNodes[2];i=true;e.rawMenuIndex--}else{if(f=="Bottom"&&h.length>(e.rawMenuIndex+d)){g=e.childNodes[2];j=h[e.rawMenuIndex+d];a=e.childNodes[e.childNodes.length-1];i=true;e.rawMenuIndex++}}if(i){this.addRemoveItemListeners("removeEvtListener",g);g.parentNode.removeChild(g);if(j[0]=="-"){this.addMenuItemSep(e,a)}else{if(j[0]=="-text-"){this.addMenuItemText(j,e,a)}else{if(j[0]=="-color-"){this.addMenuItemColor(j,e,a)}else{if(j[0]=="-slider-"){this.addMenuItemSlider(j,e,a)}else{if(j[0]=="-filter-"){this.addMenuItemFilter(j,e,a)}else{this.addMenuItem(j,e,a)}}}}}}}};this.filterScrollSearch=function(b){var k=this.$(b);if(k){var c=k.value;var n=new RegExp(k.value,"i");var h=k.parentNode.parentNode;var j=h.rawMenu;var f=[];for(var e=0;e0){var d=h.childNodes[0];this.addRemoveItemListeners("removeEvtListener",d);h.removeChild(d)}var m=this.maxSubMenus;var g=f.length>m?m:f.length;h.rawMenuIndex=0;var a=this.addMenuItemScroller(h,"Top",c);for(var e=0;e0){var a=c.shift();if(b[a]){b=b[a]}else{return""}}return b!=null?b:""}else{return this[d[2][0]]||""}};this.addMenuItem=function(e,p,m){var k=this.newId("-cX-List-Item-");var g=this.$cX("li",{id:k,className:"CanvasXpressListItem",click:e[2],params:e[3]||[],upload:e[0]&&e[0]=="Load"?true:false,uploadParams:e[0]&&e[0]=="Load Parameters"?true:false});var n;var d={cursor:"grab",cursor:"-moz-grab",cursor:"-webkit-grab"};var t=false;if(e[5]){n=this.$cX("a",{id:this.newId("-cX-List-Item-A-"),className:"CanvasXpressListItemAArrow",hidefocus:"true",unselectable:"on",href:"#",menu:k,menuId:"false",menuFunc:e[5],menuParm:e[6],draggable:false},d);t=true}else{n=this.$cX("a",{id:this.newId("-cX-List-Item-A-"),className:"CanvasXpressListItemA",hidefocus:"true",unselectable:"on",href:"#",menuFunc:e[2],menuParm:e[3],draggable:false})}var h=this.$cX("img",{id:this.newId("-cX-List-Icon-"),className:"CanvasXpressListIcon",src:e[1]&&CanvasXpress.images[e[1]]?CanvasXpress.images[e[1]]:CanvasXpress.images.canvasXpress,key:e[1]});var r;if(e[0]&&(e[0]=="Load"||e[0]=="Load Parameters")){r=this.$cX("span",{id:this.newId("-cX-List-Item-Text-"),className:"CanvasXpressListItemText",draggable:false},{marginRight:0});var j=this.$cX("input",{id:this.newId("-cX-List-Item-Text-File-Upload"),className:"CanvasXpressListItemText",type:"file",draggable:false},{color:"transparent",width:"100px"});r.appendChild(j)}else{r=this.$cX("span",{id:this.newId("-cX-List-Item-Text-"),className:"CanvasXpressListItemText",innerHTML:e[0]||"",draggable:false},t?d:false)}var c=this.$cX("span",{className:"CanvasXpressListItemTextShort",innerHTML:e[4]||"",draggable:false});n.appendChild(h);n.appendChild(r);n.appendChild(c);g.appendChild(n);if(m){m.parentNode.insertBefore(g,m)}else{p.appendChild(g)}this.addRemoveItemListeners("addEvtListener",g)};this.addMenuItemText=function(c,m,j){var h=this.newId("-cX-List-Item-Text-");var f=this.newId("-cX-List-Item-Text-Input-");var d=this.getMenuItemValue(c);var e=this.$cX("li",{id:h,className:"CanvasXpressListItem",click:c[1],params:[c[2],f]});var n=this.$cX("input",{id:f,className:"CanvasXpressList",type:"text",value:d},{paddingLeft:"3px",width:"200px"});var k=this.$cX("a",{id:this.newId("-cX-List-Text-Item-A-"),className:"CanvasXpressListItemA",hidefocus:"true",unselectable:"on",href:"#"});var g=this.$cX("img",{id:this.newId("-cX-List-Text-Icon-"),className:"CanvasXpressListIcon",src:CanvasXpress.images.refresh,key:"refreshForm"},{marginTop:"4px"});k.appendChild(g);k.appendChild(n);e.appendChild(k);if(j){j.parentNode.insertBefore(e,j)}else{m.appendChild(e)}this.addRemoveItemListeners("addEvtListener",e)};this.addMenuItemColor=function(E,v,L){var m=this.newId("-cX-List-Item-Color-");var n=this.newId("-cX-List-Item-Color-Container-");var g=this.newId("-cX-List-Item-Color-Current-");var B=this.newId("-cX-List-Item-Color-Palete-");var f=this.newId("-cX-List-Item-Color-Palete-Current-");var k=this.newId("-cX-List-Item-Color-Saturation-");var w=this.newId("-cX-List-Item-Color-Saturation-Current-");var N=this[E[2][0]]||"";var G=this.$cX("li",{id:m,className:"CanvasXpressListItem",click:E[1],params:[E[2],g],palete:B,paleteCurrent:f,colorCurrent:g,saturation:k,saturationCurrent:w});var M=this.$cX("a",{id:this.newId("-cX-List-Color-Item-A-"),className:"CanvasXpressListItemA",hidefocus:"true",unselectable:"on",href:"#"},{height:"140px",width:"250px"});var I=this.$cX("img",{id:this.newId("-cX-List-Color-Icon-"),className:"CanvasXpressListIcon",src:CanvasXpress.images.refresh,key:"refreshForm"},{marginTop:"2px"});var J=N?this.rgbToHex(this.validateColor(N.replace(/[\'\"]/g,""))):this.foreground;this.colorRGBfromString(J);var t=Math.round(this.colorHSV[0]/6*180);var r=Math.round((1-this.colorHSV[1])*100);var q=Math.round((1-this.colorHSV[2])*100);var K=this.$cX("div",{id:n},{width:"188px",height:"138px",cssFloat:"left"});var C=this.$cX("div",{id:g,parentItem:m,className:"CanvasXpressConfiguratorColor",value:N},{width:"203px",height:"24px",cssFloat:"left",marginBottom:"5px",cursor:"default",lineHeight:"24px"});var D=this.$cX("div",{id:B,parentItem:m,className:"CanvasXpressConfiguratorColorMain"},{position:"relative",left:"0px",top:"0px",width:"181px",height:"101px"});var d=this.$cX("div",{id:f,parentItem:m,className:"CanvasXpressConfiguratorColorExtra"},{position:"relative",left:(t-7)+"px",top:(r-7)+"px",width:"195px",height:"115px"});D.appendChild(d);var A=this.$cX("div",{id:k,parentItem:m,className:"CanvasXpressConfiguratorColor"},{position:"relative",left:"188px",top:"-102px",width:"15px",height:"100px",border:"1px solid rgb(51,122,183)",clear:"left",cursor:"crosshair"});for(var H=0;H<100;H+=4){var F=this.$cX("div",false,{height:"4px",position:"relative",left:"0px",cursor:"crosshair"});A.appendChild(F)}var e=this.$cX("div",{id:w,parentItem:m,className:"CanvasXpressConfiguratorColorExtra"},{position:"relative",left:"0px",top:(q-108)+"px",width:"29px",height:"115px"});A.appendChild(e);K.appendChild(C);K.appendChild(D);K.appendChild(A);M.appendChild(I);M.appendChild(K);G.appendChild(M);if(L){L.parentNode.insertBefore(G,L)}else{v.appendChild(G)}this.colorizeCurrentItemColor(G);this.colorizeSaturationItemColor(G);this.addRemoveItemListeners("addEvtListener",G)};this.colorizeCurrentItemColor=function(a){var e=this.$(a.colorCurrent);if(e){var d=this.colorRGBToString();var b=this.hexToRgb("#"+d);e.style.backgroundColor="#"+d;e.innerHTML="  "+b;e.style.color=this.complementaryColor(b,true);e.value=b}};this.colorizeSaturationItemColor=function(a){var d=function(m,k,c,j,h){return"rgb("+(m*(1-j/h)*100)+"%,"+(k*(1-j/h)*100)+"%,"+(c*(1-j/h)*100)+"%)"};var f=this.$(a.saturation);if(f&&this.colorHSV){var g=f.childNodes;var b=this.hsvFromRgb(this.colorHSV[0],this.colorHSV[1],1);if(b){for(var e=0;e0?this.binConfigurations[K]["bins"][B-1]["value"]:this.binConfigurations[K]["min"]);var A=Number(B0){this.removeImageFromToolbar(b[0].id,true)}}};this.clickMenuItem=function(a){return function(h){if(!h){h=window.event}a.cancelEvent(h);var b=a.getTargetEvent(h);var m=a.getMenuItemComp(h);if(m&&!/input|textarea|select/i.test(b.tagName)){if(m[0].className.match(/Scroll/)||m[1].className.match(/Scroll/)){var c=m[0].className.match(/Scroll/)?m[0]:m[1];var n=c.parentNode;var j=c.className.match(/ScrollTop/)?"Top":"Bottom";a.pageMenuItem(n,j)}else{var f=[];if(m[0].params){for(var g=0;ga){g=p.offsetLeft-v+5}x=p.offsetTop+o.offsetTop}else{g=f.offsetLeft;x=f.offsetTop}f.style.left=g+"px";f.style.top=x+"px"};this.mouseoverMenuItem=function(a){return function(j){if(!j){j=window.event}var h=a.getMenuItemComp(j);if(!h){return false}if(h[0].className.match(/Scroll/)||h[1].className.match(/Scroll/)){var n=h[0].className.match(/Scroll/)?h[0]:h[1];n.className+="Active";return false}var f=h[2].firstChild.childNodes;a.hideMenusRecursively(f);h[0].className="CanvasXpressListItemActive";if(h[1].menu){var l=a[h[1].menuFunc].apply(a,h[1].menuParm);var g=a.addMenu(false,l,h[1].menu);var b=a.$(g);var k=h[2];b.style.left="0px";b.style.top="0px";b.style.display="block";a.adjustMenuItemPosition(b,k,h[1]);h[1].className="CanvasXpressListItemAArrowActive";h[1].menuId=g}else{h[1].className="CanvasXpressListItemAActive"}return false}}(this);this.mouseoutMenuItem=function(a){return function(z){if(!z){z=window.event}if(a.fastScrollMenuOn){a.fastScrollMenuOn=false;clearInterval(a.fastScrollMenu)}var w,v,u,s,i,h,g,c;var B=a.adjustedCoordinates(z);if(B){var k=a.$("north-container-"+a.target);var l=a.$("west-container-"+a.target);B.x+=l.offsetWidth;B.y+=k.offsetHeight;var o=a.getMenuItemComp(z);if(!o){return false}else{if(o[1]&&o[1].menu){var p=a.$(o[1].menuId);var x=p.firstChild.firstChild;w=p.offsetLeft;i=p.offsetTop;v=w+p.offsetWidth;h=i+p.offsetHeight;if(B.x>=w&&B.x<=v&&B.y>=i&&B.y<=h){return false}a.hideMenu(o,p);if(x&&x.type=="filter"){var A=x.firstChild;if(A.type=="string"){var r=a.$(a.target+":"+x.selector+":cX-DataFilterMask");if(r){a.addRemoveStringDataFilterListeners("removeEvtListener",r)}}else{var q=a.$(a.target+":"+x.selector+":cX-DataFilterMin");var n=a.$(a.target+":"+x.selector+":cX-DataFilterMinLabel");var j=a.$(a.target+":"+x.selector+":cX-DataFilterRange");var t=a.$(a.target+":"+x.selector+":cX-DataFilterMax");var y=a.$(a.target+":"+x.selector+":cX-DataFilterMaxLabel");var b=a.$(a.target+":"+x.selector+":cX-DataFilterScale");if(q&&n&&j&&t&&y&&b){a.addRemoveNumericDataFilterListeners("removeEvtListener",q,t,n,y,b)}}}}else{a.hideMenu(o)}}}return false}}(this);this.mousedownMenuItemColor=function(a){return function(d){if(!d){d=window.event}var b=a.getTargetEvent(d);var c=a.getMenuItemComp(d);if(!c){return false}else{if(b.id&&b.id.match(/-cX-List-Item-Color-Palete-/)){a.changingColorItemOn="palette";if(a.colorHSV[2]==0){a.colorFromHsv(null,null,1);a.colorizeCurrentItemColor(c[0]);var f=a.$(c[0].saturationCurrent);if(f){f.style.top="-108px"}}a.updateColorItemValue(c[0],d);a.colorizeSaturationItemColor(c[0])}else{if(b.parentNode.id&&b.parentNode.id.match(/-cX-List-Item-Color-Saturation-/)){a.changingColorItemOn="saturation";a.updateColorItemValue(c[0],d)}}}a.cancelEvent(d);return false}}(this);this.mousedownMenuItemSlider=function(a){return function(b){if(!b){b=window.event}a.changingSliderItemOn=a.getTargetEvent(b);return false}}(this);this.mousedownMenuItem=function(a){return function(b){if(!b){b=window.event}a.fastScrollMenuOn=true;a.fastScrollMenu=a.setInterval(function(){a.clickMenuItem(b)},100);return false}}(this);this.mouseupMenuItem=function(a){return function(b){if(!b){b=window.event}if(a.fastScrollMenuOn){a.fastScrollMenuOn=false;clearInterval(a.fastScrollMenu)}}}(this);this.mousewheelMenuItem=function(a){return function(g){if(!g){g=window.event}a.cancelEvent(g);var h=0;if(g.wheelDelta){h=g.wheelDelta;if(window.opera){h=-h}}else{if(g.detail){h=-g.detail}}if(h){var b=a.getTargetEvent(g);var f=a.getMenuItemComp(g);if(!f){return false}var c=f[0].parentNode;if(h>0){a.pageMenuItem(c,"Top")}else{a.pageMenuItem(c,"Bottom")}}return false}}(this);this.getMenuItemComp=function(b){var a=this.getTargetEvent(b);while(a&&a.tagName&&!a.tagName.match(/li/i)){a=a.parentNode}return a.parentNode&&a.parentNode.parentNode?[a,a.firstChild,a.parentNode.parentNode]:false};this.hideMenu=function(e,f){if(e){if(e[0].className.match(/Scroll/)||e[1].className.match(/Scroll/)){var g=e[0].className.match(/Scroll/)?e[0]:e[1];g.className=g.className.replace("Active","")}else{if(e[1].menu){e[1].className="CanvasXpressListItemAArrow"}else{e[1].className="CanvasXpressListItemA"}e[0].className="CanvasXpressListItem"}}if(f){var b=f.firstChild.childNodes;for(var d=0;d0){for(g in this.meta.ids){if(g.match(/cX-Menu-|cX-Menu/)){delete (this.meta.ids[g])}}for(var g=0;g0){var f={};for(var g=0;g1){b.push(["Variable Space","spacing",false,false,false,"getPlotAreaOneVariableSpaceMenu",[]])}b.push(["Sample Width","thickness",false,false,false,"getPlotAreaOneSampleWidthMenu",[]]);return b};this.getPlotAreaScatterMenu=function(){var b=[];b.push(["Axis Algorithm",this.graphType=="Scatter3D"||this.is3DPlot?"xyz":"xy",false,false,false,"getPlotAreaAxisAlgorithmMenu",[]]);b.push(["Error Bars","errorBars",false,false,false,"getPlotAreaErrorBarsMenu",[]]);b.push(["Border Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","plotBoxColor"]]);b.push([this.plotBox?"Hide Border":"Show Border",this.plotBox?"eyeClosed":"eye2","toggleAttribute",["plotBox"]]);return b};this.getAxesTitleXMenu=function(){return[["Text","normal",false,false,false,"changeTextColorAttributeMenu",["-text-","xAxisTitle"]]]};this.getAxesTitleX2Menu=function(){return[["Text","normal",false,false,false,"changeTextColorAttributeMenu",["-text-","xAxis2Title"]]]};this.getAxesTitleYMenu=function(){return[["Text","normal",false,false,false,"changeTextColorAttributeMenu",["-text-","yAxisTitle"]]]};this.getAxesTitleZMenu=function(){return[["Text","normal",false,false,false,"changeTextColorAttributeMenu",["-text-","zAxisTitle"]]]};this.getAxesTitleMenu=function(){var a=[];if(this.graphType.match(/scatter/i)||this.is3DPlot){if(this.graphType=="Scatter3D"||this.is3DPlot){a.push(["X-Axis","axes3DTitleX",false,false,false,"getAxesTitleXMenu",[]]);a.push(["Y-Axis","axes3DTitleY",false,false,false,"getAxesTitleYMenu",[]]);a.push(["Z-Axis","axes3DTitleZ",false,false,false,"getAxesTitleZMenu",[]])}else{a.push(["X-Axis","axes2DTitleX",false,false,false,"getAxesTitleXMenu",[]]);a.push(["Y-Axis","axes3DTitleY",false,false,false,"getAxesTitleYMenu",[]])}}else{if(this.graphType.match(/BarLine|DotLine|AreaLine|StackedLine|StackedPercentLine/)){a.push(["First Axis","axes1DTitleFirst",false,false,false,"getAxesTitleXMenu",[]]);a.push(["Second Axis","axes1DTitleSecond",false,false,false,"getAxesTitleX2Menu",[]])}else{a.push(["Text","normal",false,false,false,"changeTextColorAttributeMenu",["-text-","xAxisTitle"]])}}a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","axisTitleColor"]]);a.push(["Font","font",false,false,false,"getFontStyleMenu",["axisTitle"]]);return a};this.getTitleMenu=function(){var a=[];a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","titleColor"]]);a.push(["Font","font",false,false,false,"getFontStyleMenu",["title"]]);a.push(["Text","normal",false,false,false,"changeTextColorAttributeMenu",["-text-","title"]]);return a};this.getSubtitleMenu=function(){var a=[];a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","subtitleColor"]]);a.push(["Font","font",false,false,false,"getFontStyleMenu",["subtitle"]]);a.push(["Text","normal",false,false,false,"changeTextColorAttributeMenu",["-text-","subtitle"]]);return a};this.getTitleSubtitleMenu=function(){var a=[];if(this.graphType.match(/scatter/i)||this.is3DPlot){a.push(["Title","mainScatterTitle",false,false,false,"getTitleMenu",[]]);a.push(["Subtitle","mainScatterSubtitle",false,false,false,"getSubtitleMenu",[]])}else{a.push(["Title",this.graphType=="Heatmap"?"mainHeatmapTitle":"main1DTitle",false,false,false,"getTitleMenu",[]]);a.push(["Subtitle",this.graphType=="Heatmap"?"mainHeatmapSubtitle":"main1DSubtitle",false,false,false,"getSubtitleMenu",[]])}return a};this.getLegendLocationMenu=function(){var a=[];a.push(["Inside Plot","toInside","changeAttribute",["legendInside",true]]);a.push(["Outside Plot","toOutside","changeAttribute",["legendInside",false]]);return a};this.getLegendPositionMenu=function(){var a=[];if(this.legendInside){a.push(["Top","top","changeAttribute",["legendPosition","top"]]);a.push(["Top Right","topRight","changeAttribute",["legendPosition","topRight"]]);a.push(["Right","right","changeAttribute",["legendPosition","right"]]);a.push(["Bottom Right","bottomRight","changeAttribute",["legendPosition","bottomRight"]]);a.push(["Bottom","bottom","changeAttribute",["legendPosition","bottom"]]);a.push(["Bottom Left","bottomLeft","changeAttribute",["legendPosition","bottomLeft"]]);a.push(["Left","left","changeAttribute",["legendPosition","left"]]);a.push(["Top Left","topLeft","changeAttribute",["legendPosition","topLeft"]])}else{a.push(["Bottom","bottom","changeAttribute",["legendPosition","bottom"]]);a.push(["Right","right","changeAttribute",["legendPosition","right"]])}return a};this.getLegendBorderMenu=function(){var a=[];a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","legendBoxColor"]]);a.push([this.legendBox?"Hide Border":"Show Border",this.legendBox?"eyeClosed":"eye2","toggleAttribute",["legendBox"]]);return a};this.getLegendMenu=function(){var a=[];a.push(["Border","square",false,false,false,"getLegendBorderMenu",[]]);a.push(["Background","background",false,false,false,"changeTextColorAttributeMenu",["-color-","legendBackgroundColor"]]);a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","legendColor"]]);a.push(["Font","font",false,false,false,"getFontStyleMenu",["legend"]]);if(this.graphType!="Network"){a.push(["Position",this.legendInside?"toLocation2":"toLocation3",false,false,false,"getLegendPositionMenu",[]]);a.push(["Location","toLocation",false,false,false,"getLegendLocationMenu",[]])}a.push(["Columns","hash",false,false,false,"changeTextColorAttributeMenu",["-text-","legendColumns"]]);if(this.graphType!="Network"){a.push(["Reset Positions","refresh","resetLegendPosition"])}a.push([this.showLegend?"Hide Legend":"Show Legend",this.showLegend?"eyeClosed":"eye2","toggleAttribute",["showLegend"]]);return a};this.getIndicatorPositionMenu=function(){var a=[];a.push(["Right","right","changeAttribute",["heatmapIndicatorPosition","right"]]);a.push(["Top Right","topRight","changeAttribute",["heatmapIndicatorPosition","topRight"]]);a.push(["Top","top","changeAttribute",["heatmapIndicatorPosition","top"]]);a.push(["Top Left","topLeft","changeAttribute",["heatmapIndicatorPosition","topLeft"]]);return a};this.getIndicatorMenu=function(){var a=[];a.push(["Position","toLocation2",false,false,false,"getIndicatorPositionMenu",[]]);a.push(["Height","heightness",false,false,false,"changeTextColorAttributeMenu",["-text-","heatmapIndicatorHeight"]]);a.push(["Width","thickness",false,false,false,"changeTextColorAttributeMenu",["-text-","heatmapIndicatorWidth"]]);a.push(["Histogram","indicatorHistogram","toggleAttribute",["heatmapIndicatorHistogram"]]);a.push([this.showHeatmapIndicator?"Hide Indicator":"Show Indicator",this.showHeatmapIndicator?"eyeClosed":"eye2","toggleAttribute",["showHeatmapIndicator"]]);return a};this.getDecorationsBorderMenu=function(){var a=[];a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","decorationsBoxColor"]]);a.push([this.decorationsBox?"Hide Border":"Show Border",this.decorationsBox?"eyeClosed":"eye2","toggleAttribute",["decorationsBox"]]);return a};this.getDecorationsPositionMenu=function(){var a=[];if(this.legendInside){a.push(["Top","top","changeAttribute",["decorationsPosition","top"]]);a.push(["Top Right","topRight","changeAttribute",["decorationsPosition","topRight"]]);a.push(["Right","right","changeAttribute",["decorationsPosition","right"]]);a.push(["Bottom Right","bottomRight","changeAttribute",["decorationsPosition","bottomRight"]]);a.push(["Bottom","bottom","changeAttribute",["decorationsPosition","bottom"]]);a.push(["Bottom Left","bottomLeft","changeAttribute",["decorationsPosition","bottomLeft"]]);a.push(["Left","left","changeAttribute",["decorationsPosition","left"]]);a.push(["Top Left","topLeft","changeAttribute",["decorationsPosition","topLeft"]])}else{a.push(["Bottom","bottom","changeAttribute",["decorationsPosition","bottom"]]);a.push(["Right","right","changeAttribute",["decorationsPosition","right"]])}return a};this.getDecorationsDataMenu=function(){return[[this.showDecorations?"Hide Decorations":"Show Decorations",this.showDecorations?"eyeClosed":"eye2","toggleAttribute",["showDecorations"]]]};this.getDecorationsLegendMenu=function(){return[[this.showDecorationsLegend?"Hide Decorations Legend":"Show Decorations Legend",this.showDecorationsLegend?"eyeClosed":"eye2","toggleAttribute",["showDecorationsLegend"]]]};this.getDecorationsConfidenceIntervalsMenu=function(){var a=this.decorations.reg?"confidence":"kaplanMeyerConfidence";return[[this[a]?"Hide Confidence Intervals":"Show Confidence Intervals",this[a]?"eyeClosed":"eye2","toggleAttribute",[a]]]};this.getDecorationsMenu=function(){var b=this.decorations;var a=[];a.push(["Border","square",false,false,false,"getDecorationsBorderMenu",[]]);a.push(["Background","background",false,false,false,"changeTextColorAttributeMenu",["-color-","decorationsBackgroundColor"]]);a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","decorationsColor"]]);a.push(["Font","font",false,false,false,"getFontStyleMenu",["decoration"]]);a.push(["Position",this.legendInside?"toInside":"toLocation2",false,false,false,"getDecorationsPositionMenu",[]]);a.push(["Data and Legend","database",false,false,false,"getDecorationsDataMenu",[]]);a.push(["Legend","legendScatter",false,false,false,"getDecorationsLegendMenu",[]]);if(b.reg||b.kaplanMeier){a.push(["Confidence Intervals",b.reg?"confidence":"kaplanMeyerConfidence",false,false,false,"getDecorationsConfidenceIntervalsMenu",[]])}return a};this.getOverlaysMemebersMenu=function(g,b){var f=[];var e={};for(var a=0;a1){a.push(["Scatter 2D","scatter2D","changeAttribute",["graphType","Scatter2D"],"Shit + Alt + 2"])}if(this.data.y.smps.length>2){a.push(["Scatter Bubble 2D","scatter2DBubble","changeAttribute",["graphType","ScatterBubble2D"],"Shit + Alt + 4"]);a.push(["Scatter 3D","scatter3D","changeAttribute",["graphType","Scatter3D"],"Shit + Alt + 3"])}a.push(["Stacked","stackedGraph","changeAttribute",["graphType","Stacked"],"Shit + Alt + S"]);a.push(["Stacked Line","stackedLineGraph","changeAttribute",["graphType","StackedLine"],"Shit + Alt + U"]);a.push(["Stacked Percent","stackedPercentage","changeAttribute",["graphType","StackedPercent"],"Shit + Alt + T"]);a.push(["Stacked Percent Line","stackedPercentageLine","changeAttribute",["graphType","StackedPercentLine"],"Shit + Alt + W"]);a.push(["Tag Cloud","wordCloud","changeAttribute",["graphType","TagCloud"]]);a.push(["Parallel Coordinates","lineGraph","changeAttribute",["graphType","ParallelCoordinates"]]);a.push(["Sankey","sankeyDiagram","changeAttribute",["graphType","Sankey"]]);a.push(["Tree","treeGraph","changeAttribute",["graphType","Tree"]]);a.push(["Treemap","treemapGraph","changeAttribute",["graphType","Treemap"]]);return a};this.getGraphOrientationMenu=function(){var a=[];a.push(["Horizontal","graphOrientationHorizontal","changeAttribute",["graphOrientation","horizontal"]]);a.push(["Vertical","graphOrientationVertical","changeAttribute",["graphOrientation","vertical"]]);return a};this.getMarginsMenu=function(){var a=[];a.push(["Global","margins",false,false,false,"changeTextColorAttributeMenu",["-text-","margin"]]);a.push(["-"]);a.push(["Bottom","marginBottom",false,false,false,"changeTextColorAttributeMenu",["-text-","marginBottom"]]);a.push(["Left","marginLeft",false,false,false,"changeTextColorAttributeMenu",["-text-","marginLeft"]]);a.push(["Top","marginTop",false,false,false,"changeTextColorAttributeMenu",["-text-","marginTop"]]);a.push(["Right","marginRight",false,false,false,"changeTextColorAttributeMenu",["-text-","marginRight"]]);return a};this.getShadesMenu=function(){var a=[];a.push(["Objects","shadow","toggleAttribute",["showShadow"]]);a.push(["Text","shadowText","toggleAttribute",["showTextShadow"]]);a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","shadowColor"]]);a.push(["More","more","showConfiguratorCategory",["event","Shadows"]]);return a};this.getCanvasBorderMenu=function(){var a=[];a.push(["Color","colors",false,false,false,"changeTextColorAttributeMenu",["-color-","canvasBoxColor"]]);a.push([this.canvasBox?"Hide Border":"Show Border",this.canvasBox?"eyeClosed":"eye2","toggleAttribute",["canvasBox"]]);return a};this.getGradientsOrientationMenu=function(){var a=[];a.push(["Horizontal","gradientHorizontalLeft","changeAttribute",["gradientOrientation","horizontal"]]);a.push(["Vertical","gradientVerticalTop","changeAttribute",["gradientOrientation","vertical"]]);return a};this.getGradientsTypeMenu=function(){var a=[];a.push(["Linear","gradientVerticalTop","changeAttribute",["gradientType","linear"]]);a.push(["Radial","gradientRadial","changeAttribute",["gradientType","radial"]]);return a};this.getGradientsMenu=function(){var a=[];a.push(["Gradient","gradientToggle","toggleAttribute",["gradient"]]);a.push(["Orientation","gradientOrientation",false,false,false,"getGradientsOrientationMenu",[]]);a.push(["Type","gradientType",false,false,false,"getGradientsTypeMenu",[]]);a.push(["-"]);a.push(["More","more","showConfiguratorCategory",["event","Gradients"]]);return a};this.getBackgroundTypeMenu=function(){var a=[];a.push(["Solid","background","changeAttribute",["backgroundType","solid","solid"]]);a.push(["Gradient","background3","changeAttribute",["backgroundType","gradient","gradient"]]);a.push(["Solid Window","background2","changeAttribute",["backgroundType","window","window"]]);a.push(["Solid Window on Gradient","background5","changeAttribute",["backgroundType","windowGradient","windowGradient"]]);a.push(["Gradient Window on Solid","background4","changeAttribute",["backgroundType","windowSolidGradient","windowSolidGradient"]]);return a};this.getBackgroundMenu=function(){var a=[];a.push(["Type","backgroundType",false,false,false,"getBackgroundTypeMenu",[]]);a.push(["-"]);a.push(["Background Color","background",false,false,false,"changeTextColorAttributeMenu",["-color-","background"]]);a.push(["Window Color","background2",false,false,false,"changeTextColorAttributeMenu",["-color-","backgroundWindow"]]);a.push(["Gradient Start Color","gradientVerticalTop",false,false,false,"changeTextColorAttributeMenu",["-color-","backgroundGradient1Color"]]);a.push(["Gradient End Color","gradientVerticalBottom",false,false,false,"changeTextColorAttributeMenu",["-color-","backgroundGradient2Color"]]);a.push(["-"]);a.push(["More","more","showConfiguratorCategory",["event","Background"]]);return a};this.getFontsSizeStyleMenu=function(){var a=[];a.push(["Bigger","increaseFontSize","setFontAttributeSize",["fontScaleFontFactor","increase"]]);a.push(["Smaller","decreaseFontSize","setFontAttributeSize",["fontScaleFontFactor","decrease"]]);a.push(["Normal","normal","setFontAttributeStyle",["fontStyle","normal"]]);a.push(["Bold","bold","setFontAttributeStyle",["fontStyle","bold"]]);a.push(["Italic","italic","setFontAttributeStyle",["fontStyle","italic"]]);return a};this.getFontsMenu=function(){var a=[];a.push(["Size and Style","font",false,false,false,"getFontsSizeStyleMenu",[]]);a.push(["-"]);a.push(["Architects Daughter",this.fontName=="Architects Daughter"?"radioOn":"radioOff","changeAttribute",["fontName","Architects Daughter","Architects Daughter"]]);a.push(["Arial",this.fontName=="Arial"?"radioOn":"radioOff","changeAttribute",["fontName","Arial","Arial"]]);a.push(["Courier",this.fontName=="Courier"?"radioOn":"radioOff","changeAttribute",["fontName","Courier","Courier"]]);a.push(["Indie Flower",this.fontName=="Indie Flower"?"radioOn":"radioOff","changeAttribute",["fontName","Indie Flower","Indie Flower"]]);a.push(["Roboto",this.fontName=="Roboto"?"radioOn":"radioOff","changeAttribute",["fontName","Roboto","Roboto"]]);a.push(["Ubuntu",this.fontName=="Ubuntu"?"radioOn":"radioOff","changeAttribute",["fontName","Ubuntu","Ubuntu"]]);a.push(["Verdana",this.fontName=="Verdana"?"radioOn":"radioOff","changeAttribute",["fontName","Verdana","Verdana"]]);a.push(["-"]);a.push(["More","more","showConfiguratorCategory",["event","Text"]]);return a};this.getLayoutVarMenu=function(){var d=[];var a={};for(var b=0;b0){return d}else{return false}};this.getColorSpectrumMenu=function(b,g,m,l,k){var c=[];var a=this.getObjectArray(b);var f=this.getColorNames();for(var e=0;ed.toLowerCase()});for(var b=0;b=3){b.push(["Samples","samples","correlateData"])}if(this.data.y.smps.length>=3&&this.data.x&&this.isNumericFactor("s")){b.push(["Sample Annotation","samples",false,false,false,"getCorrelationCatMenu",["x",true]])}if(this.data.y.smps.length>=3){b.push(["Variables","variables","correlateData",[true]])}if(this.data.y.vars.length>=3&&this.data.z&&this.isNumericFactor("v")){b.push(["Variable Annotation","variables",false,false,false,"getCorrelationCatMenu",["z",false]])}return b};this.getMagnificationMenu=function(){var a=[];for(var b=1;b<=10;b++){a.push([(96*b)+" DPI",this.printMagnification==b?"radioOn":"radioOff","changeAttributeNoDraw",["printMagnification",b]])}return a};this.getParametersMenu=function(){var a=[];a.push(["Load Parameters","loadFile",true,[]]);a.push(["Save as JSON","json2","save",[false,"cX-"+this.target+"-param",true]]);return a};this.getFileMenu=function(){var a=[];a.push(["Save as PNG","camera","print",[],"Ctrl + P"]);if(!this.graphType.match(/Venn|TagCloud|Map/)){a.push(["Save as SVG","svg","saveSVG",[]])}a.push(["Save as JSON","json2","save",[]]);a.push(["Print Magnification","zoomIn",false,false,false,"getMagnificationMenu",[]]);a.push(["-"]);a.push(["Reproducible Research","RRBW","clickRepResearch",[]]);a.push(["Show JSON code","json","clickShowCode",[]]);if(!this.motionBy){a.push(["Reproduce","redo","reproduce",[false,true],"Ctrl + Alt + R"])}if(this.remoteService&&this.remoteServiceType=="webService"){a.push(["Save customizations to server","disckette","saveRemote",["afterRender"]]);a.push(["Clear parameters from server","discketteCrossed","clearRemote",[]])}a.push(["-"]);a.push(["Load","loadFile",true,[]]);if(this.Rdatasets){a.push(["R Datasets","RBW",false,false,false,"getRdatasetsMenu",[]])}a.push(["-"]);a.push(["Parameters","cog",false,false,false,"getParametersMenu",[]]);a.push(["-"]);a.push(["Reset","refresh","masterReset",[],"ESC"]);return a};this.getExploreMenu=function(){var a=[];a.push(["Filters","funnel","clickDataFilters",[]]);a.push(["Table","table","clickDataTable",[]]);a.push(["Configure","tools","clickDataExplorer",[]]);a.push(["-"]);a.push(["Search Parameters","magnifier","addConfiguratorCloseMenus"]);return a};this.getConfigurationMenu=function(){var e=this.decorations;var b={Bar:true,Line:true,Area:true,AreaLine:true,BarLine:true,Boxplot:true,Dotplot:true,DotLine:true,Heatmap:true,Treemap:true,TagCloud:true,ParallelCoordinates:true,Sankey:true,Stacked:true,StackedLine:true,StackedPercent:true,StackedPercentLine:true,Candlestick:true};var a=[];if(this.isMap||this.graphType=="Tree"){a.push(["Citation","citation1D",false,false,false,"getGraphPartMenu",["citation"]]);a.push(["Legend","legend",false,false,false,"getLegendMenu",[]]);a.push(["Title / Subtitle",this.graphType=="Heatmap"?"titleSubtitleH":"titleSubtitle",false,false,false,"getTitleSubtitleMenu",[]])}else{if(b[this.graphType]&&!this.is3DPlot){if(this.graphType!="Heatmap"){a.push(["Axes","axes1DProperties",false,false,false,"getAxesMenu",[]]);a.push(["Axes Titles","axes1DTitle",false,false,false,"getAxesTitleMenu",[]])}a.push(["Citation",this.graphType=="Heatmap"?"citationHeatmap":"citation1D",false,false,false,"getGraphPartMenu",["citation"]]);a.push(["General",this.graphType=="Heatmap"?"generalHeatmap":"general1D",false,false,false,"getGeneralMenu",[]]);a.push(["Grid","grid1D",false,false,false,"getPlotAreaGridMenu",["x"]]);if(this.graphType!="Heatmap"){if(this.graphType.match(/Dot/)){a.push(["Dotplot","dotPlot",false,false,false,"getDataPointsMenu",[]])}else{if(this.graphType=="Boxplot"){a.push(["Boxplot","boxPlot",false,false,false,"getBoxplotMenu",[]])}}a.push(["Plot Area","plot1D",false,false,false,"getPlotAreaOneMenu",[]]);if(e){a.push(["Decorations",e.marker?"decorationsMarker2D":"decorationsLine1D",false,false,false,"getDecorationsMenu",[]])}a.push(["Legend","legend1D",false,false,false,"getLegendMenu",[]]);if(this.data.x){a.push(["Overlays","overlays1D",false,false,false,"getOverlaysMenu",[]])}}if(this.graphType=="Heatmap"){a.push(["Indicator","indicator",false,false,false,"getIndicatorMenu",[]]);a.push(["Heatmap","heatmapGraph",false,false,false,"getHeatmapMenu",[]]);if(this.data.x||this.data.z){a.push(["Overlays","overlaysHeatmapSamples",false,false,false,"getOverlaysMenu",[]])}}a.push(["Sample Labels",this.graphType=="Heatmap"?"sampleLabelsHeatmap":"sampleLabels1D",false,false,false,"getSmpLabelMenu",[]]);a.push(["Samples Title",this.graphType=="Heatmap"?"sampleTitleHeatmap":"sampleTitle1D",false,false,false,"getGraphPartMenu",["smpTitle",true]]);if(this.graphType=="Heatmap"){a.push(["Variable Labels","variableLabelsHeatmap",false,false,false,"getVarLabelMenu",[]]);a.push(["Variables Title","variableTitleHeatmap",false,false,false,"getGraphPartMenu",["varTitle",true]])}a.push(["Title / Subtitle",this.graphType=="Heatmap"?"mainHeatmapTitleSubtitle":"main1DTitleSubtitle",false,false,false,"getTitleSubtitleMenu",[]])}else{if(this.graphType.match(/scatter/i)||this.is3DPlot){if(this.graphType=="Scatter3D"||this.is3DPlot){a.push(["Axes","axes3DProperties",false,false,false,"getAxesMenu",[]]);a.push(["Axes Titles","axes3DTitle",false,false,false,"getAxesTitleMenu",[]]);a.push(["Citation","citationScatter",false,false,false,"getGraphPartMenu",["citation"]]);a.push(["General","general3D",false,false,false,"getGeneralMenu",[]])}else{a.push(["Axes","axes2DProperties",false,false,false,"getAxesMenu",[]]);a.push(["Axes Titles","axes2DTitle",false,false,false,"getAxesTitleMenu",[]]);a.push(["Citation","citationScatter",false,false,false,"getGraphPartMenu",["citation"]]);a.push(["General","general2D",false,false,false,"getGeneralMenu",[]])}a.push(["Grid","gridScatter",false,false,false,"getPlotAreaScatterGridMenu",[]]);a.push(["Plot Area","plotScatter",false,false,false,"getPlotAreaScatterMenu",[]]);if(e){var c=e.nlfit?"nonlinearFit":e.line?"decorationsLine2D2":e.lines?"decorationsLine2D":e.reg?"correlation":e.nor?"fit3":e.area?"fit2":e.kaplanMeier?"kaplanMeyer":e.marker?"decorationsMarker2D":false;a.push(["Decorations",c,false,false,false,"getDecorationsMenu",[]])}a.push(["Legend","legendScatter",false,false,false,"getLegendMenu",[]]);a.push(["Title / Subtitle","mainScatterTitleSubtitle",false,false,false,"getTitleSubtitleMenu",[]]);if(this.isSelectDataPoints){a.push(["Show hidden data points","eye","showHideSelectedDataPoint",[false,45],"Ctrl + Insert"]);a.push(["Hide data points","eyeCrossed","showHideSelectedDataPoint",[false,46],"Ctrl + Delete"])}}}}return a};this.getAlignNetworkMenu=function(){var a=[];a.push(["Top","alignTop","alignDistributeSelectedNodes",[false,84]]);a.push(["Right","alignRight","alignDistributeSelectedNodes",[false,82]]);a.push(["Bottom","alignBottom","alignDistributeSelectedNodes",[false,66]]);a.push(["Left","alignLeft","alignDistributeSelectedNodes",[false,76]]);return a};this.getDistributeNetworkMenu=function(){var a=[];a.push(["Vertically","distributeVertical","alignDistributeSelectedNodes",[false,86]]);a.push(["Horozontally","distributeHorizontal","alignDistributeSelectedNodes",[false,72]]);return a};this.getRotateNetworkMenu=function(){var a=[];a.push(["Clockwise","rotateClockwise","arrowMove",[34]]);a.push(["Clockwise - Animate","rotateClockwise2","arrowMove",[39,true]]);a.push(["Anticlockwise","rotateAnticlockwise","arrowMove",[33]]);a.push(["Anticlockwise - Animate","rotateAnticlockwise2","arrowMove",[37,true]]);return a};this.getOrderNetworkMenu=function(){var a=[];a.push(["Send to back","moveBack","orderNodes",["sendNodeToBack"]]);a.push(["Send backward","moveBackwards","orderNodes",["sendNodeBackward"]]);a.push(["Bring to front","moveFront","orderNodes",["bringNodeToFront"]]);a.push(["Bring forward","moveForwards","orderNodes",["bringNodeForward"]]);return a};this.getNetworkNodeEdgeAttributesMenu=function(){var a=[];a.push(["Nodes","nodes",false,false,false,"getNetworkNodeAttributesMenu",[]]);a.push(["Edges","edges",false,false,false,"getNetworkEdgeAttributesMenu",[]]);return a};this.getNetworkNodeAttributesPropertyMenu=function(b){var d=[];var c=this.sortObject(this.meta.data.nodes);for(var a=0;a