v21i042: 2D graphic system with table beautifier, Part11/14

Rich Salz rsalz at uunet.uu.net
Sat Mar 24 06:22:05 AEST 1990


Submitted-by: Steve Grubb <uunet!lsr-vax!scg>
Posting-number: Volume 21, Issue 42
Archive-name: ipl/part11

# ipl part11
#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#---------------------- cut here -----------------------------
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#		src/util.c
#		src/vbargraph.c
#		src/vector.c
#		src/viplmenu.c
#		src/vrangebar.c
#		examples/absunits.g
#		examples/areadef1.g
#		examples/areadef2.g
#		examples/arrow.g
#		examples/bargraph1.g
cat << \SHAR_EOF > src/util.c
#include "gdp.x"

extern char *getlogin();

/* ============== */
/* save_spec() can be called to save current proc specification in file s. */
save_parms( s )
char s[];
{
char fnm[PATHNAME_LEN];
FILE *fp;
int i;

sprintf( fnm, "%s/ipl%s%d.%s", TEMPDIR, getlogin(), getpid(), s );
fp = fopen( fnm, "w" );
if( fp == NULL ) { fprintf( stderr, "Can't w open inherit file %s.\n", fnm ); gdp_exit(); }
for( i = 0; i < Clines; i++ ) fprintf( fp, "%s", Chunk[i] );
fclose( fp );
}

/* =============== */
/* load_spec() can be called to use parameters from file s as defaults. */
load_parms( s )
char s[];
{
char fnm[PATHNAME_LEN];
FILE *fp;

if( strlen( s ) < 1 ) { Ilines = 0; return( 1 ); }
sprintf( fnm, "%s/ipl%s%d.%s", TEMPDIR, getlogin(), getpid(), s );
fp = fopen( fnm, "r" );
if( fp == NULL ) { fprintf( stderr, "Can't open inheritance file %s.\n", fnm ); gdp_exit(); }
Ilines = 0;
while( fgets( Ichunk[ Ilines ], INWIDTH, fp ) != NULL ) Ilines++;
fclose( fp );
}

/* ============== */
/* gdp_exit() can be used by application to explicitly do a clean exit */
gdp_exit()
{
char com[80];
sprintf( com, "rm %s/ipl%s%d* 2> /dev/null", TEMPDIR, getlogin(), getpid() );
system( com );
proc_call( "Exit" );
exit();
}

/* =============
   ============= */
/* The following are utilities for dealing with multi-line responses */
/* ========= */
/* getln() returns successive portions of s as separated by \n */

char *getln( s )
char s[];
{
static char rtn[INWIDTH];
static int c = 0;
int l, start;

/* a null argument resets */
if( strlen( s ) < 1 ) {
	c = 0;
	return( "" );
	}
start = c;
for( ; c < strlen( s ); c++ ) if( s[c] == '\n' ) break;
strncpy( rtn, &s[start], c-start );
rtn[ c-start ] = '\0';
c++;
return( rtn );
}


/* ======= */
/* countln() returns number of \n separated lines in s */

countln( s )
char s[];
{
int i, nnl;
if( strlen( s ) < 1 ) return( 0 );
nnl = 0;
for( i = 0; i < strlen( s ) -1; i++ ) if( s[i] == '\n' ) nnl++;
nnl++;
return( nnl );
}

/* ======== */
/* text_tofile() places text s into file f */

text_tofile( s, f )
char s[], f[];
{
FILE *fp;

fp = fopen( f, "w" );
if( fp == NULL ) { fprintf( stderr, "text_tofile: can't open Tempfile.\n" ); exit(); }
fprintf( fp, "%s\n", s );
fclose( fp );
}


/* ============ */
/* main program for testing these routines. */
/* main() 
{
char s[30];
char *getln();
strcpy( s, "Hello\nworld\nhello\n" );
printf( "%d\n", countln( s ) );
printf( "%s\n", getln( s ) );
printf( "%s\n", getln( s ) );
printf( "%s\n", getln( s ) );
strcpy( s, "Hello\nworld\nhello" );
printf( "%d\n", countln( s ) );
printf( "%s\n", getln( s ) );
printf( "%s\n", getln( s ) );
printf( "%s\n", getln( s ) );
text_tofile( s, "/usr/tmp/testutil001" );
}
*/
SHAR_EOF
############################

