For Programmers: Free Programming Magazines  


Home > Archive > Visual FoxPro Programming > May 2006 > Graphing in VFP? Help? Example in post...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Graphing in VFP? Help? Example in post...
43fan

2006-05-23, 8:12 am

Ok, I've visited this
page:http://support.microsoft.com/defaul...kb;EN-US;129533

And see this code:
#DEFINE cr CHR(13)
#DEFINE tab CHR(9)

USE datafile IN 1
USE grphfile IN 2
SELECT datafile
cGraphString = ""

* Build tab-delimited string of field names:
FOR iCounter = 1 TO 5
cGraphString = cGraphString + FIELDS(iCounter) ;
+ IIF(iCounter < 5,tab,cr)
ENDFOR

* Concatenate the data, converting numeric fields to character:
SCAN
FOR iCounter = 1 TO 5
cGraphString = cGraphString + IIF(TYPE(Fields(iCounter))='C',;
EVALUATE(FIELDS(iCounter)) ;
,str(EVALUATE(FIELDS(iCounter)),16,2);
);
+ IIF(iCounter < 5,tab,cr)
ENDFOR
ENDSCAN

SELECT grphfile
APPEND GENERAL mgraph DATA cGraphString
-----------------------------------------------------------------

I tried to set up both datafile and grphfile, and then run the program. I
get nothing in the GENERAL field that is in grphfile. Just a lowercase
"gen". In datafile, I have five fields, first is a character field with
values in, the next four are integer fields, with values there as well.
There are five records total in the table.

What am I doing wrong? What should I see in the GENERAL field, the actual
graph? A data string that will be used in some way to actually display the
graph? Really on this. Right now, I'm using FP to generate a text
file, that then is used by Excel to actually create the graphs I need. I'd
really like to be able to generate them completely in VFP.

Thanks!
Shawn


Dan Freeman

2006-05-23, 7:13 pm

Um, no ... you're NOT trying to create the graph "completely in VFP". You're
still using an external program (MS Graph) and my guess is your result is
because you don't have it installed. <s>

Why do you want to nuke a successful graphing capability? <g>

General fields, which are generally <g> to be avoided, are not "completely
within VFP" -- they hold blobs of data that belong to an external program.
VFP doesn't know a dang thing about what's in 'em, how to display 'em, or
anything else about 'em. When a general field is encountered, VFP reaches
out into the Windows ooze to whoever owns that data and says "display
this!". That's the extent of the control VFP (or you) have over a general
field.

I'd stick with Excel if I were you.

Dan

43fan wrote:
> Ok, I've visited this
> page:http://support.microsoft.com/defaul...kb;EN-US;129533
>
> And see this code:
> #DEFINE cr CHR(13)
> #DEFINE tab CHR(9)
>
> USE datafile IN 1
> USE grphfile IN 2
> SELECT datafile
> cGraphString = ""
>
> * Build tab-delimited string of field names:
> FOR iCounter = 1 TO 5
> cGraphString = cGraphString + FIELDS(iCounter) ;
> + IIF(iCounter < 5,tab,cr)
> ENDFOR
>
> * Concatenate the data, converting numeric fields to character:
> SCAN
> FOR iCounter = 1 TO 5
> cGraphString = cGraphString +
> IIF(TYPE(Fields(iCounter))='C',;
> EVALUATE(FIELDS(iCounter)) ;
> ,str(EVALUATE(FIELDS(iCounter)),16,2); );
> + IIF(iCounter < 5,tab,cr)
> ENDFOR
> ENDSCAN
>
> SELECT grphfile
> APPEND GENERAL mgraph DATA cGraphString
> -----------------------------------------------------------------
>
> I tried to set up both datafile and grphfile, and then run the
> program. I get nothing in the GENERAL field that is in grphfile.
> Just a lowercase "gen". In datafile, I have five fields, first is a
> character field with values in, the next four are integer fields,
> with values there as well. There are five records total in the table.
>
> What am I doing wrong? What should I see in the GENERAL field, the
> actual graph? A data string that will be used in some way to actually
> display the graph? Really on this. Right now, I'm using FP
> to generate a text file, that then is used by Excel to actually
> create the graphs I need. I'd really like to be able to generate
> them completely in VFP.
>
> Thanks!
> Shawn



43fan

2006-05-23, 7:13 pm


"Dan Freeman" <spam@microsoft.com> wrote in message
news:%23137IHofGHA.4864@TK2MSFTNGP05.phx.gbl...
> Um, no ... you're NOT trying to create the graph "completely in VFP".
> You're
> still using an external program (MS Graph) and my guess is your result is
> because you don't have it installed. <s>
>
> Why do you want to nuke a successful graphing capability? <g>
>
> General fields, which are generally <g> to be avoided, are not "completely
> within VFP" -- they hold blobs of data that belong to an external program.
> VFP doesn't know a dang thing about what's in 'em, how to display 'em, or
> anything else about 'em. When a general field is encountered, VFP reaches
> out into the Windows ooze to whoever owns that data and says "display
> this!". That's the extent of the control VFP (or you) have over a general
> field.
>
> I'd stick with Excel if I were you.


My problem with sticking to Excel is, these graphs are all part of a final
report that is to be sent to customers. The end result would be placed in a
single PDF file, along with several reports that are run within VFP.
>
> Dan
>
> 43fan wrote:
>
>



Dan Freeman

2006-05-23, 7:13 pm

43fan wrote:
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:%23137IHofGHA.4864@TK2MSFTNGP05.phx.gbl...
>
> My problem with sticking to Excel is, these graphs are all part of a
> final report that is to be sent to customers. The end result would
> be placed in a single PDF file, along with several reports that are
> run within VFP.


I'm glad I asked that question then. This is a horse of an ENTIRELY
different color!

Yes, you do need a general field if you're printing the graph in a report.
Or why don't you print to a PDF "printer" from Excel directly and merge the
resulting PDF with the one you create from VFP?

You skipped over the "Which tool should I use?" question and went right for
"How do I use this hammer?" when you might actually need a screwdriver. <g>

Dan


43fan

2006-05-23, 7:13 pm


"Dan Freeman" <spam@microsoft.com> wrote in message
news:%23fCnYXpfGHA.2032@TK2MSFTNGP02.phx.gbl...
> 43fan wrote:
>
> I'm glad I asked that question then. This is a horse of an ENTIRELY
> different color!
>
> Yes, you do need a general field if you're printing the graph in a report.
> Or why don't you print to a PDF "printer" from Excel directly and merge
> the
> resulting PDF with the one you create from VFP?
>


I do that now... I print everything I can in VFP, directly to PDF using
FRX2ANY. Then I create the graphs I need in Excel, and then append them
into the previously created PDF. Thing is, I want it all automated at some
point, no putting the manual together manually. We may have as many as say
7 sets of tires on 7 different vehicles running on a single test. I have it
to the point(printing anyway, sending it to PDF is turning out to be an
entirely different animal in this matter) of being able to print the tire
reports for all seven sets, just by entering the main code that links them
all together. As I said, getting them to PDF this way is turning out to be
an animal, as it appears I need to use the reportlistener and also FRX2ANY's
report listener, and I have no idea what I'm doing there(very little idea
anywhere else!*g*)

IF I can get the report listener stuff working, and then I can also add in
the graphs printing through VFP, then someone who just knows the main code
number that connects an entire test together, can actually run the final
report. Enter a few numbers, click a few buttons(at most) and voila, it's
done, all in PDF, ready to send. If I have to do it through Excel and VFP,
then use Acrobat to combine them, then someone has to be trained how to do
all of that.

> You skipped over the "Which tool should I use?" question and went right
> for
> "How do I use this hammer?" when you might actually need a screwdriver.
> <g>
>

That could be, but I dunno, for this project, I think I DO need a hammer. ;)



> Dan
>
>



Marat Chariev

2006-05-23, 7:13 pm

Well, since you use FRX2Any you can consider FRX2Any Chart Engine as a tool
to build charts

FRX2Any - where thinking is done for you
www.frx2any.com



"43fan" <sleap13@adelphia.net> wrote in message
news:camdnXCKq_5-xO7ZRVn-tA@hereintown.net...
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:%23fCnYXpfGHA.2032@TK2MSFTNGP02.phx.gbl...
report.[color=darkred]
>
> I do that now... I print everything I can in VFP, directly to PDF using
> FRX2ANY. Then I create the graphs I need in Excel, and then append them
> into the previously created PDF. Thing is, I want it all automated at

some
> point, no putting the manual together manually. We may have as many as

say
> 7 sets of tires on 7 different vehicles running on a single test. I have

it
> to the point(printing anyway, sending it to PDF is turning out to be an
> entirely different animal in this matter) of being able to print the tire
> reports for all seven sets, just by entering the main code that links them
> all together. As I said, getting them to PDF this way is turning out to

be
> an animal, as it appears I need to use the reportlistener and also

FRX2ANY's
> report listener, and I have no idea what I'm doing there(very little idea
> anywhere else!*g*)
>
> IF I can get the report listener stuff working, and then I can also add in
> the graphs printing through VFP, then someone who just knows the main code
> number that connects an entire test together, can actually run the final
> report. Enter a few numbers, click a few buttons(at most) and voila, it's
> done, all in PDF, ready to send. If I have to do it through Excel and

VFP,
> then use Acrobat to combine them, then someone has to be trained how to do
> all of that.
>
> That could be, but I dunno, for this project, I think I DO need a hammer.

;)
>
>
>
>
>



Dan Freeman

2006-05-23, 7:13 pm

All of this can be automated. (The technique is called, oddly enough,
automation. <g> )

To automate your work with Excel...

oXL = Createobject("Excel.application")
oXL.Sheets.Add()
oXL.Visible = .t.

etc.

If you're actually using Acrobat, I'm not 100% sure but I'm fairly sure it's
a capable automation server. And if you're not using Acrobat, there are a
plethora of PDF tools on the market. We use the Amyuni suite, particularly
for appending multiple PDF's together.

None of this entire process should be manual.

Dan


43fan wrote:[color=darkred]
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:%23fCnYXpfGHA.2032@TK2MSFTNGP02.phx.gbl...
>
> I do that now... I print everything I can in VFP, directly to PDF
> using FRX2ANY. Then I create the graphs I need in Excel, and then
> append them into the previously created PDF. Thing is, I want it all
> automated at some point, no putting the manual together manually. We
> may have as many as say 7 sets of tires on 7 different vehicles
> running on a single test. I have it to the point(printing anyway,
> sending it to PDF is turning out to be an entirely different animal
> in this matter) of being able to print the tire reports for all seven
> sets, just by entering the main code that links them all together.
> As I said, getting them to PDF this way is turning out to be an
> animal, as it appears I need to use the reportlistener and also
> FRX2ANY's report listener, and I have no idea what I'm doing
> there(very little idea anywhere else!*g*)
>
> IF I can get the report listener stuff working, and then I can also
> add in the graphs printing through VFP, then someone who just knows
> the main code number that connects an entire test together, can
> actually run the final report. Enter a few numbers, click a few
> buttons(at most) and voila, it's done, all in PDF, ready to send.
> If I have to do it through Excel and VFP, then use Acrobat to combine
> them, then someone has to be trained how to do all of that.
>
> That could be, but I dunno, for this project, I think I DO need a
> hammer. ;)
>
>
>


Paul Lee

2006-05-26, 7:11 pm

"43fan" <sleap13@adelphia.net> wrote in
news:PPydnQ1lj9bzl-7ZRVn-tQ@hereintown.net:
> Right now, I'm using FP
> to generate a text file, that then is used by Excel to actually create
> the graphs I need. I'd really like to be able to generate them
> completely in VFP.
>


If your graphing needs are not too complex there is a graphing
routine available at our website (Abrichart) that is easy to
use and generates a graph file that can be easily inserted into
your report for printing.

-----------------------------------------------------------------
Paul Lee ........ Abri Technologies ........ http://www.abri.com/
'Recover' - top rated FoxPro file repair utility.
-----------------------------------------------------------------
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com