Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Plotting graph in Visual FoxPro v5.0
Message
 
À
10/12/1998 11:56:35
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00165955
Message ID:
00166202
Vues:
21
Thanks very much Cetin. You seem to have an excellent grasp for automation. Two extra questions.

1. Do you prefer Excel automation to create graphs over MSGraph and why?
2. Is there any docs that outline the PEM's available and how to use them for automation of Word and Excel? Keep in mind I'm an automation newbie and would prefer something not to complicated to begin with. TIA


>>Thanks for posting this Cetin. I've been pondering MSGraph and using Excel like this seems to be better.
>>
>>How would I go about displaying this graph in VFP? I could do ox.Visible=.T. but it would look cleaner to display it directly in my VFP app. TIA
>>
>Well then code changes a little bit. Suppose you added an OLEConatiner control on form and "Created new" as MS Excel chart. Since excel on form object reference changes to "thisform.olecontrol1" instead of createobject. Notice that code nearly the same, removed "activeworkbook", added "sizewithwindow" :
* Could be init of form, a command button click etc
>* 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
>
>*** set the LOCALEID to English
>nlLocaleId=sys(3004)		&& Save local id
>=sys(3006,1033)			&& We will be sending instructions in English
>ox = ThisForm.Olecontrol1 && <----Object ref changed
>with ox.worksheets(1)  && <----------Activeworkbook removed here
>	.Cells(1,1).Value = "NumProd1"
>	.Cells(1,2).Value = "AMount"
>	.Cells(1,3).value = "Quota"
>	.Cells(2,1).Value = 113
>	.Cells(2,2).Value = 12000
>	.Cells(2,3).value = 23
>	.Cells(3,1).Value = 254
>	.Cells(3,2).Value = 45000
>	.Cells(3,3).value = 24
>	.Cells(4,1).Value = 165
>	.Cells(4,2).Value = 37000
>	.Cells(4,3).value = 42
>	ox.charts.add()
>	ox.charts(1).chartwizard(.range(.cells(1,1),.cells(4,3)),xl3DColumn,4,1,0,1,1,"","","","")
>endwith
>with ox.charts(1)
>	.hastitle = .t.
>	.haslegend = .t.
>	.ChartTitle.caption = "This is chart title"
>	.ChartType=xl3DArea  && Set a charttype
>	.plotby = 2
>	* Now play with chart format
>		#define xlCategory		1
>		#define xlValue			2
>		#define xlSeriesAxis	3
>		With .Axes(xlValue)
>		    .HasTitle = .T.
>		    with .AxisTitle
>			    .Caption = "This is Rotated Value title"
>			    .Font.Size = 10
>			    .Font.Bold = .f.
>			    .Orientation = 90 && Show 90 degrees rotated
>		    endwith
>    	EndWith
>    	.charttype = xl3DLine  && Change charttype in between
>    	.SizeWithWindow = .T.  && <----------Size chart with its window
>*    	.PrintOut   && Print chart
>endwith
>=sys(3006,val(nlLocaleId))
Cetin
Colin Magee
Team Leader, Systems Development
Metroland Media Group Ltd.
Mississauga, Ontario, Canada

cmagee@metroland.com

Never mistake having a career with having a life.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform