Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS Graph riddle
Message
From
18/11/1998 03:50:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
00156885
Message ID:
00158642
Views:
24
>Cetin!
>
>What a friend you are ... Thanks.
>
>If I understand your code, you are having a the report open, and then you bind the general field to an olebound control on a form.
>
>Is that a requirement? Assuming I know exactly which codes I need for my graph, is there anyway that I can generate the contents of the general field without user intervertion at all?
>
>TIA,
>
>Marc

Sure Marc,
Just remove buttons and directly call their code and never call form.show. With MSGraph AFAIK it's a necessity you use a gen field. There is no "print" option in MSGraph so the only way I know is a gen field + report form. Big problem if you change charttype on the fly and not click on report preview the view of graph is not the same as on screen (default column type) and printed in default format. As a workaround you can mimic mouse click in preview window. Replace last line of code with :
report form testgraph preview nowait
mouse click window ("Report Designer")
report form testgraph to printer noconsole
release window "Report Designer"
I know it's not a good way but currently is the only way I know to accomodate charttype change on the fly w/o user intervention.
*** 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 *
wait window nowait "Pls wait. Generating report..."
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
*create report testgraph from testgen form
* modi report testgraph
* Report form is ready made
***

oForm = createobject("Form")
with oForm
	.height = 400
	.width = 600
	.addobject("myGraph","OleBoundControl")
	with .myGraph
		.height = oForm.height - 20
		.width = oForm.width 
		.left = 0
		.top = 0
		.ControlSource = "testgen.Genfld1"
		.hastitle = .t.
		.haslegend = .t.
		.ChartTitle.caption = "This is chart title"
		.visible=.T.
		.ChartType=xlBubble3DEffect
		.object.application.plotby = 2
		.refresh
	endwith
endwith
**** Set the LocaleId to the previous value
=sys(3006,val(nlLocaleId))
report form testgraph preview
Ç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
Next
Reply
Map
View

Click here to load this message in the networking platform