Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to create 3d bar chart
Message
From
11/05/2006 15:46:13
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
11/05/2006 15:24:41
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01118887
Message ID:
01121128
Views:
87
Yes at first look printing is a problem. Using dibapi32.dll (available for download from MS with source) it is easy. I save graphs as bmp, show on report using oleboundcontrol/picture with expression (filename), report and erase them. Multiple charting, saving to bmp is faster than creating a single chart with others that I tested. Report shows up instantly as if it doesn't contain any charts. ie: (parts of operation):
Local oCharter
oCharter=Createobject('charter')
Select myReportCursor
scan
*oCharter.DrawChartFromCursor(..labelColumn,datacolumn params....)
	oCharter.Copy2Clipboard()
	lcGraphFile = Forcepath(Sys(2015)+".bmp", Sys(2023))
	if ClipBoard2BMP(m.lcGraphFile)
	  replace GraphFile with m.lcGraphFile
        endif
EndScan

Procedure ClipBoard2BMP
Lparameters tcFileName
Local llResult,lcFileName
*
* Predefined Clipboard Formats
*
#Define CF_DIB              8

Declare short IsClipboardFormatAvailable In win32api Integer cbformat
Declare Integer GetClipboardData In win32api Integer uFormat
Declare Integer OpenClipboard In win32Api Integer hWndNewOwner
Declare Integer CloseClipboard In win32Api
Declare Integer SaveDIB In DibAPI32.Dll Integer hBitmap, String @ cFileName
Declare Integer GetSystemPalette In DibAPI32.Dll
Declare Integer GetActiveWindow In win32Api

lcFileName = Fullpath(Iif(Empty(m.tcFileName),;
	PUTFILE("Save as Bitmap", 'FromClipBoard', "BMP"), ;
	m.tcFileName))
If !Empty(m.lcFileName) and ( IsClipboardFormatAvailable(CF_DIB) # 0 )
	IF ( OpenClipboard(GetActiveWindow()) != 0 )
		llResult = ( SaveDIB(GetClipboardData( CF_DIB ), @lcFileName) = 0)
		CloseClipboard()
	endif
Endif
Return m.llResult

*Charter::Copy2Clipboard()
 Procedure Copy2Clipboard
	With This.Chart
		*!* Select Chart Part 1
		.SelectPart(1,1,1,1,1) && VtChPartTypePlot, index1, index2, index3, index4)
		*!*	Copy the chart to the clipboard in Windows Metafile format.
		.EditCopy
	Endwith
 Endproc
Cetin

>Cetin,
>
>Hi. Yes, I was hoping for your opinion again. One of the things that came up was printing. I saw some posts indicating that printing was problematic with MSChart, then again, saw others indicating a resolution of that. Printing is a key factor.
>
>>David,
>>Why are you CCing? Asking my opinion? If so I repeat MSChart.
>>Cetin
>>
>>>Marcia,
>>>
>>>Thanks!
>>>
>>>I guess I'll end up trying all of these methods at some point.
>>>
>>>For starters though I've downloaded the west wind stuff and am testing it now. I've got my own sample data working. The class seems pretty straightforward to use.
>>>
>>>
>>>>Since I know the VFP report writer reasonably well this method seems appealing. It seems like less of a learning curve than MSChart or MSGraph.
>>>>
>>>>Piece of cake to use MsGraph or Excel Automation to print in a report. You just use an oleBound Control in the report, just like the code sample. I do not know if there are still issues with images refreshing in reports - I know there used to be.
>>>>
>>>>One consideration, though, is that although they haven't asked for it yet, I'm anticipating that down the road the users might want 'their original spreadsheet back'. Meaning that they might want to play with the output on their own. If that's the case, then I'm thinking that in the long run I have to use OLE Automation anyway?
>>>>
>>>>Seems sensible to me.
>>>>
>>>>Your article was written in 2002. Are the options fundamentally the same now? Or are there other issues or new implementations to consider?
>>>>
>>>>Not that I know of....
Ç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