if(window.PlotJax.Shapes==null){registerNS("PlotJax.Shapes");PlotJax.Shapes=function(a,b){this.plot=a;this.ctx=b;this.icons=[];this.valid_shapes={"square":true,"fillsquare":true,"opensquare":true,"circle":true,"fillcircle":true,"opencircle":true,"diamond":true,"filldiamond":true,"opendiamond":true,"triangle":true,"filltriangle":true,"opentriangle":true,"horizcross":true,"diagcross":true,"dot":true,"icon":true}};PlotJax.Shapes.SIZE=8;PlotJax.Shapes.RADIUS=4;PlotJax.Shapes.prototype={addIcon:function(a,b){this.icons[a]=b},getIcon:function(a){return this.icons[a]},isValidShape:function(a,b){return(a=="icon")?(this.icons[b]!=null):(this.valid_shapes[a]!=null)},clear:function(){this.plot=null;this.ctx=null;this.icons=null},draw:function(x,y,a,b,c){switch(b){case"icon":if(this.icons[c]==null){return null}var w=this.icons[c].width>>1;var h=this.icons[c].height>>1;this.ctx.drawImage(this.icons[c],x-w,y-h);return[x,y,Math.max(w,h)];case"dot":this.ctx.fillStyle=a;this.ctx.fillRect(x,y,1,1);return[x,y,1];case"star":case"openstar":return null;case"square":case"fillsquare":this.ctx.fillStyle=a;this.ctx.fillRect(x-PlotJax.Shapes.RADIUS,y-PlotJax.Shapes.RADIUS,PlotJax.Shapes.SIZE,PlotJax.Shapes.SIZE);break;case"opensquare":this.ctx.strokeStyle=a;this.ctx.strokeRect(x-PlotJax.Shapes.RADIUS,y-PlotJax.Shapes.RADIUS,PlotJax.Shapes.SIZE,PlotJax.Shapes.SIZE);break;case"circle":case"fillcircle":this.ctx.fillStyle=a;this.ctx.beginPath();this.ctx.arc(x,y,PlotJax.Shapes.RADIUS,0,2*Math.PI,false);this.ctx.closePath();this.ctx.fill();break;case"opencircle":this.ctx.strokeStyle=a;this.ctx.beginPath();this.ctx.arc(x,y,PlotJax.Shapes.RADIUS,0,2*Math.PI,false);this.ctx.closePath();this.ctx.stroke();break;case"diamond":case"filldiamond":this.ctx.fillStyle=a;this.ctx.beginPath();this.ctx.moveTo(x,y-PlotJax.Shapes.RADIUS);this.ctx.lineTo(x-PlotJax.Shapes.RADIUS,y);this.ctx.lineTo(x,y+PlotJax.Shapes.RADIUS);this.ctx.lineTo(x+PlotJax.Shapes.RADIUS,y);this.ctx.closePath();this.ctx.fill();break;case"opendiamond":this.ctx.strokeStyle=a;this.ctx.beginPath();this.ctx.moveTo(x,y-PlotJax.Shapes.RADIUS);this.ctx.lineTo(x-PlotJax.Shapes.RADIUS,y);this.ctx.lineTo(x,y+PlotJax.Shapes.RADIUS);this.ctx.lineTo(x+PlotJax.Shapes.RADIUS,y);this.ctx.closePath();this.ctx.stroke();break;case"triangle":case"filltriangle":this.ctx.fillStyle=a;this.ctx.beginPath();this.ctx.moveTo(x,y-PlotJax.Shapes.RADIUS);this.ctx.lineTo(x-PlotJax.Shapes.RADIUS,y+PlotJax.Shapes.RADIUS);this.ctx.lineTo(x+PlotJax.Shapes.RADIUS,y+PlotJax.Shapes.RADIUS);this.ctx.closePath();this.ctx.fill();break;case"opentriangle":this.ctx.strokeStyle=a;this.ctx.beginPath();this.ctx.moveTo(x,y-PlotJax.Shapes.RADIUS);this.ctx.lineTo(x-PlotJax.Shapes.RADIUS,y+PlotJax.Shapes.RADIUS);this.ctx.lineTo(x+PlotJax.Shapes.RADIUS,y+PlotJax.Shapes.RADIUS);this.ctx.closePath();this.ctx.stroke();break;case"horizcross":this.ctx.strokeStyle=a;this.ctx.beginPath();this.ctx.moveTo(x,y-PlotJax.Shapes.RADIUS);this.ctx.lineTo(x,y+PlotJax.Shapes.RADIUS);this.ctx.closePath();this.ctx.stroke();this.ctx.beginPath();this.ctx.moveTo(x-PlotJax.Shapes.RADIUS,y);this.ctx.lineTo(x+PlotJax.Shapes.RADIUS,y);this.ctx.closePath();this.ctx.stroke();break;case"diagcross":this.ctx.strokeStyle=a;this.ctx.beginPath();this.ctx.moveTo(x-PlotJax.Shapes.RADIUS,y-PlotJax.Shapes.RADIUS);this.ctx.lineTo(x+PlotJax.Shapes.RADIUS,y+PlotJax.Shapes.RADIUS);this.ctx.closePath();this.ctx.stroke();this.ctx.beginPath();this.ctx.moveTo(x+PlotJax.Shapes.RADIUS,y-PlotJax.Shapes.RADIUS);this.ctx.lineTo(x-PlotJax.Shapes.RADIUS,y+PlotJax.Shapes.RADIUS);this.ctx.closePath();this.ctx.stroke();break;default:return null}return[x,y,PlotJax.Shapes.RADIUS]}}}