home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / GRAPH_IT.ZIP / GRAPH_IT.PRG < prev    next >
Encoding:
Text File  |  1987-06-23  |  11.6 KB  |  265 lines

  1. ***************************************************
  2. * Filename: Graph_it.prg
  3. * Author  : Roger J. Donnay 
  4. * Date    : June 23, 1987
  5. *
  6. * Notes   : This is a general purpose, menu-driven, bar-graphing 
  7. *           program for use with dBaseIII or Clipper data files.
  8. *
  9. * GRAPH_IT is a free software program designed for use by dBaseIII
  10. * and/or Clipper software developers.
  11. *
  12. * All users are granted a limited license to use GRAPH_IT in any 
  13. * form for their own use or for integration into a larger system.
  14. * All users may copy GRAPH_IT for the use of others subject to 
  15. * the following conditions:
  16. *
  17. *   GRAPH_IT must be copied in unmodified form, complete with
  18. *   this license information.
  19. *
  20. *   The full GRAPH-IT documentation must be included with the
  21. *   copy.
  22. *
  23. *   No fee, charge or other compensation may be accepted or
  24. *   requested by any licensee.
  25. *
  26. * Software developers may use, modify, and distribute GRAPH_IT
  27. * only as a an integrated portion of a larger software system.
  28. *
  29. * Operators of electronic bulletin board systems (Sysops) may post
  30. * GRAPH_IT for downloading by their users only as long as the 
  31. * above conditions are met.
  32. *
  33. * Donnay Software systems makes no warranty of any kind, express
  34. * or implied, including without limitation, any warranties of 
  35. * merchantability and/or fitness for a particular purpose. Donnay
  36. * Software Systems shall not be liable for damages, whether
  37. * direct, indirect, special or consequential arising from a 
  38. * failure of this program to operate in the manner desired by the
  39. * user.  Donnay Software Systems shall not be liable for any damage
  40. * to data or property which may be caused directly or indirectly
  41. * by use of the program.
  42. *
  43. * We welcome your comments and hope you find GRAPH_IT to be a useful
  44. * graphing utility for your applications.
  45. *
  46. * Address any inquiries or comments to:
  47. *
  48. * Roger J. Donnay
  49. * Donnay Software Systems
  50. * 6151 Jasonwood Dr.
  51. * Huntington Beach, CA 92648
  52. * (714) 841-6260
  53. *
  54. * See the USERS MANUAL section at the end of this file.
  55. *
  56. * Check to see that you have the complete, unaltered source.  This file
  57. * is    265  lines,  11884  characters
  58. ***********************************************
  59.  
  60. SET PROC TO graph_pr
  61. DO grphmenu
  62. RETURN
  63.  
  64.  
  65. **********************************
  66. *
  67. *  graph_it.prg  USERS MANUAL
  68. *
  69. *                    I N T R O D U C T I O N
  70. *  GRAPH_IT.PRG and GRAPH_PR.PRG are the complete source files for a 
  71. *  general purpose bar-graphing system that draws database information 
  72. *  on the screen in vertical or horizontal bars.
  73. *
  74. *  Graph_it runs under dBaseIII or can be compiled with any version
  75. *  of Clipper.  Graph_it can be used as a complete menu-driven
  76. *  system, or a portion of Graph_it can be called from your clipper
  77. *  or dBaseIII programs.
  78. *
  79. *  Graph_it will draw up to 4 bars on the screen for each data record
  80. *  in a file, increment the file, and continue until the screen is full.
  81. *
  82. *  FILES REQUIRED
  83. *
  84. *  The standalone, menu-driven system requires the following files:
  85. *
  86. *  GRAPH_IT.PRG  -  Calling program and documentation
  87. *  GRAPH_PR.PRG  -  Procedure file with all graphing procedures/functions
  88. *  GRAPH_IT.DBF  -  Data file for keeping your parameter tables
  89. *  GRAPH_IT.FRM  -  Form file for printing parameter data
  90. *
  91. *  If you are calling only the "grphdraw" procedure, there are no data 
  92. *  files required other that the data file you intend to graph.
  93. *
  94. *  GRAPH_IT.DBF is a parameter file which is maintained by the procedure
  95. *  GRPHMENU.   GRAPH_IT.DBF has the following structure:
  96. *               
  97. *  Field  Field Name   Type   Width  Dec      Description
  98. *  -----  ------------ -----  -----  ----   -------------------------------
  99. *    1    GRPH_NMBR     C       4           Graph Number
  100. *    2    TITLE         C      40           Graph Title
  101. *    3    FILE_NAME     C       8           Name of Data file to use
  102. *    4    INDX_NAME     C       8           Name of Index file to use
  103. *    5    FILT_DESC     C      55           Filter to use (expression)
  104. *    6    BARDESC_1     C      14           Description of Bar 1
  105. *    7    BARDESC_2     C      14           Description of Bar 2
  106. *    8    BARDESC_3     C      14           Description of Bar 3
  107. *    9    BARDESC_4     C      14           Description of Bar 4
  108. *   10    BAREXPR_1     C      45           Expression for Bar 1
  109. *   11    BAREXPR_2     C      45           Expression for Bar 2
  110. *   12    BAREXPR_3     C      45           Expression for Bar 3
  111. *   13    BAREXPR_4     C      45           Expression for Bar 4
  112. *   14    PDESC_1       C      14           Description of parameter
  113. *   15    PARA_1        C      45           Expression for parameter
  114. *   16    GTYPE         C       1           Type of graph to draw
  115. *   17    BAR_INCR      N       7           Bar incremental value
  116. *   18    P_SPACE       N       2           Spacing between parameters 
  117. *
  118. *                       O P E R A T I O N
  119. *
  120. *  DRAWING GRAPHS FROM THE GRAPH MENU
  121. *
  122. *  To run Graph It from dBaseIII, just type DO GRAPH_IT.  A menu will
  123. *  come up on the screen which will open the GRAPH_IT.DBF file and
  124. *  provide you with selections for adding, editing or viewing parameters
  125. *  required for graphing data files.  You can call the graph menu from
  126. *  your own programs by entering the following commands:
  127. *         
  128. *           SET PROC TO graph_pr
  129. *           DO grphmenu
  130. *
  131. *  CAUTION: When calling the Graph It menu, the work areas I and J
  132. *           are used for the GRAPH_IT.DBF file and data file(s).
  133. *           If you have open files in these areas they will be closed
  134. *           when returning from the Graph It menu.
  135. *
  136. *  The graph parameters determine which data file and/or index file you
  137. *  will be graphing.  After you have entered your parameters and selected
  138. *  the graph you want to draw, just press key <J> and the graph will be
  139. *  drawn on the screen.  After a full screen of data is displayed, you will
  140. *  be prompted with a message to Quit, Continue, Goto a specific record,
  141. *  or draw a numeric chart.  If you select quit, you will be returned to 
  142. *  your menu and the current record in the data file will be one (1) record 
  143. *  past the last record graphed.  If you select Continue, another screen 
  144. *  of data will be graphed from the data file.  If you choose to Goto a
  145. *  specific record, you will be asked the record number to start, and 
  146. *  another screen will be graphed starting at the new record.  If you 
  147. *  choose to draw a numeric chart, the screen will clear and a chart of
  148. *  actual numeric data will be drawn on the screen corresponding to the
  149. *  bar graph just previously drawn.   If you want to do a printout of both
  150. *  the bar graph and numeric data, first draw the bar graph, print the 
  151. *  screen, then draw the numeric graph and print the screen again for a
  152. *  nice presentation of graphic and numeric data on the same printout.
  153. *
  154. *
  155. *  DRAWING GRAPHS FROM OTHER PROGRAMS (Method 1)
  156. *
  157. *  You can draw a graph from within your own programs by first setting
  158. *  up the variables that the graph program needs then calling the graph
  159. *  drawing procedure by entering the command DO GRPHDRAW.  See the 
  160. *  notes in the GRPHDRAW procedure for the parameters that must be set up
  161. *  prior to calling the procedure.  You must first be sure that the
  162. *  data you are graphing is a numeric expression, that the file containing
  163. *  the numeric data is selected in the current workspace, and the record
  164. *  pointer is on the record you want to start graphing from.
  165. *
  166. *  Example:  Let's assume you have a data file with numeric information
  167. *            for the past 10 years pertaining to sales, expenses, and
  168. *            profits.
  169. *
  170. *            The data file is named SALES.DBF and is consists of four
  171. *            fields:  YEAR, MONTH, SALES, EXPENSES.
  172. *
  173. *            To plot both style graphs showing Sales and Profit for each
  174. *            month of the year 1985, you would write the following
  175. *            program:
  176. *
  177. *            SET PROC TO graph_pr
  178. *            USE sales
  179. *            SET FILTER TO year='1985'
  180. *            GOTO TOP &&Start at first month of 1985
  181. *            STOR 'Sales' TO mbardesc_1
  182. *            STOR 'Profit' TO mbardesc_2
  183. *            STOR 'SALES' TO mbarexpr_1
  184. *            STOR 'SALES-EXPENSES' TO mbarexpr_2 && an expression for "profit"
  185. *            STOR ' ' TO mbardesc_3,mbardesc_4,mbarexpr_3,mbarexpr_4
  186. *            STOR '1985 Sales vs Profits Summary' TO mtitle
  187. *            STOR 'Month' TO mpdesc_1
  188. *            STOR 'MONTH' TO mpara_1
  189. *            STOR 100000 TO mbar_incr
  190. *            STOR 'V' TO gtype
  191. *            STOR 5 TO mp_space
  192. *            DO grphdraw  && Draw Vertical Bar Graph
  193. *            GOTO TOP
  194. *            STOR 'H' TO gtype
  195. *            STOR 1 TO mp_space
  196. *            DO grphdraw  && Draw Horizontal Bar Graph
  197. *            RETURN
  198. *
  199. *  DRAWING GRAPHS FROM OTHER PROGRAMS (Method 2)
  200. *
  201. *  A simpler method for calling a graph is available, however it
  202. *  requires that the graph parameters have been previously entered
  203. *  into the GRAPH_IT.DBF data file.  This can be done by running
  204. *  the program GRAPH_IT.PRG (DO GRAPH_IT) or by editing the GRAPH_IT.DBF
  205. *  data file with dBaseiii utilities.  You can then graph your data
  206. *  by the procedure GRPHDRW:
  207. *
  208. *            DO grphdrw WITH <Parameter 1> <Parameter 2>
  209. *
  210. *  where Parameter 1 is a string with the number of the graph you
  211. *  want to draw (this string should equal the GRPH_NMBR field in the
  212. *  GRAPH_IT.DBF file) and Parameter 2 is a logical .t. if the data file
  213. *  to graph is already open and in the current workspace, or a logical
  214. *  .f. if the data file to graph is defined by the FILE_NAME field in
  215. *  the GRAPH_IT.DBF file).
  216. *
  217. *  Example 1 :  You have a data file named EXPENSES.DBF and you wish to graph
  218. *               some numeric data for the year 1984.  The parameters to
  219. *               graph have already been established in a record in the 
  220. *               GRAPH_IT.DBF file with a Graph number of 'EXP1'. 
  221. *               The file contains expense information for several years,
  222. *               but you want to graph only 1984.  If Parameter 2 is a
  223. *               logical .t., any filter information in the GRAPH_IT.DBF
  224. *               parameter file will be ignored and the graph will start
  225. *               at the current record.
  226. *
  227. *               USE expenses
  228. *               SET FILTER TO year='1984'
  229. *               GOTO TOP
  230. *               DO grphdrw WITH 'EXP1',.T.
  231. *
  232. *  Example 2:   You want to graph all the information in the file
  233. *               EXPENSES.DBF in accordance with any filter or index file
  234. *               already named by the 'EXP1' graph in the GRAPH_IT.DBF
  235. *               file.
  236. *
  237. *               DO grphdrw WITH 'EXP1',.F.
  238. *
  239. *
  240. *  Graph It will draw consecutive records in the data file, therefore
  241. *  if you want to exclude records, use a SET FILTER statement after
  242. *  USEing the file.  The expressions used to calculate the drawn bars must
  243. *  be valid dBaseIII expressions which include valid data fields and/or
  244. *  other numeric information.   
  245. *
  246. *
  247. ******************************************
  248. *
  249. * BUGS IN EARLIER VERSIONS OF GRAPH_IT
  250. *
  251. * In versions date on or before 6-21-87, it was found that when running
  252. * under Rev. 1.0 of dBaseiii a PROCEDURE FILE ALREADY OPEN error was
  253. * encountered because the calling program and procedures were in the same
  254. * file.  This revision is distributed in two files to prevent this
  255. * occurence.
  256. *
  257. * Some procedures have new names due to the improved features over
  258. * earlier versions.  Check the names of the procedures before using
  259. * this version if you have been using an earlier version.
  260. *
  261. ********************************
  262. * end of file
  263.