home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / h.z / PGCHART.H < prev    next >
C/C++ Source or Header  |  1996-07-24  |  7KB  |  192 lines

  1. /*
  2.  *  pgchart.h    Presentation Graphics functions
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5.  */
  6. #ifndef _PGCHART_H_INCLUDED
  7. #define _PGCHART_H_INCLUDED
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. #ifndef _COMDEF_H_INCLUDED
  13.  #include <_comdef.h>
  14. #endif
  15.  
  16. #if defined(_M_IX86)
  17.   #pragma pack(__push,1);
  18. #else
  19.   #pragma pack(__push,8);
  20. #endif
  21.  
  22. #define _PG_MAXCHARTTYPE    5    /* maximum chart type */
  23.  
  24. enum {                    /* chart types */
  25.     _PG_BARCHART=1, _PG_COLUMNCHART,
  26.     _PG_LINECHART, _PG_SCATTERCHART, _PG_PIECHART
  27. };
  28.  
  29.  
  30. #define _PG_MAXCHARTSTYLE    2    /* maximum chart style */
  31.  
  32. enum {                    /* styles for bar and column charts */
  33.     _PG_PLAINBARS=1, _PG_STACKEDBARS
  34. };
  35.  
  36. enum {                    /* styles for line and scatter charts */
  37.     _PG_POINTANDLINE=1, _PG_POINTONLY
  38. };
  39.  
  40. enum {                    /* styles for pie charts */
  41.     _PG_PERCENT=1, _PG_NOPERCENT
  42. };
  43.  
  44.  
  45. enum {                    /* title and legend positions */
  46.     _PG_LEFT=1, _PG_CENTER, _PG_RIGHT, _PG_BOTTOM, _PG_OVERLAY
  47. };
  48.  
  49. enum {                    /* axis types */
  50.     _PG_LINEARAXIS=1, _PG_LOGAXIS
  51. };
  52.  
  53. enum {                    /* tic mark label format */
  54.     _PG_DECFORMAT=1, _PG_EXPFORMAT
  55. };
  56.  
  57. #define _PG_MISSINGVALUE    (-FLT_MAX)    /* value for missing data elements */
  58.  
  59.  
  60. /* Error codes - greater than 100, terminate chart routine
  61.            - less than 100, default values will be used */
  62.  
  63. #define _PG_NOTINITIALIZED    101    /* library not initialized */
  64. #define _PG_BADSCREENMODE    102    /* not in graphics mode */
  65. #define _PG_BADCHARTTYPE    103    /* invalid chart type */
  66. #define _PG_BADLEGENDWINDOW    104    /* invalid legend window */
  67. #define _PG_BADDATAWINDOW    105    /* invalid data window */
  68. #define _PG_TOOSMALLN        106    /* number of data values <= 0 */
  69. #define _PG_TOOFEWSERIES    107    /* number of series <= 0 */
  70.  
  71. #define _PG_BADCHARTSTYLE    1    /* invalid chart style */
  72. #define _PG_BADLOGBASE        2    /* log base <= 0 */
  73. #define _PG_BADSCALEFACTOR    3    /* scale factor = 0 */
  74. #define _PG_BADCHARTWINDOW    4    /* invalid chart window */
  75.  
  76.  
  77. /* Chart definition */
  78.  
  79. #define _PG_TITLELEN    70        /* maximum title length */
  80.  
  81. typedef struct {            /* chart title definition */
  82.     char    title[ _PG_TITLELEN ];    /* title text */
  83.     short    titlecolor;        /* palette color for title */
  84.     short    justify;        /* _PG_LEFT, _PG_CENTER or _PG_RIGHT */
  85. } titletype;
  86.  
  87. typedef struct {            /* chart axes definition */
  88.     short    grid;            /* if TRUE draw grid lines */
  89.     short    gridstyle;        /* style number for grid lines */
  90.     titletype    axistitle;        /* axis title */
  91.     short    axiscolor;        /* palette color for axis */
  92.     short    labeled;        /* if TRUE draw tic marks and titles */
  93.     short    rangetype;        /* _PG_LINEARAXIS or _PG_LOGAXIS */
  94.     float    logbase;        /* base used for log axis */
  95.     short    autoscale;        /* if TRUE calculate remaining values */
  96.     float    scalemin;        /* minimum value for scale */
  97.     float    scalemax;        /* maximum value for scale */
  98.     float    scalefactor;        /* scale factor for axis */
  99.     titletype    scaletitle;        /* title for scale factor */
  100.     float    ticinterval;        /* interval between tic marks */
  101.     short    ticformat;        /* _PG_EXPFORMAT or _PG_DECFORMAT */
  102.     short    ticdecimals;        /* number of decimals places in tic labels */
  103. } axistype;
  104.  
  105. typedef struct {            /* chart and data window definition */
  106.     short    x1;            /* left side of window */
  107.     short    y1;            /* top side of window */
  108.     short    x2;            /* right side of window */
  109.     short    y2;            /* bottom side of window */
  110.     short    border;         /* if TRUE draw border */
  111.     short    background;        /* palette color for background */
  112.     short    borderstyle;        /* style number for border */
  113.     short    bordercolor;        /* palette color for border */
  114. } windowtype;
  115.  
  116. typedef struct {            /* legend definition */
  117.     short    legend;         /* if TRUE draw legend */
  118.     short    place;            /* _PG_RIGHT, _PG_BOTTOM or _PG_OVERLAY */
  119.     short    textcolor;        /* palette color for text */
  120.     short    autosize;        /* if TRUE size is calculated */
  121.     windowtype    legendwindow;        /* window for legend */
  122. } legendtype;
  123.  
  124. typedef struct {            /* chart definition */
  125.     short    charttype;        /* _PG_BAR, _PG_COLUMN, _PG_LINE, _PG_SCATTER or _PG_PIE */
  126.     short    chartstyle;        /* chart style for above type */
  127.     windowtype    chartwindow;        /* window containing whole chart */
  128.     windowtype    datawindow;        /* window containing data part of chart */
  129.     titletype    maintitle;        /* chart main title */
  130.     titletype    subtitle;        /* chart sub-title */
  131.     axistype    xaxis;            /* x-axis description */
  132.     axistype    yaxis;            /* y-axis description */
  133.     legendtype    legend;         /* legend description */
  134. } chartenv;
  135.  
  136.  
  137. /* Palette and Style-set definition */
  138.  
  139. #define _PG_PALETTELEN    16        /* size of palette and style-set */
  140.  
  141. typedef unsigned char    charmap[ 8 ];    /* character bit-map */
  142.  
  143. typedef unsigned char    fillmap[ 8 ];    /* pattern bit-map */
  144.  
  145. typedef struct {            /* palette entry definition */
  146.     unsigned short  color;
  147.     unsigned short  style;
  148.     fillmap        fill;
  149.     char        plotchar;
  150. } paletteentry;
  151.  
  152. typedef paletteentry    palettetype[ _PG_PALETTELEN ];
  153. typedef unsigned short    styleset[ _PG_PALETTELEN ];
  154.  
  155.  
  156. /* Display functions */
  157.  
  158. short _WCI86FAR    _pg_initchart( void );
  159. short _WCI86FAR    _pg_defaultchart( chartenv _WCI86FAR *, short, short );
  160. short _WCI86FAR    _pg_chart( chartenv _WCI86FAR *, char _WCI86FAR * _WCI86FAR *, float _WCI86FAR *, short );
  161. short _WCI86FAR    _pg_chartms( chartenv _WCI86FAR *, char _WCI86FAR * _WCI86FAR *, float _WCI86FAR *, short, short, short, char _WCI86FAR * _WCI86FAR * );
  162. short _WCI86FAR    _pg_chartscatter( chartenv _WCI86FAR *, float _WCI86FAR *, float _WCI86FAR *, short );
  163. short _WCI86FAR    _pg_chartscatterms( chartenv _WCI86FAR *, float _WCI86FAR *, float _WCI86FAR *, short, short, short, char _WCI86FAR * _WCI86FAR * );
  164. short _WCI86FAR    _pg_chartpie( chartenv _WCI86FAR *, char _WCI86FAR * _WCI86FAR *, float _WCI86FAR *, short _WCI86FAR *, short );
  165.  
  166. /* Analyze functions */
  167.  
  168. short _WCI86FAR    _pg_analyzechart( chartenv _WCI86FAR *, char _WCI86FAR * _WCI86FAR *, float _WCI86FAR *, short );
  169. short _WCI86FAR    _pg_analyzechartms( chartenv _WCI86FAR *, char _WCI86FAR * _WCI86FAR *, float _WCI86FAR *, short, short, short, char _WCI86FAR * _WCI86FAR * );
  170. short _WCI86FAR    _pg_analyzescatter( chartenv _WCI86FAR *, float _WCI86FAR *, float _WCI86FAR *, short );
  171. short _WCI86FAR    _pg_analyzescatterms( chartenv _WCI86FAR *, float _WCI86FAR *, float _WCI86FAR *, short, short, short, char _WCI86FAR * _WCI86FAR * );
  172. short _WCI86FAR    _pg_analyzepie( chartenv _WCI86FAR *, char _WCI86FAR * _WCI86FAR *, float _WCI86FAR *, short _WCI86FAR *, short );
  173.  
  174. /* Utility functions */
  175.  
  176. short _WCI86FAR    _pg_hlabelchart( chartenv _WCI86FAR *, short, short, short, char _WCI86FAR * );
  177. short _WCI86FAR    _pg_vlabelchart( chartenv _WCI86FAR *, short, short, short, char _WCI86FAR * );
  178. short _WCI86FAR    _pg_getpalette( paletteentry _WCI86FAR * );
  179. short _WCI86FAR    _pg_setpalette( paletteentry _WCI86FAR * );
  180. short _WCI86FAR    _pg_resetpalette( void );
  181. void _WCI86FAR    _pg_getstyleset( unsigned short _WCI86FAR * );
  182. void _WCI86FAR    _pg_setstyleset( unsigned short _WCI86FAR * );
  183. void _WCI86FAR    _pg_resetstyleset( void );
  184. short _WCI86FAR    _pg_getchardef( short, unsigned char _WCI86FAR * );
  185. short _WCI86FAR    _pg_setchardef( short, unsigned char _WCI86FAR * );
  186.  
  187. #pragma pack(__pop);
  188. #ifdef __cplusplus
  189. };
  190. #endif
  191. #endif
  192.