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 @@