JavaScript Editor js editor     Web development 

Main Page

File: ...\Samples\Solution\OLE\Olegraph.scx

This sample shows how to incorporate MS Graph into your applications. MS Graph 5.0 is an Automation server that Visual FoxPro can automate using the standard CREATEOBJECT(В ) function. With Visual FoxPro, Graph objects can be embedded in either bound or unbound OLE Controls. An OleBoundControl (bound to a General field) is the only way to programmatically insert data into a graph.

MS Graph's automation support provides access only to a graph object, not its datasheet. Data can be inserted into a Graph only with the APPEND GENERAL command on a General field. The following code uses the HasLegend property and is an example of automation:

В Copy Code
cGData = ""+TAB+"Cats"+TAB+"Dogs"+CRLF+;
APPEND GENERAL gen1 CLASS "msgraph.chart" DATA m.cGData
THIS.OleBoundControl1.ControlSource = "Gen1"
THIS.OleBoundControl1.HasLegend = .F.

The APPEND GENERAL command in this case creates a new chart object. If you do not include the CLASS "msgraph.chart" clause, then the chart is merely updated. The CLASS clause will create a new chart and override any existing formatting.

See Also

JavaScript Editor js editor     Web development