diff --git a/graph.js b/graph.js index eed4d61..b73bde0 100644 --- a/graph.js +++ b/graph.js @@ -257,19 +257,25 @@ 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", 200) - .attr("height", 200); - +var svgContainer = d3.select("body").append("svg") + .attr("width", '100%') + .attr("height", 1000); +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"); //Draw the Rectangle var rectangle = svgContainer.selectAll("rect") .data(maxTemps) .enter().append("rect") - .attr("x", 10) - .attr("y", function(d,i){return 10+i}) - .attr("width", '70%') - .attr("height", 1) - .style('fill', function(d,i) {console.log(color[meatType](getState(d))); return color[meatType](getState(d))}); + .attr("x", '10%') + .attr("y", function(d,i){return 20+i*2}) + .attr("width", '60%') + .attr("height", 2) + .style('fill', function(d,i) {return color[meatType](getState(d))}); /* svg.append("g") .attr("class", "grid") diff --git a/heat-diffusion.js b/heat-diffusion.js index 946238f..2da0b87 100644 --- a/heat-diffusion.js +++ b/heat-diffusion.js @@ -208,6 +208,7 @@ var len= tempArray[0].length; var graphlabels = []; var temperatures = []; var count=0; + var maxTemps = tempArray[0]; for(var j=0; j maxTemps[n]){ + maxTemps[n] = tempArray[tempArray.length-1][n]; + } + } } } @@ -271,7 +277,7 @@ var len= tempArray[0].length; } - return {temps: grapharray, points: graphlabels, step: step} + return {temps: grapharray, points: graphlabels, step: step, maxTemps: maxTemps} } diff --git a/sample.js b/sample.js index 493219c..dbbf47c 100644 --- a/sample.js +++ b/sample.js @@ -6,7 +6,8 @@ var Thedata=myheatsolver.sixty_graph_arrays_duration(data); var sampledata=Thedata.temps; var flame=Thedata.points; var timestep=1/Thedata.step; - -graphSteak(sampledata,flame,timestep,meatType); +var maxTemps=Thedata.maxTemps; + console.log(maxTemps); +graphSteak(sampledata,flame,timestep,meatType,maxTemps); } \ No newline at end of file