                                  VGRAPH 

            The Vertical Graphing System for Color VGA monitors
                          (FoxPro 2.5 for DOS)

                          written by Barry Glick

             with thanks to Peter Olympia and Kathy Cea for formulating 
                          the idea in their book

                   "Developing FoxPro 2.0 Applications".


        Background

I have a client who needed to see the results of advertising campaigns 
using a whole bunch of different criteria including date, time and area 
ranges.  These were measured by mail responses and were stored in a 
FP2.0 DBF file.  This application is the result of many hours effort and 
has been tailored for the VGA colour screen. It probably also works on 
Super VGA but I have not been able to test it.


        Fundamentals

The current version of the application is only interested in three things:

      Value data
      Legend data
      Graph title

which are passed as arrays and a character string.

In this beta version the product is limited to positive numbers in the range 
of 0 to 9,999,999 and will support real as well as integer numbers. 

If a legend array is passed it should match the values array in that there 
should be a legend for each value being passed. If no legend array is passed 
then VGRAPH will attempt to form a x-axis legend using the values array.

If no title is passed then the default "VGRAPH - Vertical Graph Package 
(1992)" becomes the graph title.


                          What do you need to run the system

        The Files     

There are four files packaged in this Zip:

       VGRAPH.APP     - the graphing program
       T_VGRAPH.PRG   - demo / test program
       VGRAPH.TXT     - this document in text format

Simply copy the VGRAPH files into a subdirectory. Load FP2.5 and 
SET DEFAULT TO the subdirectory.

To have a quick look, "RUN" the T_VGRAPH program. This will generate three 
fixed graphs showing some of the features which are built into VGRAPH.

T_VGRAPH can also be used as the skeleton for you to try your own data.  
After the first three graphs have been displayed a randomly generated graph 
is shown.  See the sections on "Limitations" for more information about what 
is and isn't included.

Don't forget :    VGRAPH waits until a key is pressed before returning to the 
call program.

Limitations of this version of VGRAPH. As with all beta products there are 
some areas which either haven't been addressed or I did not think of at the 
time.

        Screen width     

VGRAPH only allows for up to 70 bars of data and will reject data arrays with 
more elements.

        Fixed Colours     

VGRAPH does not allow passing of bar,  axes,  title and legend colours. This 
means for the moment you are limited to :

                Title :         Red on Black
                Legend:         Yellow on Black
                Axes:           Green on Black

Bars are all preselected colours and will repeat after 12 bars.  The sequence 
is :

     Blue          Light Magenta     Cyan 
     Yellow        White             Light Red
     Brown         Light Blue        Magenta
     Light Cyan    Bright White      Red

If you wish, you can override this with a fourth parameter which is the single
color for all bars. eg "GR+"                            - Mod 16th July 1993

        Values     

VGRAPH can only handle positive numbers in the range of 0 to 9,999,999 
(both integer and real).  Even though VGRAPH does its best to provide scaling 
accuracy,  it can only offer a view of the data down to half y-axis tick 
level.  In other words when the scale of the y-axis is in tens the graphs 
are to the nearest 5 and when the scale is in thousands then the graphs are 
to the nearest five hundred.

        Legends     

These are automatically used by VGRAPH to work out whether they need be 
vertical or horizontal. If you run the test program (T_VGRAPH) you can see 
that this will switch if some legends are longer than the width of the bar.

        Bar Width     

This is automatically determined by VGRAPH and will affect which way legends 
appear. The number of elements being passed to VGRAPH will vary the thickness 
of the bars and in turn,  the available space for legends.


                             The future of VGRAPH

        Actual values     

I have already been asked to show the actual numbers being represented by the 
bars as with scaling it is not always possible to estimate the actual number 
being represented.  Of course this will mean that the number of bars being 
shown may be limited depending upon the width of the numbers being shown.  
I may make that an option rather than the default.  It can already be done if 
you also pass the values in the legend array and in fact is the default when 
no legend array is passed.  I hope to add them to the top of the bar.

        Colours     

I will probably allow the bar colours to be passed in a third array and have 
color options for legends, title etc.  This could be available quickly if 
requested.

        Negative Numbers     

This may come if enough people request it.

        Min-Max Value y-axis     

One of the obvious limitations is the graphing of a large variation of numbers 
i.e from say 100,000 to 235,000 where there is no need to show from a bottom 
of zero.  Currently the program always uses a zero origin but if there are 
enough requests I will allow an option of Min value origin.

        Special Bar highlighting     
        
It would also be possible to allow a special Bar highlight feature where a 
specific bar is displayed using a different character to the others.

        Printing     
        
Printing out these graphs would be desirable but in the meantime you can play 
"what if" style viewing with the results and VGRAPH.


        Error Messages

There are a number of errors that VGRAPH will return "False" on:

"The legend array does not contain the same number of elements as values"

"Only able to show up to 70 bars on the screen with VGraph"

"Unable to plot non-numeric data - in element (n)"

"Not ready for negative numbers or all zero graphs"

"This only works for numbers up to 9.9 million - so far"

I think these give enough information to correct the problem but I wait to be 
corrected.


                                Your say

There are probably many other ways to enhance this product and this is where 
you are the client.  Part of this release is not just the free use of the 
product as it now stands but also the ability to have it changed to suit 
yourself (or your clients).  I do not (at this point) ask for any remuneration 
but I do ask for your advice.  Tell me what you,  want through 
Compuserve 100036,155 where I usually hang out a few times a week or 
alternatively in Sydney, Australia (02)- 2164536.

Good Luck - Barry Glick

                                               m:\wpdocs\bss_work\vgraph.txt
