Using UPDATEGRPH in GENGRAPH.APPLast reviewed: April 29, 1996Article ID: Q101597 |
The information in this article applies to:
SUMMARYThe GraphWizard is a FoxPro application named GENGRAPH.APP. The UPDATEGRPH procedure updates a graph that was created and saved with the GraphWizard using the data in the currently selected DBF/cursor. The updated graph can then be displayed using the SHOWGRPH procedure.
MORE INFORMATIONIn version 2.5, the correct syntax for calling UPDATEGRPH is:
DO UPDATEGRPH IN GENGRAPH.APP WITH <expC1>, <expN1> ; [, <expN2>[, <expC2>]]The clauses that are used with the UPDATEGRPH procedure in version 2.5 are <expC1> and <expN1> and two optional clauses: <expN2> and <expC2>.
DO UPDATEGRPH IN GENGRAPH.APP WITH <expC1>, <expN1>[, <expN2> ; [, <expC2>[, <array>, <expC3>]]]The clauses that are used with the UPDATEGRPH procedure in versions 2.5a and 2.5b are <expC1> and <expN1> and four optional clauses: <expN2>, <expC2>, <array>, and <expC3>.
The first field in the DBF/cursor is used for the x-axis labels, and the other fields are stored as numeric values in the appropriate cells of the spreadsheet. It is your responsibility to ensure that the DBF/cursor fields are in the proper order and that they contain data that can be graphed. Compared with mode 1 and mode 2, mode 0 provides an intermediate level of flexibility, but makes you do more work. For example:
DO UPDATEGRPH IN GENGRAPH.APP WITH ; "c:\foxprow\qrygraph.dbf",4,0,"Graph Title"When mode = 1 (the default if no mode is specified), UPDATEGRPH updates the previously saved graph with data from the currently selected DBF/table. In this mode, UPDATEGRPH and REFRESHGRPH do essentially the same thing. The previously saved field names, order of data, x-axis field, and graph title are used to format the new data in the saved graph. If you attempt to update a graph with data from a DBF/cursor that does not contain all the fields found in the DBF/cursor originally used for the graph, the message "Cannot update that graph with this data" will appear. Although the new DBF/cursor can contain the fields in a different order or contain additional fields, all the original fields must be present in order to update the graph. For example:
DO UPDATEGRPH IN GENGRAPH.APP WITH "c:\foxprow\qrygraph.dbf",4In versions 2.5a and 2.5b, when mode = 2, you must supply <array> and <expC3> to UPDATEGRPH, which will use them to format the data found in the currently selected DBF/cursor. Mode 2 provides the most flexibility but requires the most work to set up. You would use this mode if the DBF/cursor fields were not already ordered in the sequence that the graph requires, or if only a few of the fields found in the DBF/cursor are to be included in the graph. In versions 2.5a and 2.5b, the syntax is as follows:
DIMENSION g_flist[4] g_flist[1] = "field1" && name of first data field g_flist[2] = "field2" && name of next data field g_flist[3] = "field3" && ... and so forth g_flist[4] = "field4" g_xaxis = "field5" && name of field whose values go on x-axis DO UPDATEGRPH IN GENGRAPH.APP WITH; "c:\foxprow\qrygraph.dbf",4,2,"Graph title",; g_flist, g_xaxisFor example, suppose you used the GraphWizard to create a line chart, then customized the chart from within MS Graph (changing fonts, repositioning the legend, modifying colors, and so forth). Furthermore, suppose that the graph contains sales data from a field named "Sales". The x-axis labels are month names from a "Months" field. You save the customized graph in a DBF/table called QRYGRAPH.DBF. QRYGRAPH.DBF already has other seven other graphs in it--the new graph is saved in record number 8. Later, you want to reuse the same carefully customized graph to display data from completely different fields, perhaps "Expenses" and "Years" instead of "Sales" and "Months". You can use the UPDATEGRPH procedure to make such changes to the original graph. For example: * The DBF with the expenses and years data is in the current work area: DIMENSION g_flist[1] g_flist[1] = "Expenses" g_xaxis = "Years" DO updategrph IN gengraph.app WITH "qrygraph.dbf", 8, 2, ; "Expenses by Year", g_flist, g_xaxisThis command updates the stored graph in record 8 of QRYGRAPH.DBF. The new graph title is "Expenses by Year". The first column of data -- the data shown in the MS Graph spreadsheet if a graph was double-clicked -- comes from the DBF/cursor field "Expenses". The x-axis labels are drawn from the values stored in the DBF/cursor field named "Years". NOTE: In FoxPro for Macintosh only, executing UPDATEGRPH changes the font of window "screen" to Geneva, 10.
|
Additional reference words: FoxMac FoxWin 2.50 2.50a msgraph 2.50b
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |