home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c040 / 6.ddi / INCLUDE / PGCHART.H$ / PGCHART.bin
Encoding:
Text File  |  1989-10-27  |  8.3 KB  |  220 lines

  1. /***
  2. *pgchart.h - Declare constants, functions and macros for charting library.
  3. *
  4. *  Copyright (c) 1988-1990, Microsoft Corporation, All rights reserved.
  5. *
  6. *Purpose:
  7. *  This file declares the presentation graphics library functions and
  8. *  the structures and manifest constants that are used with them.
  9. *
  10. ***************************************************************************/
  11.  
  12. /* Force word alignment to avoid possible -Zp override */
  13. #pragma    pack(2)
  14.  
  15. /* Required for the missing value definition */
  16. #define FLT_MAX            3.402823466e+38F    /* max value */
  17.  
  18. #define _PG_PALETTELEN        16    /* Number of entries in internal palette */
  19. #define _PG_MAXCHARTTYPE    5    /* Maximum available chart type */
  20. #define _PG_MAXCHARTSTYLE    2    /* Maximum chart style */
  21. #define _PG_TITLELEN        70    /* Maximum title text length */
  22.  
  23. #define _PG_LEFT        1    /* Positions used for titles and legends */
  24. #define _PG_CENTER        2
  25. #define _PG_RIGHT        3
  26. #define _PG_BOTTOM        4
  27. #define _PG_OVERLAY        5
  28.  
  29. #define _PG_LINEARAXIS        1    /* Used to specify axis types */
  30. #define _PG_LOGAXIS        2
  31.  
  32. #define _PG_DECFORMAT        1    /* Used to specify tic mark label format */
  33. #define _PG_EXPFORMAT        2
  34.  
  35. #define _PG_BARCHART        1    /* Charttype for a bar chart */
  36. #define _PG_COLUMNCHART        2    /* Charttype for a column chart */
  37. #define  _PG_PLAINBARS        1    /* Styles for bar and column charts */
  38. #define  _PG_STACKEDBARS    2
  39.  
  40. #define _PG_LINECHART        3    /* Charttype for a line chart */
  41. #define _PG_SCATTERCHART    4    /* Charttype for a scatter chart */
  42. #define _PG_POINTANDLINE    1    /* Styles for line and scatter charts */
  43. #define _PG_POINTONLY        2
  44.  
  45. #define _PG_PIECHART        5    /* Charttype for pie chart */
  46. #define _PG_PERCENT        1    /* Styles for pie charts */
  47. #define _PG_NOPERCENT        2
  48.  
  49. #define _PG_MISSINGVALUE    -FLT_MAX    /* Indicates missing data values */
  50.  
  51. /* Error codes    */
  52.  
  53. /* Numbers greater than 100 will terminate chart routine, others will cause
  54.  * default values to be used
  55.  */
  56. #define    _PG_NOTINITIALIZED    102    /* If library not initialized */
  57. #define    _PG_BADSCREENMODE    103    /* Graphics mode not set before charting */
  58. #define    _PG_BADCHARTSTYLE    04    /* Chart style invalid */
  59. #define    _PG_BADCHARTTYPE    104    /* Chart type invalid */
  60. #define    _PG_BADLEGENDWINDOW    105    /* Invalid legend window specified */
  61. #define    _PG_BADCHARTWINDOW    07    /* x1=x2 or y1=y2 in chart window spec. */
  62. #define    _PG_BADDATAWINDOW    107    /* If chart window is too small */
  63. #define    _PG_NOMEMORY        108    /* Not enough memory for data arrays */
  64. #define    _PG_BADLOGBASE        05    /* Log base <= 0 */
  65. #define    _PG_BADSCALEFACTOR    06    /* Scale factor = 0 */
  66. #define    _PG_TOOSMALLN        109    /* Number of data points <= 0 */
  67. #define    _PG_TOOFEWSERIES    110    /* Number of series <= 0 */
  68.  
  69. /* Typedefs    */
  70.  
  71. /* Typedef for chart title */
  72. #ifndef _TITLETYPE_DEFINED
  73. typedef    struct    {
  74.     char    title[_PG_TITLELEN];    /* Title text */
  75.     short    titlecolor;        /* Internal palette color for title text */
  76.     short    justify;        /* _PG_LEFT, _PG_CENTER, _PG_RIGHT */
  77. } titletype;
  78. #define _TITLETYPE_DEFINED
  79. #endif
  80.  
  81. /* Typedef for chart axes */
  82. #ifndef _AXISTYPE_DEFINED
  83. typedef    struct    {
  84.     short        grid;        /* TRUE=grid lines drawn; FALSE no lines */
  85.     short        gridstyle;    /* Style number from style pool for grid lines */
  86.     titletype    axistitle;    /* Title definition for axis */
  87.     short        axiscolor;    /* Color for axis */
  88.     short        labeled;    /* TRUE=tic marks and titles drawn */
  89.     short        rangetype;    /* _PG_LINEARAXIS, _PG_LOGAXIS */
  90.     float        logbase;    /* Base used if log axis */
  91.     short        autoscale;    /* TRUE=next 7 values calculated by system */
  92.     float        scalemin;    /* Minimum value of scale */
  93.     float        scalemax;    /* Maximum value of scale */
  94.     float        scalefactor;    /* Scale factor for data on this axis */
  95.     titletype    scaletitle;    /* Title definition for scaling factor */
  96.     float        ticinterval;    /* Distance between tic marks (world coord.) */
  97.     short        ticformat;    /* _PG_EXPFORMAT or _PG_DECFORMAT for tic labels */
  98.     short        ticdecimals;    /* Number of decimals for tic labels (max=9)*/
  99. } axistype;
  100. #define _AXISTYPE_DEFINED
  101. #endif
  102.  
  103. /* Typedef used for defining chart and data windows */
  104. #ifndef _WINDOWTYPE_DEFINED
  105. typedef    struct    {
  106.     short        x1;        /* Left edge of window in pixels */
  107.     short        y1;        /* Top edge of window in pixels */
  108.     short        x2;        /* Right edge of window in pixels */
  109.     short        y2;        /* Bottom edge of window in pixels */
  110.     short        border;        /* TRUE for border, FALSE otherwise */
  111.     short        background;    /* Internal palette color for window bgnd */
  112.     short        borderstyle;    /* Style bytes for window border */
  113.     short        bordercolor;    /* Internal palette color for window border */
  114. } windowtype;
  115. #define _WINDOWTYPE_DEFINED
  116. #endif
  117.  
  118. /* Typedef for legend definition */
  119. #ifndef _LEGENDTYPE_DEFINED
  120. typedef struct    {
  121.     short        legend;        /* TRUE=draw legend; FALSE=no legend */
  122.     short        place;        /* _PG_RIGHT, _PG_BOTTOM, _PG_OVERLAY */
  123.     short        textcolor;    /* Internal palette color for text */
  124.     short        autosize;    /* TRUE=system calculates size */
  125.     windowtype    legendwindow;    /* Window definition for legend */
  126. } legendtype;
  127. #define _LEGENDTYPE_DEFINED
  128. #endif
  129.  
  130. /* Typedef for legend definition */
  131. #ifndef _CHARTENV_DEFINED
  132. typedef struct    {
  133.     short        charttype;    /* _PG_BAR, _PG_COLUMN, _PG_LINE, _PG_SCATTER, _PG_PIE */
  134.     short        chartstyle;    /* Style for selected chart type */
  135.     windowtype    chartwindow;    /* Window definition for overall chart */
  136.     windowtype    datawindow;    /* Window definition for data part of chart */
  137.     titletype    maintitle;    /* Main chart title */
  138.     titletype    subtitle;    /* Chart sub-title */
  139.     axistype    xaxis;        /* Definition for X-axis */
  140.     axistype    yaxis;        /* Definition for Y-axis */
  141.     legendtype    legend;        /* Definition for legend */
  142. } chartenv;
  143. #define _CHARTENV_DEFINED
  144. #endif
  145.  
  146. /* Typedef for character bitmap */
  147. #ifndef _CHARMAP_DEFINED
  148. typedef unsigned char charmap[8];
  149. #define _CHARMAP_DEFINED
  150. #endif
  151.  
  152. /* Typedef for pattern bitmap */
  153. #ifndef _FILLMAP_DEFINED
  154. typedef unsigned char fillmap[8];
  155. #define _FILLMAP_DEFINED
  156. #endif
  157.  
  158. /* Typedef for palette entry definition */
  159. #ifndef _PALETTEENTRY_DEFINED
  160. typedef struct {
  161.     unsigned short    color;
  162.     unsigned short    style;
  163.     fillmap        fill;
  164.     char        plotchar;
  165. } paletteentry;
  166. #define _PALETTEENTRY_DEFINED
  167. #endif
  168.  
  169. /* Typedef for palette definition */
  170. #ifndef _PALETTETYPE_DEFINED
  171. typedef paletteentry palettetype[_PG_PALETTELEN];
  172. #define _PALETTETYPE_DEFINED
  173. #endif
  174.  
  175. /* Typedef for style sets */
  176. #ifndef _STYLESET_DEFINED
  177. typedef unsigned short styleset[_PG_PALETTELEN];
  178. #define _STYLESET_DEFINED
  179. #endif
  180.  
  181. /* Function prototypes for charting routines    */
  182.  
  183. short _far _cdecl _pg_initchart(void);
  184. short _far _cdecl _pg_defaultchart(chartenv _far *, short, short);
  185.  
  186. short _far _cdecl _pg_chart(chartenv _far *, char _far * _far *, float _far *, short);
  187. short _far _cdecl _pg_chartms(chartenv _far *, char _far * _far *, float _far *, short, short, short, char _far * _far *);
  188.  
  189. short _far _cdecl _pg_chartscatter(chartenv _far *, float _far *, float _far *, short);
  190. short _far _cdecl _pg_chartscatterms(chartenv _far *, float _far *, float _far *, short, short, short, char _far * _far *);
  191.  
  192. short _far _cdecl _pg_chartpie(chartenv _far *, char _far * _far *, float _far *, short _far *, short);
  193.  
  194. /* Function prototypes for support routines    */
  195.  
  196. short _far _cdecl _pg_hlabelchart(chartenv _far *, short, short, short, char _far *);
  197. short _far _cdecl _pg_vlabelchart(chartenv _far *, short, short, short, char _far *);
  198.  
  199. short _far _cdecl _pg_analyzechart(chartenv _far *, char _far * _far *, float _far *, short);
  200. short _far _cdecl _pg_analyzechartms(chartenv _far *, char _far * _far *, float _far *, short, short, short, char _far * _far *);
  201.  
  202. short _far _cdecl _pg_analyzescatter(chartenv _far *, float _far *, float _far *, short);
  203. short _far _cdecl _pg_analyzescatterms(chartenv _far *, float _far *, float _far *, short, short, short, char _far * _far *);
  204.  
  205. short _far _cdecl _pg_analyzepie(chartenv _far *, char _far * _far *, float _far *, short _far *, short);
  206.  
  207. short _far _cdecl _pg_getpalette(paletteentry _far *);
  208. short _far _cdecl _pg_setpalette(paletteentry _far *);
  209. short _far _cdecl _pg_resetpalette(void);
  210.  
  211. void  _far _cdecl _pg_getstyleset(unsigned short _far *);
  212. void  _far _cdecl _pg_setstyleset(unsigned short _far *);
  213. void  _far _cdecl _pg_resetstyleset(void);
  214.  
  215. short _far _cdecl _pg_getchardef(short, unsigned char _far *);
  216. short _far _cdecl _pg_setchardef(short, unsigned char _far *);
  217.  
  218. /* Restore default packing */
  219. #pragma pack()
  220.