From 3bfaae9177093fb758a256144f899091892b9bdb Mon Sep 17 00:00:00 2001 From: stephensm Date: Mon, 5 Aug 2013 10:13:24 -0400 Subject: [PATCH] Updated by Marissa --- drawSaved.js | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ graph.js | 86 +++++----------------------------------------------- 2 files changed, 93 insertions(+), 78 deletions(-) create mode 100644 drawSaved.js diff --git a/drawSaved.js b/drawSaved.js new file mode 100644 index 0000000..341e7cd --- /dev/null +++ b/drawSaved.js @@ -0,0 +1,85 @@ + +var drawFinished=function(myMeatType,myMaxTemps) + { + var getState=function(temp) + { + + for(var i=0;i=boundaries[myMeatType][i])return i; + } + return 6; + + }; + var myMaxs=[]; + + for (var x = 0; x < 7; x++) {myMaxs.push(0);} + var state=getState(myMaxTemps[0]); + + for(var j=0;j'); + dropdown.append($('')); + //$(".span6").append(dropdown); + var svgContainer = d3.select(".span6").append("svg") + .attr("width", '50%') + .attr("height", '200px') + .append("g") + .attr("transform", "translate(" + 45 + "," + 130 + ")"); + var legend = svgContainer.selectAll('g') + + .data(tempScale[myMeatType]) + + .enter() + .append('g') + .attr('class', 'legend') + .style('fill', "black"); + + + legend.append('rect') + .attr('x', function(d,i){return i<4? i*30-20:(i-4)*30-20}) + .attr('y', function(d, i){ return i<4? -125: -125+10}) + .attr('width', 8) + .attr('height', 8) + + .style('fill', function(d) { return color[myMeatType](d['position']) + + }); + + legend.append('text') + .data(myMaxs) + .attr('x', function(d,i){return i<4? i*30-12:(i-4)*30-12}) + .attr('y', function(d, i){ return i<4? -125+8: -125+18}) + .style('font-size','6pt') + .text(function(d){ return (100*d/(myMaxTemps.length)).toFixed(0) +"%"; }); +var texts=svgContainer.selectAll("text") +.data([0]) + .enter().append("text") + .attr("text-anchor", "left") + .attr("x", '-10%') + .attr("y", -130) +.text("Final Protein State Reached"); +//Draw the Rectangle +var rectangle = svgContainer.selectAll("rect") + .data([0,0,0,0,0,0,0].concat(myMaxTemps.reverse())) + .enter().append("rect") + .attr("x", '-10%') + .attr("y", function(d,i){return-130+ 20+i*1}) + .attr("width", '70%') + .attr("height", '1px') + .style('fill', function(d,i) { + return color[myMeatType](getState(d))}); + } \ No newline at end of file diff --git a/graph.js b/graph.js index 2fe3371..7dd9957 100644 --- a/graph.js +++ b/graph.js @@ -46,28 +46,8 @@ var n = boundaries[meatType].length*2+1, // number of layers dat.push(moves); } - maxTemps=maxTemps.splice(0,maxTemps.length-2); - var maxs = []; - for (var x = 0; x < 7; x++) maxs.push(0); - var state=getState(maxTemps[0]); - - for(var j=0;j