Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE Automation - MS Graph
Message
From
21/05/1998 06:45:13
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
21/05/1998 05:12:20
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00100739
Message ID:
00100746
Views:
36
>Hi,
>I've two problems with MS graph.
>
>1.
>Is there any better way how to send data to OLE Automation object than in example of VFP (OLE to GENERAL field, OLE Bound Control -> controlsosurce etc.)?
>
>2.
>They are using in examples some properties like "autoformat", "hastitle" etc. I have tried to find them in help, but I haven't found them. I think, there are many of properties, but I don't know where they are described.
>
>Can you help me?
>Thanks, Petr Valach
Petr,
For a startup you should use general field + OLEboundcontrol approach. For MSGraph5 help file is ..\windows\msapps\graph5\vba_grp.hlp and for MSGraph8, ..\Microsoft Office\Office\vbagrph8.hlp (vbaxl8.hlp nearly has same commands). Here is another example
*!*	Below example is for MSGraph8. PEM are quite like Excel8 PEM
*!*	xlConstants can be found by :
*!*	-Open Excel
*!*	-Select tools\macro\VB editor
*!*	-Press F2 to bring up "Object browser"
*!*	-Find needed xlConstant type ie:xlChartType
*!*	-On right window click needed Constant ie: xl3DArea
*!*	-Below the window constant value is displayed
*!*	-Rather kludgy but currently the only way I know to find them
*!* cetin@neptune.imst.deu.edu.tr

oForm = createobject("Form")
oForm.height = 400
oForm.width = 600
oForm.show

create cursor test (val1 i, val2 n(8,4) NULL, val3 n(8,4))
for ix = 1 to 90
	insert into test ;
	  values ;
	  (ix,cos(ix)*ix,sin(ix)*ix)
endfor 
45
scan next 30     && Nullify 30 degrees
	replace val2 with .null.       && Nullify some values to see effect
endscan

***
* Prepare data for MSGraph object
***
#DEFINE TAB CHR(9)
#DEFINE CRLF CHR(13)+CHR(10)
M.CGDATA = "Degree"+TAB+"Cosine"+TAB+"Sine"+CRLF
scan
    m.cgdata = m.cgdata+;
               str(nvl(val1,0))+TAB+;
               str(nvl(val2,0))+TAB+;
               str(nvl(val3,0))+CRLF
endscan
create cursor test (gen1 g)
append blank
append general gen1 class "msgraph.chart" DATA M.CGData
***
* Now we have an MSGraph object
* Play with it
***
oForm.addobject("myGraph","OleBoundControl")
oForm.addobject("myQuit1","myQuit")
with oForm.myGraph
  .height = oForm.height - 20
  .width = oForm.width 
  .left = 0
  .top = 0
  .ControlSource = "test.Gen1"
  .HasLegend = .t.
*  .autoformat(1, 1)
  .autoformat(-4098,1)  && xl3dArea
*  .autoformat(-4101, 1)  && xl3dLine
  .visible = .t.
  .object.application.plotby = 2  && Data in columns, 1 in rows - best for table data
endwith
oForm.myQuit1.visible = .t.
read events

define class myquit as commandbutton
left=1
top=1
Caption="Close"
procedure click
	clear events
endproc
enddefine
You could also set values in datasheet instead of preparing m.cgdata everytime.
with ThisForm.Oleboundcontrol1.object.application.datasheet
  scan
     for ix = 1 to fcount()    
         .cells(recno(),ix).value = eval(field(ix))
     endfor
  endscan
endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform