Watcom C Library Reference : _pg_setpalette, _pg_setstyleset, _pg_vlabelchart

 

 

 

 

_pg_setpalette

 

Synopsis : #include <pgchart.h> 

              short _FAR _pg_setpalette( paletteentry _FAR *pal );

 


Description : The _pg_setpalette function sets 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 containing the new 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 _pa_setpalette 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_getpalette, _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 ( &env, _PG_COLUMNCHART, _PG_PLAINBARS ); 

    strcpy( env.maintitle.title, "Column Chart" );

 

    /* get default palette and change 1st entry */

    _pg_getpalette( &pal );

    pal[1].color = 12;

    memcpy( pal[1].fili, bricks, 8 );

 

    /* use new palette */

    _pg_setpalette( &pal );

    _pg_chart( &env, categories, values, NUM_VALUES );

 

    /* reset palette to default */

    _pg_resetpalette( );

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

_pg_setstyleset

 

Synopsis : #include <pgchart.h> 

              void _FAR _pg_setstyleset( unsigned short _FAR *style );

 


Description : The _pg_setstyleset 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 containing the new style-set.

 

 

Returns : The _pg_setstyleset function does not return a value.

 

 

See Also : _pg_defaultchart, _pg_initchart, _pg_chart, _pg_chartpie, _pg_chartscatter, _pg_getstyleset, _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( eny.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 ( &env, categories, values, NUM_VALUES );

 

    /* reset style-set to default */

    _pg_resetstyleset( );

    getch( );

    _setvideomode( _DEFAULTMODE );

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

_pg_vlabelchart

 

Synopsis : #include <pgchart.h> 

              short _FAR _pg_vlabelchart( chartenv _FAR *eny,
                                             short x, short y,

                                             short color,

                                             char _FAR *label );


Description : The _pg_vlabelchart function displays the text string label on the chart described by the env chart structure. The string is displayed vertically 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_vlabelchart 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_hlabelchart

 


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( env.maintitle.title, "Column Chart" );

    _pg_chart( &env, 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)

 

 

 

728x90
반응형
Posted by 전화카드
,