vis_files/generate_plots.js
/// Sets up a frame for drawing the compartmental model
Sets up a frame for drawing the compartmental model
Sets up a frame for drawing the compartmental model
function compmodel_frame(vis)
{
	graphdx = mapdx; graphdy = mapdy;
	addbutton("",menux,0,mapdx,mapdy,CANVASBUT,CANVASBUT,-1,-1);
	addcanbutton("",0,0,graphdx,graphdy,-1,RESULTBUT2,-1,-1);	
	var comp = model.comp;	
	var shiftx = (mapdx-mapdy)/2;
	var h = 25 - comp.length;
	if(h > 20) h = 20; if(h < 15) h = 15;
	for(k = 0; k < comp.length; k++){  
		if(comp[k].label != null){
			var x = shiftx + mapdy*comp[k].x;
			var y = mapdy*(0.5 + (comp[k].y+comp[k].h/2));
			var texth = Math.floor(0.8*h); 
			var font = texth+"px times";
			var text = comp[k].label;
			lab = splitintosub(text,font);
			w = lab[lab.length-1].w+lab[lab.length-1].dw;
			w += 6;
			addcanbutton(text,x-w/2,y,w,h,VARIABLEBUT,VARIABLEBUT,font,comp[k].mean);
		}
	}		
	var h = 30 - comp.length;
	if(h > 24) h = 24; if(h < 15) h = 15;
	var trans = model.trans;	
	for(k = 0; k < trans.length; k++){  
		if(trans[k].label != null){
			var x = shiftx + mapdy*trans[k].labelx;
			var y = mapdy*(0.5 + (trans[k].labely));
			var texth = Math.floor(0.8*h); 
			var font = texth+"px times";
			var text = trans[k].label;
			w = textwidth(text,font);
			orth = h*0.7;
			addcanbutton(text,x-w/2 +orth*trans[k].labelnx ,y-h/2+orth*trans[k].labelny,w,h,VARIABLEBUT,VARIABLEBUT,font,trans[k].prob);
		}
	}		
}
function compmodel_frame ( vis ) { graphdx = mapdx ; graphdy = mapdy ; addbutton ( "" , menux , 0 , mapdx , mapdy , CANVASBUT , CANVASBUT , - 1 , - 1 ) ; addcanbutton ( "" , 0 , 0 , graphdx , graphdy , - 1 , RESULTBUT2 , - 1 , - 1 ) ; var comp = model . comp ; var shiftx = ( mapdx - mapdy ) / 2 ; var h = 25 - comp . length ; if ( h > 20 ) h = 20 ; if ( h < 15 ) h = 15 ; for ( k = 0 ; k < comp . length ; k ++ ) { if ( comp [ k ] . label != null ) { var x = shiftx + mapdy * comp [ k ] . x ; var y = mapdy * ( 0.5 + ( comp [ k ] . y + comp [ k ] . h / 2 ) ) ; var texth = Math . floor ( 0.8 * h ) ; var font = texth + "px times" ; var text = comp [ k ] . label ; lab = splitintosub ( text , font ) ; w = lab [ lab . length - 1 ] . w + lab [ lab . length - 1 ] . dw ; w += 6 ; addcanbutton ( text , x - w / 2 , y , w , h , VARIABLEBUT , VARIABLEBUT , font , comp [ k ] . mean ) ; } } var h = 30 - comp . length ; if ( h > 24 ) h = 24 ; if ( h < 15 ) h = 15 ; var trans = model . trans ; for ( k = 0 ; k < trans . length ; k ++ ) { if ( trans [ k ] . label != null ) { var x = shiftx + mapdy * trans [ k ] . labelx ; var y = mapdy * ( 0.5 + ( trans [ k ] . labely ) ) ; var texth = Math . floor ( 0.8 * h ) ; var font = texth + "px times" ; var text = trans [ k ] . label ; w = textwidth ( text , font ) ; orth = h * 0.7 ; addcanbutton ( text , x - w / 2 + orth * trans [ k ] . labelnx , y - h / 2 + orth * trans [ k ] . labelny , w , h , VARIABLEBUT , VARIABLEBUT , font , trans [ k ] . prob ) ; } } }
Sets up a frame for drawing the compartmental model
Sets up a frame for drawing the compartmental model
//var dx = 22, dy = 26; //addcanbutton("",mapdx-dx-dx-15,10,dx,dy,ZOOMINBUT,ZOOMINBUT,-1,-1); //addcanbutton("",mapdx-dx-10,10,dx,dy,ZOOMOUTBUT,ZOOMOUTBUT,-1,-1); 