cat << \SHAR_EOF > src/vbargraph.c
#include "ipl.x"
#define STACK	0
#define CLUSTER 1


Vbargraph( )
{
int 	k[8], 
	idf[8],
	format,
	label,
	n,
	nc,
	i, j, jj,
	p,
	start,
	yset,
	yfld,
	outline;

double s[8],
	accum,
	zer,
	cury,
	yspace,
	subspace,
	x,
	x2,
	f,
	lblpos,
	sep,
	msep = 0.03;
char str[10];


/* get the data field list */
gget( Buf, "Field" ); 
n = 0;
while( n < 1 ) { 
	n = sscanf( Buf, "%d %d %d %d %d %d %d %d", &k[0], &k[1], &k[2], &k[3], &k[4], &k[5], &k[6], &k[7] );
	if( N_d_fields == 1 ) strcpy( Buf, "1" );
	else if( n < 1 ) { fprintf( stderr, "Field bad\n" ); gdp_exit(); }
	}
for( i = 0; i < n; i++ ) 
	if( k[i] < 1 || k[i] > N_d_fields ) { fprintf( stderr, "Field out of range" ); gdp_exit(); }

/* get the label field list, if any */
gget( Buf, "Idfield" ); 
if( strlen( Buf ) > 0 ) { 
	label = YES;
	sscanf( Buf, "%d %d %d %d %d %d %d %d", &idf[0], &idf[1], &idf[2], &idf[3], &idf[4], &idf[5], &idf[6], &idf[7] );
	for( i = 0; i < n; i++ ) 
		if( idf[i] < 1 || idf[i] > N_d_fields ) { fprintf( stderr, "Idfield bad.\n" ); gdp_exit(); }
	}
else label = NO;


gget( Buf, "Format" );  
if( strcmp( Buf, "stack" )==0 ) format = STACK;
else format = CLUSTER;

DYtic = 1.0;

/* get bar shades */
gget( Buf, "Shade" ); 
sscanf( Buf, "%lf %lf %lf %lf %lf %lf %lf %lf", &s[0], &s[1], &s[2], &s[3], &s[4], &s[5], &s[6], &s[7] );

/* get zero line */
gget( Buf, "Zeroat" ); 
if( goodnum( Buf, &p )) zer = atof( Buf );
else zer = DXlo;

/* get label size */
if( label ) { gget( Buf, "Idfield.size" ); NTptsize( atof( Buf ) ) };

/* distance of label from bar top */
if( label ) { gget( Buf, "Idfield.position" ); lblpos = atof( Buf ); }

/* outline or not */
gget( Buf, "Outlinebars" ); if( Buf[0] == 'y' ) outline = YES; else outline = NO;

/* x distance between major bar spaces */
gget( Buf, "Separation" ); sep = atof( Buf );

gget( Buf, "Separation.sub" ); msep = atof( Buf );


yspace = ( (Yhi-Ylo)/((DYhi-DYlo)+1) ) - (sep*Scale_y);

if( format == CLUSTER ) nc = n; else nc = 1;

gget( Buf, "Killwild" ); /* option for aborting plot if any values out of range */
if( atof( Buf ) != 0 ) {
	for( i = 1; i <= N_d_rows; i++ ) {
		if( atof( D[i-1][ k[0] -1 ] ) > atof( Buf ) ) {
			fprintf( stderr, "Note: This Vbargraph terminated due to a value of %s.\n", D[i-1][k[0]-1] );
			return( 0 );
			}
		}
	}

gget( Buf, "Yfield" ); /* allow placement of bars by a data field */
if( strlen( Buf ) > 0 ) {
	yset = 1;
	yfld = atoi( Buf );
	if( yfld < 1 || yfld > N_d_fields ) { fprintf( stderr, "Yfield bad.\n" ); gdp_exit(); }
	}
else yset = 0;

gget( Buf, "Ystart.0or1" ); /* allow starting at 0 or 1 */
if( Buf[0] == '0' ) { start = 0; }
else { start = 1; }

for( i = 1; i <= N_d_rows; i++ ) {
	if( yset ) cury = da_y( atof( D[i-1][yfld-1] ) ) - (yspace/2);
	else cury = da_y((double)(DYlo+i+(start-1))) - (yspace/2);
	subspace = ( yspace / nc );
	for( j = 0; j < nc; j++ ) {
		if( !goodnum( D[i-1][ k[j]-1 ], &p )) {
			fprintf( stderr, "Warning: row %d, field %d, is bad (%s)\n", i, k[j], D[i-1][ k[j]-1] );
			cury += subspace;
			continue;
			}
		x = atof(D[i-1][ k[j]-1 ]);
		if( x != DXlo )
		    ab_rect( da_x(zer), cury, da_x(x), cury+(subspace-msep), s[j], (s[j]==1)?1:outline );
		if( label ) {
			if( x < zer || format == STACK ) f = (-lblpos)-Chh; else f = lblpos;
			strcpy( str, D[i-1][ idf[j]-1 ] );
			NTmov( da_x(x)+f, cury );
			NTtext( str ); /* will change */
			}
		if( format == STACK ) for( jj = 1; jj < n; jj++ ) {
			if( !goodnum( D[i-1][ k[jj] -1 ], &p ) ) {
				fprintf( stderr, "Warning: row %d, field %d, is bad (%s)\n", i, k[jj], D[i-1][k[jj]-1] );
				continue;
				}
			x2 = x + atof( D[i-1][ k[jj] -1 ] );
			if( x2 != DXlo )
			   ab_rect( da_x(x), cury,  da_x(x2), cury+(subspace-msep), s[jj], (s[jj]==1)?1:outline );
			if( label ) {
				if( x2 < zer || format == STACK ) f = (-lblpos)-Chh; else f = lblpos;
				NTmov( da_x(x2)+f, cury );
				strcpy( str, D[i-1][ idf[jj]-1 ] );
				NTtext( str );
				}
			x = x2;
			}

		cury += subspace;
		}
	}

gget( Buf, "Segment" );
if( Buf[0] == 'y' ) 
	for( f = DXlo+DXtic; f < DXhi; f += DXtic ) 
		rect(  f-(DXhi*0.003), DYlo + 0.2, f+(DXhi*0.004), DYhi - 0.2, (double)WHITE, 0 );
}
SHAR_EOF
############################

