//>>built
require({cache:{"url:dojox/calc/templates/Grapher.html":'<div>\n<div data-dojo-attach-point="chartsParent" class="dojoxCalcChartHolder"></div>\n<div data-dojo-attach-point="outerDiv">\n<div data-dojo-type="dijit.form.DropDownButton" data-dojo-attach-point="windowOptions" class="dojoxCalcDropDownForWindowOptions" title="Window Options">\n\t<div>Window Options</div>\n\t<div data-dojo-type="dijit.TooltipDialog" data-dojo-attach-point="windowOptionsInside" class="dojoxCalcTooltipDialogForWindowOptions" title="">\n\t\t<table class="dojoxCalcGraphOptionTable">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\tWidth:\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input data-dojo-type="dijit.form.TextBox" data-dojo-attach-point="graphWidth" class="dojoxCalcGraphWidth" value="500" />\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\tHeight:\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input data-dojo-type="dijit.form.TextBox" data-dojo-attach-point="graphHeight" class="dojoxCalcGraphHeight" value="500" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\tX >=\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input data-dojo-type="dijit.form.TextBox" data-dojo-attach-point="graphMinX" class="dojoxCalcGraphMinX" value="-10" />\n\t\t\t\t</td>\n\n\t\t\t\t<td>\n\t\t\t\t\tX <=\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input data-dojo-type="dijit.form.TextBox" data-dojo-attach-point="graphMaxX" class="dojoxCalcGraphMaxX" value="10" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\tY >=\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input data-dojo-type="dijit.form.TextBox" data-dojo-attach-point="graphMinY" class="dojoxCalcGraphMinY" value="-10" />\n\t\t\t\t</td>\n\n\t\t\t\t<td>\n\t\t\t\t\tY <=\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input data-dojo-type="dijit.form.TextBox" data-dojo-attach-point="graphMaxY" class="dojoxCalcGraphMaxY" value="10" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n</div>\n\n<BR>\n\n<div class="dojoxCalcGrapherFuncOuterDiv">\n\t<table class="dojoxCalcGrapherFuncTable" data-dojo-attach-point="graphTable">\n\t</table>\n</div>\n\n<div data-dojo-type="dijit.form.DropDownButton" data-dojo-attach-point=\'addFuncButton\' class="dojoxCalcDropDownAddingFunction">\n\t<div>Add Function</div>\n\t<div data-dojo-type="dijit.TooltipDialog" data-dojo-attach-point="addFuncInside" class="dojoxCalcTooltipDialogAddingFunction" title="">\n\t\t<table class="dojoxCalcGrapherModeTable">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\tMode:\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<select data-dojo-type="dijit.form.Select" data-dojo-attach-point="funcMode" class="dojoxCalcFunctionModeSelector">\n\t\t\t\t\t\t<option value="y=" selected="selected">y=</option>\n\t\t\t\t\t\t<option value="x=">x=</option>\n\t\t\t\t\t</select>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t</tr>\n\t\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<input data-dojo-type="dijit.form.Button" data-dojo-attach-point="createFunc" class="dojoxCalcAddFunctionButton" label="Create" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n</div>\n<BR>\n<BR>\n<table class="dijitInline dojoxCalcGrapherLayout">\n\t<tr>\n\t\t<td class="dojoxCalcGrapherButtonContainer">\n\t\t\t<input data-dojo-type="dijit.form.Button" class="dojoxCalcGrapherButton" data-dojo-attach-point=\'selectAllButton\' label="Select All" />\n\t\t</td>\n\t\t<td class="dojoxCalcGrapherButtonContainer">\n\t\t\t<input data-dojo-type="dijit.form.Button" class="dojoxCalcGrapherButton" data-dojo-attach-point=\'deselectAllButton\' label="Deselect All" />\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td class="dojoxCalcGrapherButtonContainer">\n\t\t\t<input data-dojo-type="dijit.form.Button" class="dojoxCalcGrapherButton" data-dojo-attach-point=\'drawButton\'label="Draw Selected" />\n\t\t</td>\n\t\t<td class="dojoxCalcGrapherButtonContainer">\n\t\t\t<input data-dojo-type="dijit.form.Button" class="dojoxCalcGrapherButton" data-dojo-attach-point=\'eraseButton\' label="Erase Selected" />\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td class="dojoxCalcGrapherButtonContainer">\n\t\t\t<input data-dojo-type="dijit.form.Button" class="dojoxCalcGrapherButton" data-dojo-attach-point=\'deleteButton\' label="Delete Selected" />\n\t\t</td>\n\t\t<td class="dojoxCalcGrapherButtonContainer">\n\t\t\t<input data-dojo-type="dijit.form.Button" class="dojoxCalcGrapherButton" data-dojo-attach-point=\'closeButton\' label="Close" />\n\t\t</td>\n\t</tr>\n</table>\n</div>\n</div>\n'}});
define("dojox/calc/Grapher","dojo/_base/declare,dojo/_base/lang,dojo/_base/window,dojo/dom-construct,dojo/dom-class,dojo/dom-style,dijit/_WidgetBase,dijit/_WidgetsInTemplateMixin,dijit/_TemplatedMixin,dojox/math/_base,dijit/registry,dijit/form/DropDownButton,dijit/TooltipDialog,dijit/form/TextBox,dijit/form/CheckBox,dijit/ColorPalette,dojox/charting/Chart,dojox/charting/axis2d/Default,dojox/charting/plot2d/Default,dojox/charting/plot2d/Lines,dojox/charting/themes/Tufte,dojo/colors,dojo/text!./templates/Grapher.html,dojox/calc/_Executor,dijit/form/Button,dijit/form/Select".split(","),
function(n,i,u,k,m,o,v,w,x,H,y,z,A,B,C,D,I,J,K,L,M,N,E,p){var r=1.0E-15/9,F=Math.log(2),G={graphNumber:0,fOfX:!0,color:{stroke:"black"}},n=n("dojox.calc.Grapher",[v,x,w],{templateString:E,addXYAxes:function(a){return a.addAxis("x",{max:parseInt(this.graphMaxX.get("value")),min:parseInt(this.graphMinX.get("value")),majorLabels:!0,minorLabels:!0,minorTicks:!1,microTicks:!1,htmlLabels:!0,labelFunc:function(a){return a},maxLabelSize:30,fixUpper:"major",fixLower:"major",majorTick:{length:3}}).addAxis("y",
{max:parseInt(this.graphMaxY.get("value")),min:parseInt(this.graphMinY.get("value")),labelFunc:function(a){return a},maxLabelSize:50,vertical:!0,microTicks:!1,minorTicks:!0,majorTick:{stroke:"black",length:3}})},selectAll:function(){for(var a=0;a<this.rowCount;a++)this.array[a][this.checkboxIndex].set("checked",!0)},deselectAll:function(){for(var a=0;a<this.rowCount;a++)this.array[a][this.checkboxIndex].set("checked",!1)},drawOne:function(){},onDraw:function(){},erase:function(a){for(var d=0,c="Series "+
this.array[a][this.funcNumberIndex]+"_"+d;c in this.array[a][this.chartIndex].runs;)this.array[a][this.chartIndex].removeSeries(c),d++,c="Series "+this.array[a][this.funcNumberIndex]+"_"+d;this.array[a][this.chartIndex].render();this.setStatus(a,"Hidden")},onErase:function(){for(var a=0;a<this.rowCount;a++)this.array[a][this.checkboxIndex].get("checked")&&this.erase(a)},onDelete:function(){for(var a=0;a<this.rowCount;a++)if(this.array[a][this.checkboxIndex].get("checked")){this.erase(a);for(var d=
0;d<this.functionRef;d++)this.array[a][d]&&this.array[a][d].destroy&&this.array[a][d].destroy();this.graphTable.deleteRow(a);this.array.splice(a,1);this.rowCount--;a--}},checkboxIndex:0,functionMode:1,expressionIndex:2,colorIndex:3,dropDownIndex:4,tooltipIndex:5,colorBoxFieldsetIndex:6,statusIndex:7,chartIndex:8,funcNumberIndex:9,evaluatedExpression:10,functionRef:11,createFunction:function(){var a=this.graphTable.insertRow(-1);this.array[a.rowIndex]=[];var d=a.insertCell(-1),c=k.create("div");d.appendChild(c);
var f=new C({},c);this.array[a.rowIndex][this.checkboxIndex]=f;m.add(c,"dojoxCalcCheckBox");d=a.insertCell(-1);f=this.funcMode.get("value");c=u.doc.createTextNode(f);d.appendChild(c);this.array[a.rowIndex][this.functionMode]=f;d=a.insertCell(-1);c=k.create("div");d.appendChild(c);f=new B({},c);this.array[a.rowIndex][this.expressionIndex]=f;m.add(c,"dojoxCalcExpressionBox");c=k.create("div");f=new D({changedColor:this.changedColor},c);m.add(c,"dojoxCalcColorPalette");this.array[a.rowIndex][this.colorIndex]=
f;var c=k.create("div"),g=new A({content:f},c);this.array[a.rowIndex][this.tooltipIndex]=g;m.add(c,"dojoxCalcContainerOfColor");d=a.insertCell(-1);c=k.create("div");d.appendChild(c);var b=k.create("fieldset");o.set(b,{backgroundColor:"black",width:"1em",height:"1em",display:"inline"});this.array[a.rowIndex][this.colorBoxFieldsetIndex]=b;d=new z({label:"Color ",dropDown:g},c);d.containerNode.appendChild(b);this.array[a.rowIndex][this.dropDownIndex]=d;m.add(c,"dojoxCalcDropDownForColor");d=a.insertCell(-1);
c=k.create("fieldset");c.innerHTML="Hidden";this.array[a.rowIndex][this.statusIndex]=c;m.add(c,"dojoxCalcStatusBox");d.appendChild(c);c=k.create("div");o.set(c,{position:"absolute",left:"0px",top:"0px"});this.chartsParent.appendChild(c);this.array[a.rowIndex][this.chartNodeIndex]=c;m.add(c,"dojoxCalcChart");c=(new dojox.charting.Chart(c)).setTheme(dojox.charting.themes.Tufte).addPlot("default",{type:"Lines",shadow:{dx:1,dy:1,width:2,color:[0,0,0,0.3]}});this.addXYAxes(c);this.array[a.rowIndex][this.chartIndex]=
c;f.set("chart",c);f.set("colorBox",b);f.set("onChange",i.hitch(f,"changedColor"));this.array[a.rowIndex][this.funcNumberIndex]=this.funcNumber++;this.rowCount++},setStatus:function(a,d){this.array[a][this.statusIndex].innerHTML=d},changedColor:function(){for(var a=this.get("chart"),d=this.get("colorBox"),c=0;c<a.series.length;c++)if(a.series[c].stroke&&a.series[c].stroke.color)a.series[c].stroke.color=this.get("value"),a.dirty=!0;a.render();o.set(d,{backgroundColor:this.get("value")})},makeDirty:function(){this.dirty=
!0},checkDirty1:function(){setTimeout(i.hitch(this,"checkDirty"),0)},checkDirty:function(){if(this.dirty){for(var a=0;a<this.rowCount;a++)this.array[a][this.chartIndex].removeAxis("x"),this.array[a][this.chartIndex].removeAxis("y"),this.addXYAxes(this.array[a][this.chartIndex]);this.onDraw()}this.dirty=!1},postCreate:function(){this.inherited(arguments);this.createFunc.set("onClick",i.hitch(this,"createFunction"));this.selectAllButton.set("onClick",i.hitch(this,"selectAll"));this.deselectAllButton.set("onClick",
i.hitch(this,"deselectAll"));this.drawButton.set("onClick",i.hitch(this,"onDraw"));this.eraseButton.set("onClick",i.hitch(this,"onErase"));this.deleteButton.set("onClick",i.hitch(this,"onDelete"));this.dirty=!1;this.graphWidth.set("onChange",i.hitch(this,"makeDirty"));this.graphHeight.set("onChange",i.hitch(this,"makeDirty"));this.graphMaxX.set("onChange",i.hitch(this,"makeDirty"));this.graphMinX.set("onChange",i.hitch(this,"makeDirty"));this.graphMaxY.set("onChange",i.hitch(this,"makeDirty"));this.graphMinY.set("onChange",
i.hitch(this,"makeDirty"));this.windowOptionsInside.set("onClose",i.hitch(this,"checkDirty1"));this.rowCount=this.funcNumber=0;this.array=[]},startup:function(){this.inherited(arguments);var a=y.getEnclosingWidget(this.domNode.parentNode);a&&"function"==typeof a.close?this.closeButton.set("onClick",i.hitch(a,"close")):o.set(this.closeButton.domNode,{display:"none"});this.createFunction();this.array[0][this.checkboxIndex].set("checked",!0);this.onDraw();this.erase(0);this.array[0][this.expressionIndex].value=
""}});return i.mixin(p,{draw:function(a,d,c){c=i.mixin({},G,c);a.fullGeometry();var d=!0==c.fOfX?p.generatePoints(d,"x","y",a.axes.x.scaler.bounds.span,a.axes.x.scaler.bounds.lower,a.axes.x.scaler.bounds.upper,a.axes.y.scaler.bounds.lower,a.axes.y.scaler.bounds.upper):p.generatePoints(d,"y","x",a.axes.y.scaler.bounds.span,a.axes.y.scaler.bounds.lower,a.axes.y.scaler.bounds.upper,a.axes.x.scaler.bounds.lower,a.axes.x.scaler.bounds.upper),f=0;if(0<d.length)for(;f<d.length;f++)0<d[f].length&&a.addSeries("Series "+
c.graphNumber+"_"+f,d[f],c.color);for(var g="Series "+c.graphNumber+"_"+f;g in a.runs;)a.removeSeries(g),f++,g="Series "+c.graphNumber+"_"+f;a.render();return d},generatePoints:function(a,d,c,f,g,b,i,k){function m(a,b,e,h){for(;b<=e;){var f={};f[d]=(b[d]+e[d])/2;f[c]=a(f[d]);if(h==f[c]||f[d]==e[d]||f[d]==b[d])return f;var g=!0;h<f[c]&&(g=!1);f[c]<e[c]?g?b=f:e=f:f[c]<b[c]&&(g?e=f:b=f)}return NaN}function o(a,b,e){for(var f=[[],[]],h;b[d]<=e[d];){var g=(b[d]+e[d])/2;h={};h[d]=g;h[c]=a(g);var g=h[d],
i=void 0,i=-1<g&&1>g?0>g?g>=-r?-g:g/Math.ceil(g/r):r:Math.abs(g)*r,g=g+i,i={};i[d]=g;i[c]=a(g);if(Math.abs(i[c])>=Math.abs(h[c]))f[0].push(h),b=i;else{f[1].unshift(h);if(e[d]==h[d])break;e=h}}return f}function n(a,b){var c=!1,d=!1;a<b&&(c=!0);0<b&&(d=!0);return{inc:c,pos:d}}function q(a,b){return(b[c]-a[c])/(b[d]-a[d])}var f=1<<Math.ceil(Math.log(f)/F),l=(b-g)/f,b=[],h=0,e,j;b[h]=[];for(var s=g,p=0;p<=f;s+=l,p++){g={};g[d]=s;g[c]=a({_name:d,_value:s,_graphing:!0});if(null==g[d]||null==g[c])return{};
if(!isNaN(g[c])&&!isNaN(g[d]))if(b[h].push(g),3==b[h].length)e=n(q(b[h][b[h].length-3],b[h][b[h].length-2]),q(b[h][b[h].length-2],b[h][b[h].length-1]));else if(!(4>b[h].length)&&(j=n(q(b[h][b[h].length-3],b[h][b[h].length-2]),q(b[h][b[h].length-2],b[h][b[h].length-1])),e.inc!=j.inc||e.pos!=j.pos)){var t=o(a,b[h][b[h].length-3],b[h][b[h].length-1]),g=b[h].pop();b[h].pop();for(e=0;e<t[0].length;e++)b[h].push(t[0][e]);for(e=1;e<t.length;e++)b[++h]=t.pop();b[h].push(g);e=j}}for(;1<b.length;){for(e=0;e<
b[1].length;e++)b[0][b[0].length-1][d]!=b[1][e][d]&&b[0].push(b[1][e]);b.splice(1,1)}b=b[0];f=0;l=[[]];for(e=0;e<b.length;e++)if(isNaN(b[e][c])||isNaN(b[e][d])){for(;isNaN(b[e][c])||isNaN(b[e][d]);)b.splice(e,1);l[++f]=[];e--}else if(b[e][c]>k||b[e][c]<i){0<e&&b[e-1].y!=i&&b[e-1].y!=k&&(j=q(b[e-1],b[e]),1.0E200<j?j=1.0E200:-1.0E200>j&&(j=-1.0E200),h=b[e][c]>k?k:i,g=b[e][c]-j*b[e][d],j=(h-g)/j,g={},g[d]=j,g[c]=a(j),g[c]!=h&&(g=m(a,b[e-1],b[e],h)),l[f].push(g),l[++f]=[]);for(;e<b.length&&(b[e][c]>k||
b[e][c]<i);)e++;if(e>=b.length){0==l[f].length&&l.splice(f,1);break}0<e&&b[e].y!=i&&b[e].y!=k&&(j=q(b[e-1],b[e]),1.0E200<j?j=1.0E200:-1.0E200>j&&(j=-1.0E200),h=b[e-1][c]>k?k:i,g=b[e][c]-j*b[e][d],j=(h-g)/j,g={},g[d]=j,g[c]=a(j),g[c]!=h&&(g=m(a,b[e-1],b[e],h)),l[f].push(g),l[f].push(b[e]))}else l[f].push(b[e]);return l},Grapher:n})});