Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS Graph
Message
From
25/09/1998 00:40:42
 
 
To
17/09/1998 04:45:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00137620
Message ID:
00140704
Views:
20
>>Hi,
>>I am using MS Graph in my apps. I want the graph to come up in a certain configuration - No legend, certain title, Pie Chart etc. How do I talk to the Graph Object, because I am storing it in a DBF and then calling it in the report.
>>
>>Thanks,
>>
>>Abdul Ahad
>Abdul,
>Check the example. It uses graph8. Help files for Graph5 is ..\msapps\graph5\vba_grp.hlp and grap8 ..\Microsoft office\office\vbgrp8.hlp. Command formats are not same between two versions (ie:autoformat(6,1) work only for graph5).
>
*!*	Below example is for Graph8. (Nearly same as Excel charting)
>*!* If you cannot download wc0993.exe from microsoft site
>*!*	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
>*!* cetin@neptune.imst.deu.edu.tr
>
>*** set the LOCALEID to English
>nlLocaleId=sys(3004)		&& Save local id
>=sys(3006,1033)				&& We will be sending instructions in English
>
>* Part of xlChartType constants
>#define xl3DArea 					-4098
>#define xl3DColumn					-4100
>#define xl3DLine					-4101
>#define xl3DPie						-4102
>#define xlArea						1
>#define xlBubble3DEffect			87
>#define xlLine						4
>#define xlPie						5
>#define xlRadar						-4151
>#define xlSurface					83
>
>#DEFINE TAB CHR(9)
>#DEFINE CRLF CHR(13)+CHR(10)
>
>
>create cursor test (degree i, sine n(8,4) NULL, cosine 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 sine with .null.       && Nullify some values to see effect
>endscan
>
>* Data prepare - Slower *
>* MCGDATA = " "   && Initialize with one empty cell - if will fill in object.Datasheet
>* Data prepare - Slower *
>
>* VFP preparing data is much faster
>* Try commenting this part (between * Data prepare * labels)
>* and uncommenting the commented part (between * Data prepare - Slower * labels)
>
>* Data prepare *
>wait window nowait "Filling cell values..."
>MCGDATA = ""
>nCols = fcount()
>for ix = 1 to nCols
>	MCGDATA = MCGDATA + iif(empty(MCGDATA),"",TAB)+field(ix)
>endfor
>MCGDATA = MCGDATA + CRLF
>scan
>	for ix = 1 to nCols
>		MCGDATA = MCGDATA + iif(ix=1,"",TAB)+nvl(str(evaluate(field(ix))),"")
>	endfor
>	MCGDATA = MCGDATA + CRLF
>endscan
>* Data prepare *
>
>create cursor testgen (genfld1 g)
>append blank
>append general genfld1 class "msgraph" data MCGDATA
>***
>* Now we have Graph object in gen field. (Graph8)
>* Play with it
>
>oForm = createobject("Form")
>with oForm
>	.height = 400
>	.width = 600
>	.show
>	.closable = .f.
>	.addobject("myGraph","OleBoundControl")
>	.addobject("myQuit1","myQuit")
>	.addobject("myChanger1","myDataChanger")
>	.addobject("myChanger2","myTypeChanger")	
>	with .myGraph
>		.height = oForm.height - 20
>		.width = oForm.width
>		.left = 0
>		.top = 0
>		.ControlSource = "testgen.Genfld1"
>
>* Data prepare - Slower *
>*!*         FILLING DATA IN OBJECT DATASHEET
>*!*			wait window nowait "Filling cell values..."
>*!*			with .object.application.datasheet
>*!*				select test
>*!*				nRows = reccount()+1
>*!*				nCols = fcount()
>*!*				for ix = 1 to nCols
>*!*					.Cells(1,ix).Value = field(ix)
>*!*				endfor
>*!*				scan
>*!*					for ix = 1 to nCols
>*!*						if !isnull(evaluate(field(ix)))
>*!*							.Cells(recno()+1,ix).Value = evaluate(field(ix))
>*!*						endif
>*!*					endfor
>*!*				endscan
>*!*			endwith
>* Data prepare - Slower *
>
>		wait window nowait "Plotting..."
>		.hastitle = .t.
>		.haslegend = .t.
>		.ChartTitle.caption = "This is chart title"
>		.ChartType=xl3DArea
>		.object.application.plotby = 2
>		#define xlCategory		1
>		#define xlValue			2
>		#define xlSeriesAxis	3
>		With .Axes(xlCategory)
>		    .HasTitle = .t.
>		    with .AxisTitle
>			    .Caption = "This is category title"
>			    .Font.Name = "Arial"
>			    .Font.Size = 10
>			    .Font.Bold = .t.
>		    endwith
>    	EndWith
>		With .Axes(xlSeriesAxis)
>		    .HasTitle = .T.
>		    with .AxisTitle
>			    .Caption = "This is SeriesAxis title"
>			    .Font.Size = 8
>			    .Font.Bold = .f.
>			    .Orientation = 90 && Show 90 degrees rotated
>		    endwith
>    	EndWith
>		With .Axes(xlValue)
>		    .HasTitle = .T.
>		    with .AxisTitle
>			    .Caption = "This is Value title"
>			    .Font.Size = 10
>			    .Font.Bold = .f.
>			    .Orientation = 90 && Show 90 degrees rotated - clockwise
>		    endwith
>    	EndWith
>		wait clear
>		.ChartArea.copy()
>		.visible=.T.
>	endwith
>	.myQuit1.visible = .t.
>	.myChanger1.visible = .t.
>	.myChanger2.visible = .t.
>endwith
>**** Set the LocaleId to the previous value
>=sys(3006,val(nlLocaleId))
>
>read events
>
>define class myquit as commandbutton
>left=1
>top=0
>Autosize = .T.
>Caption="Close"
>procedure click
>    release all
>	clear events
>endproc
>enddefine
>
>define class myDataChanger as commandbutton
>left=150
>top=0
>Autosize = .T.
>Caption="Change some data"
>procedure click
>	wait window nowait "Changing cell values..."
>	with thisform.myGraph.object.application.datasheet
>		select test
>		scan
>			if isnull(sine)
>				.Cells(recno()+1,2).Value = sin(recno())*recno()
>  			endif
>		endscan
>	endwith
>	wait clear
>endproc
>enddefine
>
>define class myTypeChanger as commandbutton
>left=300
>top=0
>Autosize = .T.
>Caption="Change Chart Type"
>procedure click
>	thisform.myGraph.charttype = xlBubble3dEffect
>endproc
>enddefine
Cetin

Cetin,
Thanks for your help. THis has solved my problem.
The help file explains the PlotBy property as:

mygraph.PlotBy = value

This generates an error.

You have used:
mygraph.object.application.plotby = value
How and where did you get this object model. The help file does not state anything.
Thanks

Abdul Ahad
Abdul Ahad Khan
CSi
www.csi-pk.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform