Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
stephensm authored and stephensm committed Jul 30, 2013
1 parent 91e4592 commit 8d11850
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
24 changes: 15 additions & 9 deletions graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 8 additions & 2 deletions heat-diffusion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<time_top_bottom.length; j++){
//set the conductivity of air to zero
Expand All @@ -234,7 +235,12 @@ var len= tempArray[0].length;
temperatures.push(temperatures[temperatures.length-1]);
}
var cnVector = make_crank_nicolson_vector();
calculate_next_cn(cnVector);
calculate_next_cn(cnVector);
for(var n=0; n<maxTemps.length; n++){
if(tempArray[tempArray.length-1][n] > maxTemps[n]){
maxTemps[n] = tempArray[tempArray.length-1][n];
}
}
}
}

Expand Down Expand Up @@ -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}

}

Expand Down
5 changes: 3 additions & 2 deletions sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

0 comments on commit 8d11850

Please sign in to comment.