Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ooking

Conflicts:
	perfectSteak.js
  • Loading branch information
laurabreiman committed Aug 8, 2013
2 parents 483cb90 + b43c20b commit d6986a0
Show file tree
Hide file tree
Showing 5 changed files with 361 additions and 310 deletions.
10 changes: 5 additions & 5 deletions drawSaved.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var drawFinished=function(myMeatType,myMaxTemps,instructions,startingtemp,side)
var directions=[myMeatType+" starts at "+startingtemp+ "\xB0C"];
for(var i=0;i<instructions.length;i++)
{
directions.push(instructions[i][0]+" seconds at"+instructions[i][1]+"\xB0C and "+instructions[i][2]+"\xB0C"
directions.push(instructions[i][0]+" seconds at "+instructions[i][1]+"\xB0C and "+instructions[i][2]+"\xB0C"
);

}
Expand Down Expand Up @@ -62,7 +62,7 @@ var drawFinished=function(myMeatType,myMaxTemps,instructions,startingtemp,side)


legend.append('rect')
.attr('x', function(d,i){return (-20+(1-side)*95)+'%'})
.attr('x', function(d,i){return (-10+(1-side)*90)+'%'})
.attr('y', function(d, i){ return -125+i*10 })
.attr('width', 8)
.attr('height', 8)
Expand All @@ -73,7 +73,7 @@ var drawFinished=function(myMeatType,myMaxTemps,instructions,startingtemp,side)

legend.append('text')
.data(myMaxs)
.attr('x', function(d,i){return (-16+(1-side)*83)+'%'})
.attr('x', function(d,i){return (-5+(1-side)*80)+'%'})
.attr('y', function(d, i){ return -125+8+i*10})
.style('font-size','6pt')
.text(function(d){ return (100*d/(myMaxTemps.length)).toFixed(0) +"%"; });
Expand All @@ -82,7 +82,7 @@ var drawFinished=function(myMeatType,myMaxTemps,instructions,startingtemp,side)
var rectangle = svgContainer.selectAll("rect")
.data([0,0,0,0,0,0,0].concat(myMaxTemps.reverse()))
.enter().append("rect")
.attr("x", (-6+(1-side)*60)+'%')
.attr("x", (8+(1-side)*50)+'%')
.attr("y", function(d,i){return -160+i*4})
.attr("width", '10%')
.attr("height", '4px')
Expand All @@ -91,7 +91,7 @@ var rectangle = svgContainer.selectAll("rect")
var texts=svgContainer.selectAll("text")
.data([0,1,2,3,4,5,6].concat(directions))
.enter().append("text")
.attr("x", (-6+(side)*10)+'%')
.attr("x", ((side)*20)+'%')
.attr("width", '90%')
.attr("y", function(d,i){return -120+(i-7)*10})
.text(function(d){return d})
Expand Down
60 changes: 32 additions & 28 deletions graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var n = boundaries[meatType].length*2+1, // number of layers
yStackMax = d3.max(layers, function(layer) { return d3.max(layer, function(d) { return d.y0 + d.y; }); });

var margin = {top: 50, right: 10, bottom: 100, left: 50},
width = 960 - margin.left - margin.right,
width = 600 - margin.left - margin.right,
height = 300 - margin.top - margin.bottom;

var x = d3.scale.ordinal()
Expand All @@ -64,7 +64,7 @@ var x = d3.scale.ordinal()

var xscaled = d3.scale.linear()
.domain([0,m/timestep])
.range([width/30, width]);
.range([width/15, width*15/16]);

var y = d3.scale.linear()
.domain([0, yStackMax])
Expand Down Expand Up @@ -95,29 +95,25 @@ var make_y_axis=function() {
var svg = d3.select("body").append("svg")
.attr("class","mysteak")
.attr("id", "mysteak")
.attr("width", width + margin.left + margin.right)
// .attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var svg3= d3.select(".span3").append("svg")
.attr("class","containers")
.attr("width", width + margin.left + margin.right)
.attr("height", 180)
.append("g")
.attr("transform", "translate(" + margin.left + "," + 130 + ")");
var legend = svg3.selectAll('g')


var legend = svg.selectAll('g')

.data(tempScale[meatType])

.enter()
.append('g')
.attr('class', 'legend')
.attr('class', 'Biglegend')
.style('fill', "black");


legend.append('rect')
.attr('x', -30)
.attr('y', function(d, i){ return -125+i * 15;})
.attr('x', width)
.attr('y', function(d, i){ return i * 15;})
.attr('width', 8)
.attr('height', 8)

Expand All @@ -126,8 +122,8 @@ var svg3= d3.select(".span3").append("svg")
});

legend.append('text')
.attr('x', -18)
.attr('y', function(d, i){ return (-125+i * 15+8);})
.attr('x', width+10)
.attr('y', function(d, i){ return (i * 15+8);})
.text(function(d){ return d['info']; });

var ttip = d3.select("body").append("div")
Expand Down Expand Up @@ -158,31 +154,37 @@ var rect = layer.selectAll("rect")
if(color[meatType](i)==rects.style("fill")){loc=i;}
}

var leg=d3.selectAll('.legend')[0][boundaries[meatType].length-loc];

$(leg).css("fill","red");
var leg=d3.selectAll('.Biglegend')[0][boundaries[meatType].length-loc];