cat << \SHAR_EOF > src/vector.c
#include "ipl.x"

Vector( )
{
int i, fx1, fy1, fx2, fy2;
double hl, hw, hs;

gget( Buf, "Point1fields" ); sscanf( Buf, "%d %d", &fx1, &fy1 );
gget( Buf, "Point2fields" ); sscanf( Buf, "%d %d", &fx2, &fy2 );
gget( Buf, "Headlength" ); hl = atof( Buf );
gget( Buf, "Headwidth" ); hw = atof( Buf );
gget( Buf, "Headshade" ); hs = atof( Buf );

for( i = 0; i < N_d_rows; i++ ) {
	arr( da_x( atof( D[i][fx1-1] ) ), da_y( atof( D[i][fy1-1] ) ),
	     da_x( atof( D[i][fx2-1] ) ), da_y( atof( D[i][fy2-1] ) ),
		hw, hl, hs );
	}
}
SHAR_EOF
############################

cat << \SHAR_EOF > src/viplmenu.c
/* Vipl allows addition of text, arrows, etc. */

#include "ipl.x"

FILE *hfp, *ofp;
char holdingfile[80], outfile[80], dispfile[80];

vipl_sequence( cfile )
char cfile[];
{
char buf[2000], command[30], area[30];
double x, y, x2, y2;
int i, size;
FILE *fp;
char textsize[40], textfont[40], linethick[40], linedash[40], dashsize[40];
strcpy( textsize, "10" );
strcpy( textfont, "/Helvetica" );
strcpy( linethick, "0.8" );
strcpy( linedash, "0" );
strcpy( dashsize, "3" );




/* open holding file */
sprintf( holdingfile, "%s/%siplhold%05d", INSTALL_TMP, getlogin(), getpid() );
hfp = fopen( holdingfile, "w" );
if( hfp == NULL ) { fprintf( stderr, "Cannot open holding file\n" ); gdp_exit(); }

/* get dispfile name */
sprintf( dispfile, "%s/%sipldisp%05d", INSTALL_TMP, getlogin(), getpid() );

/* initialize ofp */
sprintf( outfile, "%s/%siplout%05d", INSTALL_TMP, getlogin(), getpid() );
ofp = fopen( outfile, "w" );
if( ofp == NULL ) { fprintf( stderr, "Cannot open output file\n" ); gdp_exit(); }
fclose( ofp );

libdisplay( "viplstartup.g", 1 );

fp = fopen( cfile, "r" );
if( fp == NULL ) { message( cfile, "doen't exist.", "", "Creating a new plot.." ); sleep( 1 ); }
else fclose( fp );
fp = fopen( cfile, "a" );
if( fp == NULL ) { message( "NOTE:", "This file is READ-ONLY", "", "" ); sleep( 1 ); }
else fclose( fp );

/* copy user's control file to output file to start off.. */
sprintf( buf, "cp %s %s 2> /dev/null", cfile, outfile );
system( buf );

getpick( buf, "Start", 1, 1 );
userdisplay( 1 );

while( 1 ) {

	message( "", "Main menu.", "", "" );

	/* find out the graph type.. */
	getpick( command, "Text Arrow Line Box Bullet Set_parms Dataclick Redraw Print Quit", 1, 1 );

	if( strcmp( command, "Redraw" )==0 ) userdisplay( 1 );

	else if( strcmp( command, "Dataclick" )==0 ) {
		message( "Coordinates can optionally",
			 "be saved in a file.", 
			 "Enter a file name, or",
			 "just press enter." );
		get_string_box( buf, "> ", 8.0, 9.5, 11.0, 9.8 );
		dataclick( buf );
		}

	else if( strcmp( command, "Set_parms" )==0 ) {
		while( 1 ) {
			message( "Select a parameter:", "", "The current value", " is in parentheses." );
			sprintf( buf, "1.Text_size(%s) 2.Font(%s) 3.Line_thickness(%s) 4.Line_dash(%s)\
				5.Dash_size(%s) Exit - - - -", textsize, textfont, linethick, linedash, dashsize );
			getpick( buf, buf, 1, 1 );
			if( buf[0] == '1' ) {
				message( "Select size in points..", "", "Current size is:", textsize );
				getpick( textsize, "6 7 10 11 12 14 16 18 24 -", 1, 1 );
				}
			else if( buf[0] == '2' ) { 
				message( "Select font..", "", "Current font is:", textfont );
				getpick( textfont, "fonts.mu", 1, 1 ); 
				userdisplay( 1 ); 
				}
			else if( buf[0] == '3' ) {
				libdisplay( "linethick.g" );
				message( "Click on the thickness", "of your choice..", "", "" );
				getpick( linethick, "linethick.mu", 1, 0 );
				}
			else if( buf[0] == '4' ) {
				libdisplay( "linetype.g" );
				message( "Click on the line dash", "style of your choice..", "", "" );
			 	getpick( linedash, "linetype.mu", 1, 0 );
				}
			else if( buf[0] == '5' ) {
				libdisplay( "dashsize.g" );
				message( "Click on the dash size", "of your choice..", "", "" );
			 	getpick( dashsize, "linedash.mu", 1, 0 );
				}
			else break;
			}
		userdisplay( 1 );
		}
	else if( strcmp( command, "Text" )==0 ) {
	    	while( 1 ) {
			message( "Point to place where", "text should start.", "", "" );
			get_point( &x, &y );
			message( "Enter text..", "Press control-d when done.", "", "" );
			NTptsize( atof( textsize ) );
			y -= Chh*0.4;
			get_text_box_tp( buf, "", x-0.2, y-2.0, x+4.0, y );
			fprintf( hfp, "\nProc Text:\nFont: %s\nSize: %s\nPosition: %6.2f %6.2f\nText: %s", 
				textfont, textsize, x, y, buf );
			userdisplay( 1 );
			if( commit() ) break;
			}
		}

	else if( strcmp( command, "Arrow" )==0 ) {
		while( 1 ) {
			message( "Point to place where", "arrowhead should be", "", "" );
			get_point( &x, &y );
			message( "", "", "Point to place where", "other end should be" );
			get_point( &x2, &y2 );
			fprintf( hfp, "\nProc Arrow:\nPoints: %4.2f %4.2f %4.2f %4.2f\n", x2, y2, x, y );
			userdisplay( 1 );
			if( commit() ) break;
			}
		}

	else if( strcmp( command, "Line" )==0 ) {
		while( 1 ) {
			getpick( buf, "Horizontal Vertical Unconstrained - - - - - - -", 1, 1 );
			message( "", "", "Point to place where", "one end should be" );
			get_point( &x2, &y2 );
			message( "Point to place where", "other end should be", "", "" );
			get_point( &x, &y );
			fprintf( hfp, "\nProc Draw:\nLinetype: %s\nLinethick: %s\nLinetype.magnify: %s\n",
				linedash, linethick, dashsize );
			if( buf[0] == 'U' )fprintf( hfp, "Points: %4.2f %4.2f %4.2f %4.2f\n", x2, y2, x, y );
			if( buf[0] == 'H' )fprintf( hfp, "Points: %4.2f %4.2f %4.2f %4.2f\n", x2, y2, x, y2 );
			if( buf[0] == 'V' )fprintf( hfp, "Points: %4.2f %4.2f %4.2f %4.2f\n", x2, y2, x2, y );
			userdisplay( 1 );
			if( commit() ) break;
			}
		}
			
	else if( strcmp( command, "Box" )==0 ) {
		while( 1 ) {
			message( "", "", "Point to place where", "lower-left of box should be" );
			get_point( &x2, &y2 );
			message( "Point to place where", "upper-right of box should be", "", "" );
			get_point( &x, &y );
			fprintf( hfp, "\nProc Draw:\nLinetype: %s\nLinethick: %s\nLinetype.magnify: %s\n",
				linedash, linethick, dashsize );
			fprintf( hfp, "Points: %4.2f %4.2f %4.2f %4.2f\n %4.2f %4.2f\n %4.2f %4.2f\n %4.2f %4.2f\n",
			  x2, y2, x2, y, x, y, x, y2, x2, y2 );
			userdisplay( 1 );
			if( commit() ) break;
			}
		}

	else if( strcmp( command, "Bullet" )==0 ) {
		while( 1 ) {
			message( "Point to place where", "you want the bullet", "", "" );
			get_point( &x, &y );
			fprintf( hfp, "\nProc Point:\nMark: sym6n\nPosition: %4.2f %4.2f\n", x, y );
			userdisplay( 1 );
			if( commit() ) break;
			}
		}

	else if( strcmp( command, "Print" )==0 ) {
		message( "Postscript image", "being sent to printer..", "", "" );
		sprintf( buf, "pipl %s", outfile );
		system( buf );
		}
	else if( strcmp( command, "Quit" ) ==0 ) {
		libdisplay( "clear.g", 1 );
		getpick( buf, "Resave Save_as Quit", 1, 1 );
		if( smember( buf, "Resave Save_as" )) {
			if( strcmp( buf, "Save_as" )==0 ) {
				get_string_box( dispfile, "Save as: ", 4.0, 6.0, 8.0, 6.4 );
				message( "Saved as:", dispfile, "", "" );
				sleep( 1 );
				}
			else if( strcmp( buf, "Resave" )==0 ) {
				strcpy( dispfile, cfile );
				message( dispfile, "Control file resaved.", "", "" );
				sleep( 1 );
				}
			sprintf( buf, "cp %s %s", outfile, dispfile );
			system( buf );
			}
		else gdp_exit();
		break;
		}
	}
}



