Skip to content

Commit

Permalink
Marissas Updated now with prerecorded data and tooltio
Browse files Browse the repository at this point in the history
  • Loading branch information
stephensm authored and stephensm committed Aug 12, 2013
1 parent 8906613 commit d284c35
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 4 additions & 4 deletions graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ var rect = layer.selectAll("rect")


var Offset = document.getElementById("graphSteak").offsetTop;
var pos=parseInt(data[0].length-(event.pageY-Offset-margin.top-300)/(height/yStackMax));
var pos=parseInt(data[0].length-(event.pageY-Offset-margin.top-320)/(height/yStackMax));
var line=parseInt((event.pageX-parseFloat($("body").css('margin-left'))-margin.left)/(x.rangeBand()+1.2)-1.5);
console.log(line);
$("line").remove();
var myLine = d3.selectAll(".mysteak").append("svg:line")
.attr("x1", margin.left)
.attr("y1", event.pageY-Offset-295)
.attr("y1", event.pageY-Offset-322)
.attr("x2", width*32/30)
.attr("y2", event.pageY-Offset-295)
.attr("y2", event.pageY-Offset-322)
.style("z-index",-1)
.style("stroke", "grey");
//console.log(d3.event.pageX-parseFloat($("body").css('margin-left')));
Expand All @@ -205,7 +205,7 @@ console.log(line);
ttip.html(toF(parseFloat(data[line][pos])).toFixed(2)+ "\xB0F") }
else{
ttip.html(parseFloat(data[line][pos]).toFixed(2)+ "\xB0C")}
// ttip.html(line.toFixed(2)+ "\xB0C")
// ttip.html(pos.toFixed(2)+ "\xB0C")

ttip.style("opacity", 1)
.style("left", (d3.event.pageX-parseFloat($("body").css('margin-left'))+10) + "px")
Expand Down
22 changes: 17 additions & 5 deletions perfectSteak.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,25 @@ var perfectSteak = function (div) {

var timeStep = 15;
var inputTable = $(".inputTable");
var toC = function (F) {
return ((5 / 9) * (F - 32));
}
var importRecipes=function(){
var saved=[{"name":"15 seconds flip for 10 minutes","data":[[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300]],"Temp":73},
{"name":"5 minutes a side","data":[[300,300,73],[300,73,300],[300,73,73]],"Temp":73},
{"name":"sous-vide","data":[[3600,140,140],[60,300,73],[60,73,300]],"Temp":73}];
var saved=[{"name":"Heston Blumenthal","data":[[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[15,73,300],[15,300,73],[300,73,73]],"Temp":73},
{"name":"4 minutes a side","data":[[240,300,73],[240,73,300],[300,73,73]],"Temp":73},
{"name":"America's Test Kitchen","data":[[15,450,73],[15,73,450],[300,225,225],[900,73,73]],"Temp":73},
{"name":"Nathan Mhyrvold","data":[[3600,125,125],[30,-321,-321],[60,390,390]],"Temp":73}];
for (var i=0;i<3;i++){
var name=saved[i]["name"];
var data=saved[i]["data"];


for(var n=0;n<data.length;n++)
{
data[n][1]=toC(data[n][1]);
data[n][2]=toC(data[n][2]);
}

var steaktemp=saved[i]["Temp"];
var steak = [data[0][1]];
for (var m = 0; m < 30; m++) {
Expand All @@ -36,7 +48,7 @@ var importRecipes=function(){
var Thedata = myheatsolver.sixty_graph_arrays_duration(data);
var maxTemps = Thedata.maxTemps;
var meatType = "Steak";
var recipe = [meatType, maxTemps, data, steaktemp,30,'F'];
var recipe = [meatType, maxTemps, data, steaktemp,3,'F'];
addRecipe(name, recipe);
}
}
Expand Down Expand Up @@ -366,7 +378,7 @@ var importRecipes=function(){
console.log(info);
d3.selectAll('.finalsteak').remove();

drawFinished(info[0], info[1], info[2], info[3], 0,info[4],info[4]);
drawFinished(info[0], info[1], info[2], info[3], 0,info[4],info[5]);
var inf = model.currentInfo['recipe'][name2];
drawFinished(inf[0], inf[1], inf[2], inf[3], 1,inf[4],inf[5]);
});
Expand Down

0 comments on commit d284c35

Please sign in to comment.