$(leg).css("fill","red");
for(var i=0;i<7;i++)
{
var text=d3.selectAll('.Biglegend text')[0][boundaries[meatType].length-i];
var line=parseInt((event.pageX-parseFloat($("body").css('margin-left'))-margin.left)/(x.rangeBand()+1)-4.0);
var info=tempScale[meatType][boundaries[meatType].length-i]['info'];
$(text).text( info +" " +(100*(dat[line][i]+dat[line][12-i])/m).toFixed(0)+ "%" );

}
})
.on("mousemove",function(){


var Offset = document.getElementById("graphSteak").offsetTop;
var pos=parseInt(data[0].length-(event.pageY-Offset-margin.top)/(height/yStackMax));
var line=parseInt((event.pageX-parseFloat($("body").css('margin-left'))-margin.left)/(x.rangeBand()+1)-2.0);
var pos=parseInt(data[0].length-(event.pageY-Offset-margin.top-200)/(height/yStackMax));
var line=parseInt((event.pageX-parseFloat($("body").css('margin-left'))-margin.left)/(x.rangeBand()+1)-4.0);

$("line").remove();
var myLine = d3.selectAll(".mysteak").append("svg:line")
.attr("x1", margin.left)
.attr("y1", event.pageY-Offset-1)
.attr("y1", event.pageY-Offset-200)
.attr("x2", width*31/30)
.attr("y2", event.pageY-Offset-1)
.attr("y2", event.pageY-Offset-200)
.style("stroke", "grey");
//console.log(d3.event.pageX-parseFloat($("body").css('margin-left')));
var ttip=d3.select('.tooltip');
ttip.html(data[line][pos].toFixed(2)+ "\xB0C")
//ttip.html(line.toFixed(2)+ "\xB0C")
// ttip.html(pos.toFixed(2)+ "\xB0C")
//ttip.html("please work")
.style("opacity", 1)
.style("left", (d3.event.pageX-parseFloat($("body").css('margin-left'))+5) + "px")
.style("top", (d3.event.pageY+5) + "px");
Expand All @@ -198,9 +200,11 @@ var line=parseInt((event.pageX-parseFloat($("body").css('margin-left'))-margin.l

if(color[meatType](i)==rects.style("fill")){loc=i;}
}
var leg=d3.selectAll('.legend')[0][boundaries[meatType].length-loc];
var leg=d3.selectAll('.Biglegend')[0][boundaries[meatType].length-loc];

$(leg).css("fill","black");



});
var imgstop = svg.selectAll("image").data(flame);
Expand All @@ -209,18 +213,18 @@ var imgstop = svg.selectAll("image").data(flame);
.attr("xlink:href", function(d){return d[1]==0? "flamedown.png":"flame.png"})
.attr("width", Math.min(x.rangeBand(),30))
.attr("height", Math.min(x.rangeBand(),30))
.attr("x", function(d){return (d[0]+2)*(x.rangeBand()+1)})
.attr("x", function(d){return (d[0]+3.75)*(x.rangeBand()+1)})
.attr("y", function(d){return -Math.min(x.rangeBand(),30)+(height+Math.min(x.rangeBand(),30))*d[1]})

var linktext = svg.selectAll("g.linklabelholder").data(flame);
linktext.enter().append("g").attr("class", "linklabelholder")
.append("text")
.attr("class", "linklabel")
.attr("dx", function(d){return (d[0]+2)*(x.rangeBand()+1)})
.attr("dx", function(d){return (d[0]+3.75)*(x.rangeBand()+1)})
.attr("dy", function(d){return -Math.min(x.rangeBand(),30)/1.2+(height+2*Math.min(x.rangeBand(),30))*d[1]})
.attr("text-anchor", "right")
.style("font-size", "8px")
.text(function(d,i) {console.log(flame);
.text(function(d,i) {

if(i==0){return d[2].toFixed(0)}
if(i==1&&flame[i][0]==flame[i-1][0]){return d[2].toFixed(0)}
Expand Down
1 change: 1 addition & 0 deletions heat-diffusion.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,5 @@ function HeatSolver(startingTemps,timestep,spacestep){
}

return {get_tempArray: get_tempArray, make_crank_nicolson_vector: make_crank_nicolson_vector, makecnLaplacian: makecnLaplacian, makeLaplacian: makeLaplacian, change_temp: change_temp, calculate_next_cn: calculate_next_cn, calculate_next_explicit: calculate_next_explicit, calculate_next_n_cn: calculate_next_n_cn, sixty_graph_arrays: sixty_graph_arrays, sixty_graph_arrays_duration: sixty_graph_arrays_duration, calculate_next_n_exp: calculate_next_n_exp}

}
16 changes: 11 additions & 5 deletions perfectSteak.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@

.dropdown{
top:100%;
overflow:scroll;
overflow:auto;
height:200px;

}

.btn{
font-size:8pt;
padding:2px;
}
.selectName{
position: absolute;
width: 30%;
Expand All @@ -44,10 +47,10 @@ overflow:scroll;
}

.table-container{
overflow-x: scroll;
overflow-x: auto;
overflow-y: auto;
width:100%;
height:200px;
height:160px;
font-size: 10px;
}
th{
Expand All @@ -57,7 +60,7 @@ th{
}
td{

margin:0!important;
margin:0!important;
padding:1px!important;
}

Expand All @@ -72,6 +75,9 @@ td{
position:relative;
width:100%
}
.closeRow{
margin-right:10px;
}
#subButton{
/* position: absolute;*/
position:relative;
Expand Down
Loading

0 comments on commit d6986a0

Please sign in to comment.