/* ========================================== */
libdisplay( f, new )
char f[];
int new;
{
char fnm[80];
if( Dev == 'm' ) return( 1 );
sprintf( fnm, "%s/%s", TEMPLATE_PATH, f );
if( new )ab_rect( 0.0, 0.0, 11.0, 11.0, 1.0, 0 );
restart( fnm );
display();
}

/* ========================================== */
filedisplay( f, new )
char f[];
int new;
{
if( Dev == 'm' ) return( 1 );
if( new ) ab_rect( 0.0, 0.0, 11.0, 11.0, 1.0, 0 );
restart( f );
display();
}
/* ========================================== */
userdisplay( new )
int new;
{
char buf[150];
if( Dev == 'm' ) return( 1 );
if( hfp != NULL )fclose( hfp );
if( new ) ab_rect( 0.0, 0.0, 11.0, 11.0, 1.0, 0 );
sprintf( buf, "cat %s %s > %s", outfile, holdingfile, dispfile );
system( buf );
restart( dispfile );
display();
hfp = fopen( holdingfile, "a" );
}
/* ========================================== */
commit( prompt )
char prompt[];
{
static char buf[150];


getpick( buf, "Keep Re-do Cancel", 1, 1 );
if( strcmp( buf, "Keep" )==0 ) { 
	if( hfp != NULL )fclose( hfp );
	sprintf( buf, "cat %s >> %s", holdingfile, outfile );
	system( buf );
	hfp = fopen( holdingfile, "w" );
	return( 1 );
	}

else if( strcmp( buf, "Re-do" )==0 ) {
	if( hfp != NULL )fclose( hfp );
	hfp = fopen( holdingfile, "w" ); /* null out holding file */
	userdisplay( 1 );
	return( 0 );
	}

else if( strcmp( buf, "Cancel" )==0 ) {
	if( hfp != NULL )fclose( hfp );
	hfp = fopen( holdingfile, "w" ); /* null out holding file */
	userdisplay( 1 );
	return( 1 );
	}
}

SHAR_EOF
############################

cat << \SHAR_EOF > src/vrangebar.c
#include "ipl.x"
Vrangebar( )
{
int f[8], row, i, doends, nf, nv, ir, mlrightonly, label, yf;
double val[8];
double w, y, shade, lblpos, mlw;

gget( Buf, "Nval" );
nv = atoi( Buf );

gget( Buf, "Field" );
if( nv == 1 ) { nf = sscanf( Buf, "%d", &f[1] ); f[2] = f[3] = f[1]; f[4] = f[5] = f[1]; }
else if( nv == 2 ) { nf = sscanf( Buf, "%d %d", &f[1], &f[4] ); f[2] = f[3] = f[1]; f[5] = f[4]; }
else if( nv == 3 ) { nf = sscanf( Buf, "%d %d %d", &f[1], &f[3], &f[5] ); f[2] = f[1]; f[4] = f[5]; }
else if( nv == 4 ) { nf = sscanf( Buf, "%d %d %d %d", &f[1], &f[2], &f[4], &f[5] ); f[3] = f[4]; }
else if( nv == 5 ) { nf = sscanf( Buf, "%d %d %d %d %d", &f[1], &f[2], &f[3], &f[4], &f[5] ); }
if( nf != nv ) { fprintf( stderr, "Expecting %d Field values.\n", nv ); gdp_exit(); }


gget( Buf, "Width" ); w = atof( Buf );

gget( Buf, "Linethick" );
NTlinetype( "0", atof( Buf ), 1.0 );

label = 0;
gget( Buf, "Idfield" );
f[0] = atoi( Buf );
if( f[0] > 0 ) {
	label = 1;
	gget( Buf, "Label.size" );
	if( atoi( Buf ) > 0 ) NTptsize( atoi( Buf ) );

	gget( Buf, "Label.position" );
	lblpos = atof( Buf );

	}

doends = 0;
if( nf == 4 || nf == 5 ) {
	gget( Buf, "Ends" );
	if( Buf[0] == 'y' ) doends = 1;
	}

mlw = w;
mlrightonly = 0;
if( nf == 3 || nf == 5 ) {
	gget( Buf, "Midlinewidth" );
	if( atof( Buf ) > 0 )mlw = atof( Buf );
	gget( Buf, "Midlineright" );
	if( Buf[0] == 'y' ) mlrightonly = 1;
	}

gget( Buf, "Shade" );
shade = atof( Buf );

gget( Buf, "Yfield" );
yf = atoi( Buf );


y = DYlo;
for( ir = 0; ir < N_d_rows; ir++ ) {
	for( i = 1; i <= 5; i++ ) val[i] = atof( D[ ir ][ f[i]-1 ] );
	if( nv == 1 ) { val[1] = val[2] = 0; }
	if( yf > 0 ) y = atof( D[ir][ yf-1 ] );
	else y++;

	NTm( val[2], y-(w/2) ); /* lower edge of box */
	NTp( val[2], y+(w/2) );
	NTp( val[4], y+(w/2) );
	NTp( val[4], y-(w/2) );
	NTp( val[2], y-(w/2) ); /* upper edge */
	NTshade( shade );
	
	NTm( val[1], y ); /* lower tail */
	NTl( val[2], y );
	if( doends ) { NTm( val[1], y-(w/2.7) ); NTl( val[1], y+(w/2.7) ); }
	
	NTm( val[2], y-(w/2) ); /* lower edge of box */
	NTl( val[2], y+(w/2) );
	NTl( val[4], y+(w/2) );
	NTl( val[4], y-(w/2) );
	NTl( val[2], y-(w/2) ); /* upper edge */
	
	NTm( val[4], y );
	NTl( val[5], y ); /* upper tail */
	if( doends ) { NTm( val[5], y-(w/2.7) ); NTl( val[5], y+(w/2.7) ); }
	
	if( mlrightonly )NTm( val[3], y-(w/2) ); /* median line */
	else NTm( val[3], y-(mlw/2) ); 
	NTl( val[3], y+(mlw/2) );
	
	if( label ) {
		NTmov( da_x(lblpos)-1, da_y(y) );  /* print label */
		sprintf( Buf, "%s", D[ir][f[0]-1 ] );
		NTcentext( Buf, 2 );
		}
	
	}
NTnormline();
}
SHAR_EOF
############################

