vis_files/generate_plots.js
/// Draws the heading for the table
Draws the heading for the table
Draws the heading for the table
function table(x,y,tab)
{
	plottype = "table"; 
	var linemax = Math.floor((resdy-60)/tabledy);
	graphdx = resdx-40; 
	graphdy = (1+linemax)*tabledy;
	var head = tab.heading;
	var ele = tab.ele;
	var xx = 0, xxst=[];
	for(c = 0; c < head.length; c++){
		var wmax = 0;
		var w = textwidth_simp(head[c],TABLEHEADFONT);
		if(w > wmax) wmax = w;
		for(row = 0; row < ele.length; row++){
			var w = textwidth_simp(ele[row][c],TABLEFONT);
			if(w > wmax) wmax = w;
		}		
		wmax += 10;
		xxst[c] = xx;
		xx += wmax;
	}
	var gap = 8;
	tabx_slidefrac = graphdx/xx; 
	if(tabx_slidefrac < 1){	
		addbutton("",x,y+graphdy+gap,graphdx,10,TABXSLIDEBUT,TABXSLIDEBUT,-1,-1);
	}
	var dx = Math.floor(tabx_slide*xx);
	for(c = 0; c < head.length; c++){
		var xx = xxst[c] - dx;
		addcanbutton(head[c],xx,0,wmax,tabledy,-1,TABLEHEADBUT,-1,-1);
		var jjmin = Math.floor(taby_slide*ele.length*1.001);
		var jjmax = jjmin + linemax; if(jjmax > ele.length) jjmax = ele.length;
		for(j = jjmin; j < jjmax; j++){
			if(c == 0) addcanbutton(ele[j][c],xx,tabledy*(j-jjmin+1),xxst[c+1]-xxst[c],tabledy,LINKBUT,LINKBUT,j,-1);
			if(c == 0) addcanbutton(ele[j][c],xx,tabledy*(j-jjmin+1),xxst[c+1]-xxst[c],tabledy,LINKBUT,LINKBUT,j,-1);
			else addcanbutton(ele[j][c],xx,tabledy*(j-jjmin+1),0,tabledy,-1,TABLEBUT,-1,-1);
		}
	}
	addbutton("",x,y,graphdx,graphdy,CANVASBUT,CANVASBUT,-1,-1);
	taby_slidefrac = linemax/ele.length; 
	if(taby_slidefrac < 1){	
		addbutton("",x+graphdx+gap,y+tabledy,10,graphdy-tabledy,TABYSLIDEBUT,TABYSLIDEBUT,-1,-1);
	}
}
function table ( x , y , tab ) { plottype = "table" ; var linemax = Math . floor ( ( resdy - 60 ) / tabledy ) ; graphdx = resdx - 40 ; graphdy = ( 1 + linemax ) * tabledy ; var head = tab . heading ; var ele = tab . ele ; var xx = 0 , xxst = [ ] ; for ( c = 0 ; c < head . length ; c ++ ) { var wmax = 0 ; var w = textwidth_simp ( head [ c ] , TABLEHEADFONT ) ; if ( w > wmax ) wmax = w ; for ( row = 0 ; row < ele . length ; row ++ ) { var w = textwidth_simp ( ele [ row ] [ c ] , TABLEFONT ) ; if ( w > wmax ) wmax = w ; } wmax += 10 ; xxst [ c ] = xx ; xx += wmax ; } var gap = 8 ; tabx_slidefrac = graphdx / xx ; if ( tabx_slidefrac < 1 ) { addbutton ( "" , x , y + graphdy + gap , graphdx , 10 , TABXSLIDEBUT , TABXSLIDEBUT , - 1 , - 1 ) ; } var dx = Math . floor ( tabx_slide * xx ) ; for ( c = 0 ; c < head . length ; c ++ ) { var xx = xxst [ c ] - dx ; addcanbutton ( head [ c ] , xx , 0 , wmax , tabledy , - 1 , TABLEHEADBUT , - 1 , - 1 ) ; var jjmin = Math . floor ( taby_slide * ele . length * 1.001 ) ; var jjmax = jjmin + linemax ; if ( jjmax > ele . length ) jjmax = ele . length ; for ( j = jjmin ; j < jjmax ; j ++ ) { if ( c == 0 ) addcanbutton ( ele [ j ] [ c ] , xx , tabledy * ( j - jjmin + 1 ) , xxst [ c + 1 ] - xxst [ c ] , tabledy , LINKBUT , LINKBUT , j , - 1 ) ; if ( c == 0 ) addcanbutton ( ele [ j ] [ c ] , xx , tabledy * ( j - jjmin + 1 ) , xxst [ c + 1 ] - xxst [ c ] , tabledy , LINKBUT , LINKBUT , j , - 1 ) ; else addcanbutton ( ele [ j ] [ c ] , xx , tabledy * ( j - jjmin + 1 ) , 0 , tabledy , - 1 , TABLEBUT , - 1 , - 1 ) ; } } addbutton ( "" , x , y , graphdx , graphdy , CANVASBUT , CANVASBUT , - 1 , - 1 ) ; taby_slidefrac = linemax / ele . length ; if ( taby_slidefrac < 1 ) { addbutton ( "" , x + graphdx + gap , y + tabledy , 10 , graphdy - tabledy , TABYSLIDEBUT , TABYSLIDEBUT , - 1 , - 1 ) ; } }
Draws the heading for the table
Draws the heading for the table