Skip to content

Commit

Permalink
toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
stephensm authored and stephensm committed Aug 8, 2013
1 parent 221e312 commit 1ff78cf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
28 changes: 21 additions & 7 deletions perfectSteak.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,26 @@ 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;

var saveBut=$('<a href="#saveBut" role="button" class="btn sBut" data-toggle="modal" id="saveBut">Save</a>');
var cookButt=$("<button class='btn'>Cook</button>");
var addQuickButton = $("<button class='btn' id='addQuickButton'>Quick Add</button>");
var addTextButton = $("<button class='btn' id='addTextButton'>Edit Recipe Text</button>");
var tog=$('<button class="btn" id="onoff">False Color</button>');
tog.on("click",onoff);
var addTextButton = $("<button class='btn' id='addTextButton'>Input Text</button>");
var saveModal=$('<div id="saveBut" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-body">Please select a name for your recipe <p> <input type="text" id="recipeName"></input><p><button class="btn" data-dismiss="modal" aria-hidden="true">OK</button></div></div>');
displayDiv.append(saveModal)

Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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]];
Expand All @@ -617,7 +631,7 @@ if (model.currentInfo["OKToGraph"]){
d3.selectAll("svg").remove();

model.dataClear();
graph(true);
graph(true,'');
};
});
}
Expand Down
8 changes: 7 additions & 1 deletion sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);


}

0 comments on commit 1ff78cf

Please sign in to comment.