vis_files/generate_plots.js
/// Displays the equation for the force of infection
Displays the equation for the force of infection
Displays the equation for the force of infection
function display_foi()
{
	y = 50;
	addbutton("",menux,0,mapdx,mapdy,CANVASBUT,CANVASBUT,-1,-1);
	var si = 30;
	var w;
	do{
		var fl = false;
		var font = si+"px times";
		w = textwidth(foi.name,font)+3; 
		w += textwidth("=",font)+3; 
		for(i = 0; i < foi.eq.length; i++) w += textwidth(foi.eq[i].text,font)+3; 
		if(w < mapdx-100) x = Math.floor(mapdx/2-w/2);
		else{ si--; fl = true;}
	}while(fl == true);
	var text = foi.name;
	w = textwidth(text,font)+3; 
	h = 25;
	addcanbutton(text,x,y,w,h,-1,EQBUT3,font,-1);
	x += w;
	text = "=";
	w = textwidth(text,font)+3; 
	addcanbutton(text,x,y,w,h,-1,EQBUT3,font,-1);
	x += w;
	for(i = 0; i < foi.eq.length; i++){
		text = foi.eq[i].text;
		w = textwidth(text,font)+3; 
		if(foi.eq[i].param != null){
			addcanbutton(text,x,y,w,h,EQBUT,EQBUT,font,foi.eq[i].param);
		}
		else{
			addcanbutton(text,x,y,w,h,-1,EQBUT3,font,-1);
		}
		x += w;
	}
	si = 15;
	do{
		var fl = false;
		var font = si+"px arial";
		var wmax = 0;
		for(i = 0; i < foi.desc.length; i++){
			w = textwidth(foi.desc[i],font);
			if(w > wmax) wmax = w;
		}
		if(wmax < mapdx-100) x = Math.floor(mapdx/2-wmax/2);
		else{ si--; fl = true;}
	}while(fl == true);
	y = 110; 
	var dy = (mapdy - y-30)/foi.desc.length; if(dy > 30) dy = 30; if(dy < 17) dy = 17;
	for(i = 0; i < foi.desc.length; i++){
		addcanbutton(foi.desc[i],x,y+dy*i,w,h,-1,EQBUT2,font,-1);
	}
}
function display_foi ( ) { y = 50 ; addbutton ( "" , menux , 0 , mapdx , mapdy , CANVASBUT , CANVASBUT , - 1 , - 1 ) ; var si = 30 ; var w ; do { var fl = false ; var font = si + "px times" ; w = textwidth ( foi . name , font ) + 3 ; w += textwidth ( "=" , font ) + 3 ; for ( i = 0 ; i < foi . eq . length ; i ++ ) w += textwidth ( foi . eq [ i ] . text , font ) + 3 ; if ( w < mapdx - 100 ) x = Math . floor ( mapdx / 2 - w / 2 ) ; else { si -- ; fl = true ; } } while ( fl == true ) ; var text = foi . name ; w = textwidth ( text , font ) + 3 ; h = 25 ; addcanbutton ( text , x , y , w , h , - 1 , EQBUT3 , font , - 1 ) ; x += w ; text = "=" ; w = textwidth ( text , font ) + 3 ; addcanbutton ( text , x , y , w , h , - 1 , EQBUT3 , font , - 1 ) ; x += w ; for ( i = 0 ; i < foi . eq . length ; i ++ ) { text = foi . eq [ i ] . text ; w = textwidth ( text , font ) + 3 ; if ( foi . eq [ i ] . param != null ) { addcanbutton ( text , x , y , w , h , EQBUT , EQBUT , font , foi . eq [ i ] . param ) ; } else { addcanbutton ( text , x , y , w , h , - 1 , EQBUT3 , font , - 1 ) ; } x += w ; } si = 15 ; do { var fl = false ; var font = si + "px arial" ; var wmax = 0 ; for ( i = 0 ; i < foi . desc . length ; i ++ ) { w = textwidth ( foi . desc [ i ] , font ) ; if ( w > wmax ) wmax = w ; } if ( wmax < mapdx - 100 ) x = Math . floor ( mapdx / 2 - wmax / 2 ) ; else { si -- ; fl = true ; } } while ( fl == true ) ; y = 110 ; var dy = ( mapdy - y - 30 ) / foi . desc . length ; if ( dy > 30 ) dy = 30 ; if ( dy < 17 ) dy = 17 ; for ( i = 0 ; i < foi . desc . length ; i ++ ) { addcanbutton ( foi . desc [ i ] , x , y + dy * i , w , h , - 1 , EQBUT2 , font , - 1 ) ; } }
Displays the equation for the force of infection
Displays the equation for the force of infection