How to generate a chart in the VFP

xiaoxiao2021-03-06  84

How to generate a chart in the VFP

A beautiful statistical map can more intuitively reflect the intrinsic contact of the data, using the VFP graphics wizard, we can easily produce a chart. However, in the application we can't make our own design statistical maps. How to make VFP automatically generate a chart? 1. VFP knows that the user who uses the graphic wizard for the statistical management of the chart. In the final step, the VFP will prompt you to save the graphic to Table, why? It turns out that VFP puts the various data of the figure into a table, in this table, there is only one universal field OLEGRAPH. With OLEGRAPH field, the system automatically calls MS-Graph to make a mapping. Second, the associated function is in the VFP, using the DO (_GENGRAPH) with parameter1, parameter2, ..... PARAMETER9 function completes the related drawing operation. Among them, the nine parameters are generally implicitly as follows (seeing only the main parameters here):

Parameter1 refers to whether the drawing operation is automated, if this parameter is "AutograPH". Parameter2 specifies the type of statistical graphics: round cake diagram, histogram, etc., with a value representation. Parameter4 Sets the title of the chart. Parameter8 Sets the Table of the Statistical Data. Parameter9 specifies the statistical fake method: t means that the statistical is placed in the Form.

Third, design example:

Suppose there is a database CZ.DBF, which is now made according to the above information. The content is as follows:

Quarter output value 1 quarter 1200 second quarter 3500 third quarter 2300 fourth quarter 4600

1. Establish a table (Table) graph1.dbf, only one field Olegraph, type is a general field.

2. Create a new form of form1, introduce CZ.DBF and Graph1.dbf into the data environment of the form, and set the exclusive of graph1.dbf to true value T.

3. Add an OleboundControl object in Form1 to set its ControlSource for graph1.olegraph. At the same time, add a button to set its title as "drawing".

4. In order to maintain a dynamic update of graphics (not affected by "old" data in Graph1), in Form's ACTIVE

The following code is added:

Set Safe Off

SELE Graph1

zap

Set Safe On

5. In the Click event of the "Draw" object, add the following code:

Wait 'is drawing, please wait a' Window Nowait

SELE CZ

SELE quarter, output value from CZ INTO CURSOR TMP

Do (_GRAPH) with 'autograph' ,;

11, 1, 'Order Statistics', 1, 1, 1, 'Graph1',. T.

Use in TMP

thisform.oleboundControl1.refresh

Wait 'drawing!' Window Nowait

转载请注明原文地址:https://www.9cbs.com/read-122860.html

New Post(0)