Exemple #1
0
static void _DrawPercentLabel( short xc, short yc, short xradius,
            short yradius, float xratio, float yratio, float value )
//==================================================================

/*  Draws the percents on the pie graph.  This function was created to
    save some space.
*/

{
    short               x, y;
    short               length;
    short               pixels;
    char                buffer[ 10 ];

    _setcolor( _PGPalette[ 1 ].color );
    _StringPrint( buffer, _PG_DECFORMAT, 1, 100 * value );
    length = strlen( buffer );
    buffer[ length ] = '%';
    buffer[ length + 1 ] = '\0';
    pixels = _getgtextextent( buffer );
    x = xc + xratio * ( _CharWidth + xradius );
    y = yc - yratio * ( 3 * _CharHeight / 2 + yradius ) - _CharHeight / 2;
    if( xratio > 0 ) {
        _moveto( x, y );
    } else {
        _moveto( x - pixels, y );
    }
    _outgtext( buffer );
}
Exemple #2
0
void press_key()
//==============

//  Display a message and wait for the user to press a key

{
    int                 len;
    char                *msg;
    struct _fontinfo    info;

    _getfontinfo( &info );
    msg = " Press any key ";
    len = _getgtextextent( msg );
    _setcolor( 4 );
    _rectangle( _GFILLINTERIOR, xmax - len, 0,
                                xmax - 1, info.pixheight + 2 );
    _setcolor( 15 );
    _moveto( xmax - len, 1 );
    _outgtext( msg );
    getch();
}
Exemple #3
0
_WCRTLINK short _WCI86FAR _CGRAPH _pg_vlabelchart( chartenv _WCI86FAR *env,
                            short x, short y, short color, char _WCI86FAR *label )
//===========================================================================

/*  Draws vertical label on the chart.  Coordinates are relative to the
    upper left corner of the chartwindow.   */

{
    char                buffer[ 2 ];

    _setcolor( _PGPalette[ color ].color );
    buffer[ 1 ] = '\0';
    x += env->chartwindow.x1;
    y += env->chartwindow.y1;
    while( *label != '\0' ) {
        buffer[ 0 ] = *label;
        _moveto( x + ( _CharWidth - _getgtextextent( buffer ) ) / 2, y );
        _outgtext( buffer );
        ++label;
        y += _CharHeight;
    }
    return( 0 );
}