diff --git a/.DS_Store b/.DS_Store index c1b926d..bcead23 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/data.js b/data.js index 6bdb85a..8624dae 100644 --- a/data.js +++ b/data.js @@ -1,6 +1,6 @@ var tempScale={ "Steak": - [{'info':'lack of protein denaturization below 40\xB0 C Raw','position':6}, + [{'info':'No protein denaturization below 40\xB0 C Raw','position':6}, {'info':'Myosin breaks down 40-55\xB0 C Rare','position':5}, {'info':'Glycogen breaks down 55-60\xB0 C Medium Rare','position':4}, {'info':'Myoglobin denatures 60-70\xB0 C Medium','position':3}, @@ -10,7 +10,7 @@ var tempScale={ "Tuna": - [{'info':'Lack of protein denaturization below 40\xB0 C','position':6}, + [{'info':'No protein denaturization below 40\xB0 C','position':6}, {'info':'Myosin breaks down 40-50\xB0 C','position':5}, {'info':'Myocommata begins to rupture 50\xB0 C','position':4}, {'info':'Myoglobin denatures 60-70\xB0 C','position':3}, @@ -18,7 +18,7 @@ var tempScale={ {'info':'Fibers begin to disintegrate 90+\xB0 C+','position':1}, {'info':'Charring at 180+\xB0 C+','position':0}], "Turkey": - [{'info':'lack of protein denaturization below 40\xB0 C Raw','position':6}, + [{'info':'No protein denaturization below 40\xB0 C Raw','position':6}, {'info':'Myosin breaks down 40-55\xB0 C Rare','position':5}, {'info':'Glycogen breaks down 55-60\xB0 C Medium Rare','position':4}, {'info':'Myoglobin denatures 60-70\xB0 C Medium','position':3}, diff --git a/graph.css b/graph.css index cbc3c07..2b6e3c0 100644 --- a/graph.css +++ b/graph.css @@ -29,7 +29,18 @@ form { .grid path { stroke-width: 0; } - +div.tooltip { + position: absolute; + text-align: center; + width: 60px; + height: 28px; + padding: 2px; + font: 12px sans-serif; + background: lightsteelblue; + border: 0px; + border-radius: 8px; + pointer-events: none; +} .css3gradient{width:300px;height:100px; background-color:#693d34; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#693d34, endColorstr=#e87c66); diff --git a/graph.js b/graph.js index 8c23897..cc5ca17 100644 --- a/graph.js +++ b/graph.js @@ -54,7 +54,7 @@ var n = boundaries[meatType].length*2+1, // number of layers var margin = {top: 150, right: 10, bottom: 100, left: 50}, width = 960 - margin.left - margin.right, - height = 500 - margin.top - margin.bottom; + height = 400 - margin.top - margin.bottom; var x = d3.scale.ordinal() .domain(d3.range(m)) @@ -128,7 +128,9 @@ var svg = d3.select("body").append("svg") .attr("y", -margin.top/2) .style("font-size",'30px') .text(meatType+ " temperature is: ______\xB0C"); - +var ttip = d3.select("body").append("div") + .attr("class", "tooltip") + .style("opacity", 1); var layer = svg.selectAll(".layer") .data(layers) .enter().append("g") @@ -166,7 +168,7 @@ var rect = layer.selectAll("rect") var Offset = document.getElementById("graphSteak").offsetTop; var pos=parseInt(data[0].length-(event.pageY-Offset-margin.top)/(height/yStackMax)+1); var line=parseInt((event.pageX-margin.left)/(x.rangeBand()+1)-5.0); -$(d3.select('.mylabel')[0][0]).text( meatType+ " temperature is "+ data[line][pos].toFixed(2)+ "\xB0C"); +//$(d3.select('.mylabel')[0][0]).text( meatType+ " temperature is "+ data[line][pos].toFixed(2)+ "\xB0C"); //$(d3.select('.mylabel')[0][0]).text("Steak temperature is "+ pos+ "\xB0C"); $("line").remove(); var myLine = d3.select("svg").append("svg:line") @@ -175,6 +177,11 @@ $(d3.select('.mylabel')[0][0]).text( meatType+ " temperature is "+ data[line][po .attr("x2", width*31/30) .attr("y2", event.pageY-Offset-5) .style("stroke", "grey"); + var ttip=d3.select('.tooltip'); + ttip.html(data[line][pos].toFixed(2)+ "\xB0C") + .style("opacity", 1) + .style("left", (d3.event.pageX) + "px") + .style("top", (d3.event.pageY) + "px"); }) @@ -255,24 +262,24 @@ svg.append("text") .attr("x",-height+margin.bottom/3) .attr("transform", "rotate(-90)") .text("Side 2"); -var svgContainer = d3.select("body").append("svg") - .attr("width", '100%') - .attr("height", '80%'); +var svgContainer = d3.select(".span6").append("svg") + .attr("width", '50%') + .attr("height", '20%'); var texts=svgContainer.selectAll("text") .data([0]) .enter().append("text") .attr("text-anchor", "left") .attr("x", '10%') .attr("y", 10) -.text("Maximum internal temperature reached"); +.text("Final Protein State Reached"); //Draw the Rectangle var rectangle = svgContainer.selectAll("rect") .data(maxTemps.reverse()) .enter().append("rect") .attr("x", '10%') - .attr("y", function(d,i){return 20+i*5}) + .attr("y", function(d,i){return 20+i*1}) .attr("width", '60%') - .attr("height", 5) + .attr("height", 1) .style('fill', function(d,i) {return color[meatType](getState(d))}); /* svg.append("g") diff --git a/home-screen.html b/home-screen.html index 80d6297..9060c33 100644 --- a/home-screen.html +++ b/home-screen.html @@ -5,7 +5,6 @@ - @@ -16,6 +15,8 @@ + + @@ -101,8 +102,10 @@

Create Your Meat

+
+ diff --git a/perfectSteak.css b/perfectSteak.css index 985263d..b752758 100644 --- a/perfectSteak.css +++ b/perfectSteak.css @@ -57,4 +57,22 @@ input[type="text"] { #thickInpDiv, #tempInpDiv, #meatTypeDiv{ padding: 5px; margin:5px; +} +.toggleSwitch { + width: ...; + height: ...; + /* add other styling as appropriate to position element */ + position: relative; +} +.slider { + background-image: url(...); + position: absolute; + width: ...; + height: ...; +} +.slider.on { + right: 0; +} +.slider.off { + left: 0; } \ No newline at end of file diff --git a/perfectSteak.js b/perfectSteak.js index 8b458b5..7ecadee 100644 --- a/perfectSteak.js +++ b/perfectSteak.js @@ -19,18 +19,36 @@ var perfectSteak = function (div) { for (var h=0; h300||parseFloat($("#inp1_"+h).val())<0){ - console.log("ohno") - var side1Alert=$("
!
"); - $("#row"+h+"side1").append(side1Alert) + // if (parseFloat($("#inp1_"+h).val())>300){ + // var side1Alert=$("
Too high!
"); + // $("#row"+h+"side1").append(side1Alert); + // currentInfo["OKToGraph"]=false; + // } + if(parseFloat($("#inp1_"+h).val())<0){ + var side1Alert=$("
Too low!
"); + $("#row"+h+"side1").append(side1Alert); currentInfo["OKToGraph"]=false; } - if(parseFloat($("#inp2_"+h).val())>300||parseFloat($("#inp2_"+h).val())<0){ - console.log("ohno2") - var side2Alert=$("
!
"); + // if(parseFloat($("#inp2_"+h).val())>300){ + // var side2Alert=$("
Too high!
"); + // $("#row"+h+"side2").append(side2Alert); + // currentInfo["OKToGraph"]=false; + // } + if(parseFloat($("#inp2_"+h).val())<0){ + var side2Alert=$("
Too low!
"); $("#row"+h+"side2").append(side2Alert); currentInfo["OKToGraph"]=false; } + if(parseFloat($("#row"+h+"time").val())<0){ + var timeAlert=$("
Negative time
"); + $("#duration"+h).append(timeAlert); + currentInfo["OKToGraph"]=false; + } + // if(parseFloat($("#row"+h+"time").val())>7200){ + // var timeAlert=$("
Max 2 hours
"); + // $("#duration"+h).append(timeAlert); + // currentInfo["OKToGraph"]=false; + // } } } @@ -93,6 +111,7 @@ var perfectSteak = function (div) { } dataChange(newData); + } return { @@ -162,6 +181,7 @@ var perfectSteak = function (div) { } } + var buildDisplay = function () { console.log("isOK"+model.checkDiv()) console.log("OK"+model.currentInfo["OKToGraph"]) @@ -174,7 +194,7 @@ var perfectSteak = function (div) { $("#startModal").modal("show"); - cookButton = $("#cookButton"); + cookButton = $(".cookButton"); // // var thicknessInp = ($("
Meat Thickness (cm)
")); // thicknessInp.change(function(){ @@ -195,6 +215,32 @@ var perfectSteak = function (div) { // var cookbuttonrow = $("
Let's get cooking!"); +// +// var thicknessInp = ($("
Meat Thickness (cm)
")); +// thicknessInp.change(function(){ +// model.checkDiv(); +// if(clicked&&model.currentInfo["OKToGraph"]){graph()}}); +// var steakTemp = ($("
Initial Meat Temperature (°C)
")); +// steakTemp.change(function(){ +// model.checkDiv(); +// if(clicked&&model.currentInfo["OKToGraph"]){graph()}}); +// //Item to hold inputs of meat. Append meatInput to your display +// var meatInput=$('
What type of meat are you cooking?
' +// +'Steak
' +// +'Tuna
' +// +'Turkey
'); +// meatInput.change(function(){ +// model.checkDiv(); +// if(clicked&&model.currentInfo["OKToGraph"]){graph()}}); +// +// +// var cookbuttonrow = $("
Total Time(m:s)Duration (s)Side 1 (°C)Side 2 (°C)"); inputTable.append(inpTabHeader); @@ -232,7 +281,7 @@ var perfectSteak = function (div) { var minSecs=model.convertTime(i*timeStep); } var timeCol=$(""+minSecs+""); - var duration = $(""); + var duration = $(""); var inp1 = $(""); var inp2 = $(""); var step1Col = $(""); @@ -444,8 +493,13 @@ var graph=function(){ var model = Model(); var view = View(div, model); - $('.inputTable').offset({top:10}); - view.buildDisplay(); + + + + view.buildDisplay(); + $('.inputTable').offset({top:60}); + + }; return {