cat << \SHAR_EOF > examples/absunits.g
Proc Page:
Title:  Absolute units (inches), Paperway = portrait
Paperway: portrait

Proc Areadef:
Area.rectangle: 0 0 11 11
Xmin: 0
Xmax: 11
Xinc: 1
Ymin: 0
Ymax: 11
Yinc: 1
Xstub.grid: line
Xstub.yofs: -1.5
Ystub.grid: line
Ystub.xofs: -1.5

Proc Pagebreak:

Proc Page:
Title:  Absolute units (inches), Paperway = landscape
Paperway: landscape

Proc Areadef:
Area.rectangle: 0 0 11 11
Xmin: 0
Xmax: 11
Xinc: 1
Ymin: 0
Ymax: 11
Yinc: 1
Xstub.grid: line
Xstub.yofs: -1.5
Ystub.grid: line
Ystub.xofs: -1.5

SHAR_EOF
############################

cat << \SHAR_EOF > examples/areadef1.g
Proc Page:
Title: Areadef examples
Standard.font: /Helvetica-Oblique

Proc Areadef:
Area: 4nw
Subtitle: Figure 1
Subtitle.above: 0.2
Ymin: 0
Ymax: 1000
Yinc: 100
Xmin: 0
Xmax: 10
Xinc: 1
Saveas: A

Proc Areadef:
Clone: A
Area: 4ne
Subtitle: Figure 2
Ystub.grid: wline
Shade: 0.95
Xmax: 18
Xstub: month
Xstub.startmonth: 10
Xstub.startyear: 86
Xstart.0or1: 1
Xstub.tics: none
Ystub.tics: none

Proc Areadef:
Clone: A
Area: 4sw
Subtitle: Figure 3
Xstub.grid: line
Xmax: 5
Xstub: Sun
	DEC
	Silicon~Graphics
	IBM
Xstart.0or1: 1
Ymin: -300
Ystub.ticlen: -0.1
Ystub.tics: both
Frame: single

Proc Areadef:
Clone: A
Area: 4se
Subtitle: Figure 4
Subtitle.above: 0.4
Ymin: 0
Ymax: 1
Yinc: 0.2
Yticfmt: %3.1f
Ystub.minor: 10
Ystub.tics: both
Ystub.stubs: both
Ystub.grid: line
Xmin: 0
Xmax: 1
Xinc: 0.2
Xstub.grid: line
Xstub.stubs: both
Xstub.tics: both
Xstub.minor: 10
Xticfmt: %3.1f

SHAR_EOF
############################

cat << \SHAR_EOF > examples/areadef2.g
Proc Page:
Title: More areadef examples

Proc Areadef:
Area: 4nw
Ymin: 0
Ymax: 1000
Yinc: 100
Xmin: 0
Xmax: 10
Xinc: 1
Subtitle: Figure 5
Ystub: Virginia
	Pennsylvania
	Ohio
	New Jersey
	New York
	Massachussetts
	Maryland
	Delaware
	Connecticut
Ystart.0or1: 1
Ystub.tics: none
Xstub.tics: none
Saveas: A
	
Proc Areadef:
Clone: A
Area: 4ne
Subtitle: Figure 6
Ystub.stubs: none
Xstub.tics: none
Xlabel: Standard A units
Xlabel.position: 0.3
Xlabel.size: 7
#
Proc Draw:
System: data
Points: 0 400 10 400
Linetype: 2
Linethick: 0.5
Linetype.magnify: 3
Saveas: B
Proc Draw:
Clone: B
Points: 0 500 10 500
Linetype: 3
Proc Draw:
Clone: B
Points: 0 600 10 600
Linetype: 6
#
Proc Areadef:
Clone: A
Subtitle: Figure 6
Yaxis: none
Area: 4ne
Xmin: -30
Xmax: 40
Xinc: 10
Xstub.yofs: 0.5
Xstub.tics: none
Xlabel: Standard G units
Xlabel.size: 7

Proc Areadef:
Clone: A
Area: 4sw
Subtitle: Figure 7
Ymin: -16
Ymax: 14
Yinc: 2
Ystub.size: 6
Ylabel: Change in acuity
Xmin: 0
Xmax: 30
Xinc: 3
Ystub: num
Xstub: 0
	3
	6

	12



	24
Xlabel: Time in months
Xstub.nolonetics: y

Proc Polygon:
Rectangle: 4.15 0.6 8.1 5
Shade: 0.95

Proc Areadef:
Clone: A
Subtitle: Figure 8
Area: 4se
Shade: 1.0
Xmin: 0
Xmax: 10
Xinc: 1
Ymin: 0
Ymax: 10
Yinc: 1
Ystub: num
Ystub.grid: line
Xstub.grid: line
Ystub.stubs: none
Xstub.stubs: none
Xstub.tics: none
Ystub.tics: none
SHAR_EOF
############################

cat << \SHAR_EOF > examples/arrow.g
Proc Page:
Title: Absolute units (inches)
	and arrows
Title.size: 15
Title.belowtop: 3

Proc Areadef:
Area.rectangle: 0 0 9 11
Xstub.grid: line
Ystub.grid: line
Xmin: 0
Xmax: 9
Xinc: 1
Ymin: 0
Ymax: 11
Yinc: 1
Xstub.yofs: -1.5
Xstub.size: 12
Xstub.stubs: both
Ystub.xofs: -1.5
Ystub.size: 12
Ystub.stubs: both

Proc Arrow:
Points: 1 1 2 2

Proc Arrow:
Points: 3 3 6 1

Proc Arrow:
Points: 4 6 2 4

Proc Arrow:
Points: 6 5 4 7
SHAR_EOF
############################

cat << \SHAR_EOF > examples/bargraph1.g
Proc Page:
Title: Bargraph examples

Proc Getdata:
Data:
01         0      1      0      6     10      1     11     10      2     -41
02         3      5      0      2      6      2      3     11      3     35
03         1      3.4    0      1      2      0      5      7      1     20
04         2      4.8    3     11     24      9     20     11     29     -13
05         0      3.3    1      1      4      0      8      3      2     -22
06         2      2      0      2      7      1      6      4      4     -28
07         1      3      0      1      6      1     24     22      3     31
08         3      0.8    0      0      2      0      7      3      0     -15
09         3      2.2    0      2      5      0      1      1      2     16
10         4      8      1      6     10      1     12      2      4     48

Proc Areadef:
Area: 4nw
Subtitle: Fig. 1
	Single format, segmented
Subtitle.above: 0.3
Ymax: 40
Yinc: 10
# The following parameter makes the first stub move over one position
Xstart.0or1: 1
# Xmax must be set to at least one greater than the number of data rows
Xmax: 11
# Use the 1st data field for X stubs
Xstub:	@1
Saveas: A

Proc Bargraph:
Format: single
Field: 8
Shade: 0.8
Segment: y


Proc Areadef:
Clone: A
Area: 4ne
Subtitle: Fig. 2
	Stack format 
Ymax: 100

Proc Bargraph:
Format: stack
Field: 6 8 9
Shade: .5 .8 1
Outlinebars: n

Proc Areadef:
Clone: A
Area.rectangle: 1 3 8 5
Subtitle: Fig. 3
	Cluster format

Proc Bargraph:
Format: cluster
Separation: 0.2
Separation.sub: 0.0
Field: 6 8 9
Shade: .5 .8 1

Proc Areadef:
Clone: A
Area.rectangle: 1 0.5 8 2
Subtitle: Fig. 4
	Adjustable "Zero" line, values shown
Ymax:  50
Ymin: -50
Yinc: 10

Proc Bargraph:
Format: single
Field: 11
Shade: .5 .8 1
Idfield: 11
Zeroat: 0

Proc Draw:
Points: 0 0 11 0
System: data
SHAR_EOF
############################


-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.



More information about the Comp.sources.unix mailing list