Watcom C Library : _pg_getchardef, _pg_getpalette, _pg_getstyleset, _pg_hlabelchart
Watcom C Reference/O - P - Q - R 2021. 8. 31. 18:35
Watcom C Library Reference : _pg_getchardef, _pg_getpalette, _pg_getstyleset, _pg_hlabelchart
_pg_getchardef
Synopsis : #include <pgchart.h>
short _FAR _pg_getchardef( short ch, unsigned char FAR *def );
Description : The _pg_getchardef function retrieves the current bit-map definition for the character ch. The bit-map is placed in the array def. The current font must be an 8-by-8 bit-mapped font.
Returns : The _pg_getchardef function returns zero if successful; otherwise, a non-zero value is returned.
See Also : _pg_defaultchart, _pg_initchart, _pg_chart, _pg_chartpie, _pg_chartscatter, _pg_setchardef
Example :
#include <graph.h>
#include <pgchart.h>
#include <string.h>
#include <conio.h>
#define NUM_VALUES 4
float x[NUM_VALUES] = { 5, 25, 45, 65 };
float y[NUM_VALUES] = { 5, 45, 25, 65 };
char diamond[8] = { 0x10, 0x28, 0x44, 0x82, 0x44, 0x28, 0x10, 0x00 };
main( )
{
chartenv env;
char old_def[8];
_setvideomode( _VRES16COLOR );
_pg_initchart( );
_pg_defaultchart( &env, _PG_SCATTERCHART, _PG_POINTANDLINE );
strcpy( env.maintitle.title, "Scatter Chart" );
/* change asterisk character to diamond */
_pg_getchardef( '*', old_def );
_pg_setchardef( '*', diamond );
_pg_chartscatter ( &eny, X, Y, NUM_VALUES );
_pg_setchardef( '*', old_def );
getch( );
_setvideomode( _DEFAULTMODE );
}
Classification : PC Graphics
Systems : DOS, QNX
_pg_getpalette
Synopsis : #include <pgchart.h>
short _FAR _pg_getpalette( paletteentry _FAR *pal );
Description : The _pg_getpalette function retrieves the internal palette of the presentation graphics system. The palette controls the colors, line styles, fill patterns and plot characters used to display each series of data in a chart.
The argument pal is an array of palette structures that will contain the palette. Each element of the palette is a structure containing the following fields:
fields | Meaning |
color | color used to display series |
style | line style used for line and scatter charts |
fill | fill pattern used to fill interior of bar and pie sections |
plotchar | character plotted on line and scatter charts |
Returns : The _pg_getpalette function returns zero if successful; otherwise, a non-zero value is returned.
See Also : _pg_defaultchart, _pg_initchart, _pg_chart, _pg_chartpie, _pg_chartscatter, _pg_setpalette, _pg_resetpalette
Example :
#include <graph.h>
#include <pgchart.h>
#include <string.h>
#include <conio.h>
#define NUM_VALUES 4
char _FAR *categories[NUM_VALUES] = { "Jan", "Feb", "Mar", "Apr" };
float values[NUM_VALUES] = { 20, 45, 30, 25 };
char bricks[8] = { 0xff, 0x80, 0x80, 0x80, 0xff, 0x08, 0x08, 0x08 };
main( )
{
chartenv env;
palettetype pal;
_setvideomode( _VRES16COLOR );
_pg_initchart( );
_pg_defaultchart ( &eny, _PG_COLUMNCHART, _PG_PLAINBARS );
strcpy( env.maintitle.title, "Column Chart" );
/* get default palette and change ist entry */
_pg_getpalette( &pal );
pal[1].color = 12;
memcpy( pal[1].fill, bricks, 8 );
/* use new palette */
_pg_setpalette( &pal );
_pg_chart( &eny, categories, values, NUM_VALUES );
/* reset palette to default */
_pg_resetpalette( );
getch( );
_setvideomode( _DEFAULTMODE );
}
Classification : PC Graphics
Systems : DOS, QNX
_pg_getstyleset
Synopsis : #include <pgchart.h>
void _FAR _pg_getstyleset( unsigned short _FAR *style );
Description : The _pg_getstyleset function retrieves the internal style-set of the presentation graphics system. The style-set is a set of line styles used for drawing window borders and grid-lines. The argument style is an array that will contain the style-set.
Returns : The _pg_getstyleset function does not return a value.
See Also : _pg_defaultchart, _pg_initchart, _pg_chart, _pg_chartpie, _pg_chartscatter, _pg_setstyleset, _pg_resetstyleset
Example :
#include <graph.h> #
include <pgchart.h>
#include <string.h>
#include <conio.h>
#define NUM_VALUES 4
char _FAR *categories[NUM_VALUES] = { "Jan", "Feb", "Mar", "Apr" };
float values[NUM_VALUES] = { 20, 45, 30, 25 };
main( )
{
chartenv env;
styleset style;
_setvideomode( _VRES16COLOR );
_pg_initchart( );
_pg_defaultchart( &eny, _PG_COLUMNCHART, _PG_PLAINBARS );
strcpy( env.maintitle.title, "Column Chart" );
/* turn on yaxis grid, and use style 2 */
env.yaxis.grid = 1;
env.yaxis.gridstyle = 2;
/* get default style-set and change entry 2 */
_pg_getstyleset( &style );
style[2] = 0x8888;
/* use new style-set */
_pg_setstyleset( &style );
_pg_chart( &eny, categories, values, NUM_VALUES );
/* reset style-set to default */
_pg_resetstyleset( );
getch( );
_setvideomode( _DEFAULTMODE );
}
Classification : PC Graphics
Systems : DOS, QNX
_pg_hlabelchart
Synopsis : #include <pgchart.h>
short _FAR _pg_hlabelchart( chartenv _FAR *env,
short x, short y,
short color,
char _FAR *label );
Description : The _pg_hlabelchart function displays the text string label on the chart described by the env chart structure. The string is displayed horizontally starting at the point (x, y), relative to the upper left corner of the chart. The color specifies the palette color used to display the string.
Returns : The _pg_hlabelchart function returns zero if successful; otherwise, a non-zero value is returned.
See Also : _pg_defaultchart, _pg_initchart, _pg_chart, _pg_chartpie, _pg_chartscatter, _pg_vlabelchart
Example :
#include <graph.h>
#include <pgchart.h>
#include <string.h>
#include <conio.h>
#define NUM_VALUES 4
char _FAR *categories[NUM_VALUES] = { "Jan", "Feb", "Mar", "Apr" };
float values[NUM_VALUES] = { 20, 45, 30, 25 };
main( )
{
chartenv env;
_setvideomode( _VRES16COLOR );
_pg_initchart( );
_pg_defaultchart( &eny, _PG_COLUMNCHART, _PG_PLAINBARS );
strcpy( eny.maintitle.title, "Column Chart" );
_pg_chart( &eny, categories, values, NUM_VALUES );
_pg_hlabelchart( &env, 64, 32, 1, "Horizontal label" );
_pg_vlabelchart( &env, 48, 32, 1, "Vertical label" );
getch( );
_setvideomode( _DEFAULTMODE );
}
Classification : PC Graphics
Systems : DOS, QNX
This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).
WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)