| MSCHART AND VISUAL FOXPRO 9 |
|
| Author |
Message |
Mervyn-w

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
I am trying to use MSCHART with VFP9 and have some success until I want to set or change Legions, Titles, Colors etc. or to enter data into the second Y axis. Using any of the property / constant names only produces the message "Name Unknown". Any suggestions.
Visual FoxPro1
|
| |
|
| |
 |
MarciaAkins

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
Mervyn-w wrote: | |
I am trying to use MSCHART with VFP9 and have some success until I want to set or change Legions, Titles, Colors etc. or to enter data into the second Y axis. Using any of the property / constant names only produces the message "Name Unknown". Any suggestions.
|
|
You can go to the tools and utilities page at http://www.tightlinecomputers.com and download the white papaer and sample code from my conference session on "Creating Graphs in VFP". One of the samples uses MsChart - but there are also samples using MsGraph, Excel automation and the Office Web Components.
|
| |
|
| |
 |
collide

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
i saw the samples which uses MSChart but is there a more easy way to create graphs in VFP i mean the simpliest way other than that :) because it looks difficult for me..thanks
|
| |
|
| |
 |
MarciaAkins

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
collide wrote: | i saw the samples which uses MSChart but is there a more easy way to create graphs in VFP i mean the simpliest way other than that :) because it looks difficult for me..thanks
|
|
The white paper gives you 4 examples from which to choose. Pick one that you like 
|
| |
|
| |
 |
collide

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
i saw the examples and i think i should use MSGraph instead of MSChart because i need to print the graphs too..but i still dont know how to do it i dont even know what to edit there :) sorry..is there a more easy way to create graphs i mean a step by step procedure to create an MSGraph..thanks :)
|
| |
|
| |
 |
MarciaAkins

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
collide wrote: | i saw the examples and i think i should use MSGraph instead of MSChart because i need to print the graphs too..but i still dont know how to do it i dont even know what to edit there :) sorry..is there a more easy way to create graphs i mean a step by step procedure to create an MSGraph..thanks :)
|
|
I do not understand what you are asking for here. The white paper gives you a complete explanation of how to generate graphs using 4 different tools. The sample code is fully functional and well commented. Are you asking me to write your application for you I would be happy to - this is what I do for a living. My hoursly rate is $120.00 US per hour and since you do not have a history with our company, we would expect a down payment of 50%.
|
| |
|
| |
 |
CetinBasoz

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
I would forget MSGraph, it's slow. Use MSChart. It is simple and printable. ie: A quick sample (your picture control on report is file with expression: (getChart(CustomerID))
It shows up instantly (well when it does the myReport SQL) because graph drawing is pushed to "report form" and MSChart is fast.
*#INCLUDE "mschrt20.h" #Define VtChChartType3dBar 0 #Define VtChChartType2dBar 1 #Define VtChChartType3dLine 2 #Define VtChChartType2dLine 3 #Define VtChChartType3dArea 4 #Define VtChChartType2dArea 5 #Define VtChChartType2dHorizontalBar 11
Set Safety Off Select cust_id,emp_id,Sum(order_net) As totalSale; FROM orders ; GROUP By 1,2 ; INTO Cursor empSales ; nofilter Select cs.cust_id As customerID,cs.Company, ; emp.First_Name - (' '+emp.Last_Name) As employee,; sl.totalSale ; FROM empSales sl ; INNER Join customer cs On cs.cust_id = sl.cust_id ; INNER Join employee emp On emp.emp_id = sl.emp_id ; ORDER By 1,3 ; INTO Cursor myReport ; nofilter
loCharter = Createobject('myCharter') *MODIFY REPORT salescharting1 Report Form salescharting Prev
Procedure GetChart(tcCustomerID) lcChartFile = Forcepath(Trim(m.tcCustomerID)+'.bmp',Sys(2023)) Local lcTemp lcTemp = Forcepath(Sys(2015)+".tmp",Sys(2023)) lnRecno = Recno() Copy Fields employee,totalSale ; to (m.lcTemp) ; for customerId==m.tcCustomerId ; Type Delimited With "" With Tab Go m.lnRecno loCharter.Chart2Clipboard(Filetostr(m.lcTemp)) ClipBoard2BMP(m.lcChartfile) Erase (m.lcTemp) Return m.lcChartFile Endproc
Procedure ClipBoard2BMP Lparameters tcFileName Local llResult,lcFileName * * Predefined Clipboard Formats * #Define CF_TEXT 1 #Define CF_BITMAP 2 #Define CF_METAFILEPICT 3 #Define CF_SYLK 4 #Define CF_DIF 5 #Define CF_TIFF 6 #Define CF_OEMTEXT 7 #Define CF_DIB 8 #Define CF_PALETTE 9 #Define CF_PENDATA 10 #Define CF_RIFF 11 #Define CF_WAVE 12 #Define CF_UNICODETEXT 13 #Define CF_ENHMETAFILE 14 #Define CF_HDROP 15 #Define CF_LOCALE 16 #Define CF_MAX 17 #Define CF_OWNERDISPLAY 0x0080 #Define CF_DSPTEXT 0x0081 #Define CF_DSPBITMAP 0x0082 #Define CF_DSPMETAFILEPICT 0x0083 #Define CF_DSPENHMETAFILE 0x008E
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
lcFileName = Fullpath(Iif(Empty(m.tcFileName),; PUTFILE("Save as Bitmap", 'FromClipBoard', "BMP"), ; m.tcFileName)) If !Empty(m.lcFileName) And ( IsClipboardFormatAvailable(CF_DIB) # 0 ) OpenClipboard(0) llResult = ( SaveDIB(GetClipboardData( CF_DIB ), @lcFileName) = 0) CloseClipboard() Endif Return m.llResult Endproc
Define Class myCharter As Form Height = 400 Width = 700 Add Object Chart As OleControl With ; Height = 400,Width = 700,OleClass="MSChart20Lib.MSChart.2"
Procedure Chart2Clipboard(tcData) _Cliptext = m.tcData With This.Chart .Editpaste .ChartType = VtChChartType2dBar .SelectPart(1,1,1,1,1) && VtChPartTypePlot, index1, index2, index3, index4) *!* Copy the chart to the clipboard in Windows Metafile format. .repaint .EditCopy .ToDefaults() Endwith Endproc Enddefine
|
| |
|
| |
 |
collide

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
ah ok...so ill use MSChart then i will use the graphs.vcx to do it,right ...what will i do with those codes you posted give me a step by step procedure on what should i do coz i need to know how do it coz on the time of my thesis defense, i should be able to do it on the spot..so i really need to learn it..hope to hear from you again...thanks for the help :)
|
| |
|
| |
 |
CetinBasoz

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
Wrong. I don't remember I said something about graphs.vcx (and I don't have an idea what it is).
The code I posted is missing only 2 pieces:
1) DibApi32.dll - A well known DLL from MS samples. You can get it from http://support.microsoft.com/kb/130804
2) The report form itself. Create a report from sample cursor (before report form line). ie:
create report myReport from alias() column modify report myReport
Add a grouping ( by customerID ). In group footer add an OleBound/Picture control and size it big enough to show whole graph (you can experiment). In its file expression enter:
(getChartFile(customerID))
That's all. Then just run the code to see it (select all, right click, execute selection. Or save as prg and do)
PS: I don't remember the function name I used in sample exactly. If it's something different than write the correct one.
|
| |
|
| |
 |
collide

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
CetinBasoz wrote: | Wrong. I don't remember I said something about graphs.vcx (and I don't have an idea what it is).
The code I posted is missing only 2 pieces:
1) DibApi32.dll - A well known DLL from MS samples. You can get it from http://support.microsoft.com/kb/130804
2) The report form itself. Create a report from sample cursor (before report form line). ie:
create report myReport from alias() column modify report myReport
Add a grouping ( by customerID ). In group footer add an OleBound/Picture control and size it big enough to show whole graph (you can experiment). In its file expression enter:
(getChartFile(customerID))
That's all. Then just run the code to see it (select all, right click, execute selection. Or save as prg and do)
PS: I don't remember the function name I used in sample exactly. If it's something different than write the correct one.
|
|
ive already downloaded the DibApi32.dll but im still clueless on what to do first with the codes uve given me :) sorry because its really my first time to do graphs on foxpro and it takes time for me to understand it clearly..i want to know what should i do in sequence so that ill be able to do it correctly give an example table with values and then from there, tell me what to do in sequence for me to understand it better :) thanks for the patience..hope to hear from u again..thanks :)
|
| |
|
| |
 |
CetinBasoz

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
I advise to read getting started sections first. I gave you everything you need. I don't understand what steps else you want.
Create your report and run the code (just be sure testdata.dbc is in your search path). There is nothing to understand about graphing. Code does that for you.
|
| |
|
| |
 |
VFPDev

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
I am trying the below simple code as a try in VFP, but i am getting an error on: Thisform.chartData = arrData. Any idea
thx
DIMENSION arrData(4,4)
arrData(1, 1) = "Jan"
arrData(2, 1) = "Feb"
arrData(3, 1) = "Mar"
arrData(4, 1) = "Apr"
arrData(1, 2) = 8
arrData(2, 2) = 4
arrData(3, 2) = 0.3
arrData(4, 2) = 3
arrData(1, 3) = 0.2
arrData(2, 3) = 3
arrData(3, 3) = 6.3
arrData(4, 3) = 2
arrData(1, 4) = 5
arrData(2, 4) = 7
arrData(3, 4) = 2
arrData(4, 4) = 9
thisform.msChart1.chartType= 2 && VtChChartType3dLine
thisform.msChart1.chartData = arrData
thisform.msChart1.Visible=.t.
|
| |
|
| |
 |
CetinBasoz

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
Try this:
thisform.msChart1.chartData = getArrayRef("arrData")
*getArrayRef.prg lparameters tcArrayName return @&tcArrayName
|
| |
|
| |
 |
VFPDev

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
Of course it does not work. Have you tried it
thx
|
| |
|
| |
 |
CetinBasoz

|
Posted: Visual FoxPro General, MSCHART AND VISUAL FOXPRO 9 |
Top |
No I didn't and that is why I said "try". I don't have VFP (nor any other thing including .Net framework) to test something (on this box). If you want to see working code, visit universalthread.com and search for codes that I sent multiple times.
Making = arrData style is not important though. You can simpy use row,col in a loop (check the sample on UT for many different types of settings).
I don't understand "of course" part.
|
| |
|
| |
 |
| |
|