Article ID: 186094
Article Last Modified on 6/29/2004
************** Beginning of Code ******************
* Create a table with a general field and add
* a graph.
IF ! FILE("mygraph.dbf")
CREATE TABLE mygraph (graph_fld G)
graph_var = " " + chr(9) + "MyData" + chr(13) + chr(10) ;
+ "Data1" + chr(9) + "5" + chr(13) + chr(10) + "Data2" ;
+ chr(9) + "10" + chr(13) + chr(10)
APPEND BLANK
APPEND GENERAL graph_fld CLASS "MsGraph.Chart" DATA graph_var
ELSE
IF ! USED("mygraph")
USE mygraph IN 0
ENDIF
ENDIF
PUBLIC oForm
oForm = CREATEOBJECT("form")
oForm.ADDOBJECT("Ole1","OleBoundControl")
oForm.ADDOBJECT("Command1","MyCommand")
oForm.Ole1.ControlSource = "mygraph.graph_fld"
oForm.height=400
oForm.width=600
oForm.Caption = "MyGraph"
oForm.Ole1.Height = 300
oForm.Ole1.Width = 500
oForm.Ole1.HasTitle = .T.
oForm.Ole1.ChartTitle.Caption = "Chart that Plots by Row or Column."
oForm.Ole1.ChartTitle.Font.Name = "Arial"
oForm.Ole1.ChartTitle.Font.Size = 12
oForm.Ole1.ChartTitle.Font.Bold = .T.
oForm.Ole1.Type = 3
oForm.Visible=.t.
oForm.Ole1.Visible=.t.
oForm.Command1.Visible=.t.
* The PlotBy property allows the switching of Rows and Columns.
oForm.Ole1.Object.Application.PlotBy=1
DEFINE CLASS MyCommand AS COMMANDBUTTON
Caption = 'Plot by Column'
Visible = .T.
Left = 450
Top = 350
Height = 30
Width = 100
PROCEDURE Click
* Check what PlotBy is set to and change it.
IF oForm.Ole1.Object.Application.PlotBy = 1
oForm.Ole1.Object.Application.PlotBy = 2
oForm.Command1.Caption = 'Plot by Row'
ELSE
oForm.Ole1.Object.Application.PlotBy = 1
oForm.Command1.Caption = 'Plot by Column'
ENDIF
Thisform.Refresh
ENDDEFINE
************** End of Code ******************
Click the command button to toggle between "Series in Rows" and "Series in
Columns".
157225 SAMPLE: Msgrp5cg.exe Graph Wizard Data Series Display Changes
Additional query words: kbDSupport kbDSE FxinteropOle
Keywords: kbhowto KB186094