vis_files/generate_plots.js
/// Generates a frame for displaying the age mixing matrix
Generates a frame for displaying the age mixing matrix
Generates a frame for displaying the age mixing matrix
function matrixframe(x,y,vis)
{
	w = 0;
	for(i = 0; i < vis.ages.length; i++){
		ww = textwidth(vis.ages[i],TICKFONT);
		if(ww > w) w = ww;
	}
	w = Math.floor(w+20);
	x2 = 20; y1 = w; y2 = 20;
	graphdy = resdy - (y1+y2);
	graphdx = graphdy; 
	x1 = mapdx/2-graphdx/2;
	addbutton("",x,y,resdx,resdy,CANVASBUT,CANVASBUT,-1,-1);
	addcanbutton("",x1,y2,graphdx,graphdy,-1,RESULTBUT4,-1,-1);		
	d = graphdx/vis.ages.length;
	for(i = 0; i < vis.ages.length; i++){
		addcanbutton(vis.ages[i],x1+Math.floor(i*d),y2 + graphdy,Math.floor(d),w,-1,MATRIXXBUT,-1,-1);
		addcanbutton(vis.ages[i],x1-w,y2 + Math.floor(i*d),w,Math.floor(d),-1,MATRIXYBUT,-1,-1);
	}
}
function matrixframe ( x , y , vis ) { w = 0 ; for ( i = 0 ; i < vis . ages . length ; i ++ ) { ww = textwidth ( vis . ages [ i ] , TICKFONT ) ; if ( ww > w ) w = ww ; } w = Math . floor ( w + 20 ) ; x2 = 20 ; y1 = w ; y2 = 20 ; graphdy = resdy - ( y1 + y2 ) ; graphdx = graphdy ; x1 = mapdx / 2 - graphdx / 2 ; addbutton ( "" , x , y , resdx , resdy , CANVASBUT , CANVASBUT , - 1 , - 1 ) ; addcanbutton ( "" , x1 , y2 , graphdx , graphdy , - 1 , RESULTBUT4 , - 1 , - 1 ) ; d = graphdx / vis . ages . length ; for ( i = 0 ; i < vis . ages . length ; i ++ ) { addcanbutton ( vis . ages [ i ] , x1 + Math . floor ( i * d ) , y2 + graphdy , Math . floor ( d ) , w , - 1 , MATRIXXBUT , - 1 , - 1 ) ; addcanbutton ( vis . ages [ i ] , x1 - w , y2 + Math . floor ( i * d ) , w , Math . floor ( d ) , - 1 , MATRIXYBUT , - 1 , - 1 ) ; } }
Generates a frame for displaying the age mixing matrix
Generates a frame for displaying the age mixing matrix