diff --git a/perfectSteak.js b/perfectSteak.js index 6486bf2..18a97fd 100644 --- a/perfectSteak.js +++ b/perfectSteak.js @@ -241,7 +241,16 @@ var clicked=false; // else{ d3.selectAll(".containters").remove(); // d3.selectAll(".mysteak").remove(); - +var onoff=function(){ + currentvalue = $(document.getElementById('onoff')).html(); + if(currentvalue == "Protein State"){ + $(document.getElementById("onoff")).html("False Color"); + graph(false,''); + }else{ + $(document.getElementById("onoff")).html("Protein State"); + graph(false,'False'); + } +} var addButton; var flipButton; var cookButton; @@ -249,7 +258,9 @@ var clicked=false; var saveBut=$('Save'); var cookButt=$(""); var addQuickButton = $(""); - var addTextButton = $(""); + var tog=$(''); + tog.on("click",onoff); + var addTextButton = $(""); var saveModal=$('
'); displayDiv.append(saveModal) @@ -414,7 +425,7 @@ saveBut.on("click", function(){ //} model.buildData(); - if(clicked&&model.currentInfo["OKToGraph"]){graph(false)} + if(clicked&&model.currentInfo["OKToGraph"]){graph(false,'')} else{ d3.selectAll(".containers").remove(); d3.selectAll(".mysteak").remove(); @@ -428,7 +439,7 @@ saveBut.on("click", function(){ }) inputTable.append(addButton);//, saveBut,saveModal); - $(".span3").append(cookButt,addQuickButton,addTextButton); + $(".span3").append(cookButt,addQuickButton,addTextButton,tog); addDropdown(); } var sumtime=0; @@ -546,7 +557,7 @@ $("#inp2_"+l).attr("id", "inp2_"+l-1); } -var graph=function(isFirst){ +var graph=function(isFirst,falseColor){ d3.selectAll(".mysteak").remove(); d3.selectAll(".containers").remove(); model.dataClear(); @@ -596,7 +607,10 @@ else{var sumtime=parseFloat(time[0]);} //add to on click and calculate(blah,blah,blah, meatType) var meatType = $("input[type='radio'][name='meat']:checked").attr('id'); - + if(falseColor=='False') + { + meatType='False'; + } //THIS WILL COOK THE STEAK IF WE HAVE VALID INPUTS if (OKtoCook==true){ var steak = [model.currentInfo["data"][0][1]]; @@ -617,7 +631,7 @@ if (model.currentInfo["OKToGraph"]){ d3.selectAll("svg").remove(); model.dataClear(); -graph(true); +graph(true,''); }; }); } diff --git a/sample.js b/sample.js index 6694584..19596d5 100644 --- a/sample.js +++ b/sample.js @@ -20,7 +20,13 @@ var calculate=function(data,steak,meatType,first,totalTime){ var myheatsolver = HeatSolver(steak,timestep,spacestep); var Thedata=myheatsolver.sixty_graph_arrays_duration(data); + if(meatType=='False'){ var sampledata=Thedata.temps; + } + else{ + var sampledata=Thedata.allMaxTemps; + console.log(sampledata.length); + } var flame=Thedata.points; var timestep=1/Thedata.step; var maxTemps=Thedata.maxTemps; @@ -30,7 +36,7 @@ var calculate=function(data,steak,meatType,first,totalTime){ drawFinished(meatType,maxTemps,data,steak[0],1); } - graphSteak(sampledata,flame,timestep,"False",maxTemps); + graphSteak(sampledata,flame,timestep,meatType,maxTemps); } \ No newline at end of file