vis_files/generate_plots.js
/// Generates a frame for drawing a histogram
Generates a frame for drawing a histogram
Generates a frame for drawing a histogram
function histogram_frame(x,y,x1,y1,x2,y2,w,labx,laby,cats)
{
	dx = Math.floor(graphdx/cats.length);
	var wmax = 0;
	for(i = 0; i < cats.length; i++){
		var w = textwidth_simp(cats[i],CATFONT)
		if(w > wmax) wmax = w;
	}
	var dy = 0;
	if(wmax > dx) dy = wmax-20;
	graphdx = resdx - (x1+x2); graphdy = resdy - (y1+y2+dy);
	if(wmax > dx){    
		for(i = 0; i < cats.length; i++){
			xx = Math.floor(x1 + graphdx*i/cats.length);		
			addcanbutton(cats[i],xx,y2+graphdy+10,dx,10,-1,CATVERTBUT,-1,-1);
		}
	}
	else{             
		for(i = 0; i < cats.length; i++){
			xx = Math.floor(x1+graphdx*i/cats.length);		
			addcanbutton(cats[i],xx,y2+graphdy+5,dx,10,-1,CATBUT,-1,-1);
		}
	}
	addbutton("",x,y,resdx,resdy,CANVASBUT,CANVASBUT,-1,-1);
	addcanbutton("",x1,y2,graphdx,graphdy,-1,RESULTBUT3,-1,-1);		
	addcanbutton(labx,x1,y2+graphdy+30+dy,graphdx,30,-1,XLABELBUT,-1,-1);
	addcanbutton(laby,0,y2,30,graphdy,-1,YLABELBUT,-1,-1);
	if(nticky > 0) addcanbutton("Y ticks",x1-w,y2,w,graphdy,-1,YTICKTRBUT,-1,-1);
}
function histogram_frame ( x , y , x1 , y1 , x2 , y2 , w , labx , laby , cats ) { dx = Math . floor ( graphdx / cats . length ) ; var wmax = 0 ; for ( i = 0 ; i < cats . length ; i ++ ) { var w = textwidth_simp ( cats [ i ] , CATFONT ) if ( w > wmax ) wmax = w ; } var dy = 0 ; if ( wmax > dx ) dy = wmax - 20 ; graphdx = resdx - ( x1 + x2 ) ; graphdy = resdy - ( y1 + y2 + dy ) ; if ( wmax > dx ) { for ( i = 0 ; i < cats . length ; i ++ ) { xx = Math . floor ( x1 + graphdx * i / cats . length ) ; addcanbutton ( cats [ i ] , xx , y2 + graphdy + 10 , dx , 10 , - 1 , CATVERTBUT , - 1 , - 1 ) ; } } else { for ( i = 0 ; i < cats . length ; i ++ ) { xx = Math . floor ( x1 + graphdx * i / cats . length ) ; addcanbutton ( cats [ i ] , xx , y2 + graphdy + 5 , dx , 10 , - 1 , CATBUT , - 1 , - 1 ) ; } } addbutton ( "" , x , y , resdx , resdy , CANVASBUT , CANVASBUT , - 1 , - 1 ) ; addcanbutton ( "" , x1 , y2 , graphdx , graphdy , - 1 , RESULTBUT3 , - 1 , - 1 ) ; addcanbutton ( labx , x1 , y2 + graphdy + 30 + dy , graphdx , 30 , - 1 , XLABELBUT , - 1 , - 1 ) ; addcanbutton ( laby , 0 , y2 , 30 , graphdy , - 1 , YLABELBUT , - 1 , - 1 ) ; if ( nticky > 0 ) addcanbutton ( "Y ticks" , x1 - w , y2 , w , graphdy , - 1 , YTICKTRBUT , - 1 , - 1 ) ; }
Generates a frame for drawing a histogram
Generates a frame for drawing a histogram
// Labels are placed vertically // Labels 