VF_xyAutoPlotVD_xyAutoPlotVE_xyAutoPlot
VI_xyAutoPlotVBI_xyAutoPlotVSI_xyAutoPlot
VLI_xyAutoPlotVQI_xyAutoPlot
VU_xyAutoPlotVUB_xyAutoPlotVUS_xyAutoPlot
VUL_xyAutoPlotVUI_xyAutoPlot
FunctionDraws a Cartesian coordinate system and plots a Y-vector against an X-vector into it.
Syntax C/C++#include <Vgraph.h>
void VF_xyAutoPlot( fVector X, fVector Y, ui size, unsigned form, COLORREF color );
C++ VecObj#include <OptiVec.h>
void vector<T>::xyAutoPlot( const vector<T>& X, unsigned form, COLORREF color );
Pascal/Delphiuses Vgraph;
procedure VF_xyAutoPlot( X, Y:fVector; size:UIntSize; form:UInt; color:COLORREF );
DescriptionA Cartesian coordinate system is drawn with automatic scaling of the axes and the vector Y is plotted against the vector X. Prior to calling VF_xyAutoPlot, the plotting routines have to be initialized by V_initGraph (for DOS programs) or V_initPlot (DOS or Windows programs).
The VecObj version of this function has to be called as a member function of Y (rather than of X).

The font of the axis tick labels is the actual text font. In DOS programs (Borland C++ or Pascal), it may be changed by calling settextstyle before calling VF_xyAutoPlot. In Windows programs (both 16-bit and 32-bit), the font of the current device context is used.

The style of the plot is determined by the parameter "form" which should be constructed using the symbolic constants defined in <Vgraph.h> (C/C++) or in the unit Vgraph (Pascal/Delphi).
For the line styles, either Borland's BGI notation or the Windows notation may be used both in DOS and Windows programs; the necessary macros for the translation are included in <Vgraph.h> and in the unit Vgraph.

1. Style of lines connecting adjacent data points:
 
Windows styleBGI C/C++BGI Pascalappearance
PS_SOLIDSOLID_LINESolidLn–––– (default)
PS_DOTDOTTED_LINEDottedLn·········
PS_DASHDASHED_LINEDashedLn- - - -
PS_DASHDOTCENTER_LINECenterLn- · - · -
PS_DASHDOTDOT  - · · - · ·
PS_NULLNULL_LINENullLn(no line at all)

2. Symbols used to mark data points:
 
SY_NULL(no symbol at all)   (default)
SY_CROSS x
SY_PLUS+
SY_STAR*
SY_CIRCLEo
SY_BOX
SY_DIAMOND à
SY_TRIANGLEUP D
SY_TRIANGLEDOWN Ñ

3. Fill-style of the symbols:
 
SY_HOLLOWno filling  (default)
SY_FILLEDfilled
SY_DOTTEDhollow, with a dot at the exact position of the data point

The parameter form has to be constructed by adding the appropriate line style, the symbol and its fill-style, e.g. (SOLID_LINE + SY_TRIANGLEUP). Alternatively, the bit-wise "OR" operation may be used, e.g. (PS_SOLID | SY_CIRCLE | SY_DOTTED ).
In Pascal terms, these examples read:
(SolidLn + SY_TRIANGLEUP), and (PS_SOLID or SY_CIRCLE or SY_DOTTED).

If any of the line styles except NULL_LINE (or PS_NULL) is chosen, each data point will be represented by at least one pixel in DOS programs. Therefore, dotted or broken lines should be specified only if there are not too many data points. Otherwise, all line styles will eventually look like SOLID_LINE. In Windows programs, these line styles will always be plotted correctly and points will be left out if necessary.

Note that NULL_LINE or PS_NULL has to be explicitly specified, if the data points are not to be connected by lines. Just writing, e.g. (SY_BOX | SY_HOLLOW) would be interpreted as using the default line style, which is SOLID_LINE.

SY_NULL and SY_HOLLOW need not be specified, since these are the default symbol and fill-style, resp. For SY_NULL, SY_CROSS, SY_PLUS, and SY_STAR, the choice of fill-style has no effect.

The parameter "color" denotes the color that is to be used for the plot (the data type COLORREF is unsigned for DOS programs and unsigned long for Windows programs). See the Borland C++ or TurboPascal function setcolor for a description of the colors available in the various graphics modes under DOS. For Windows, the colors BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, and WHITE are defined in <Vgraph.h> (or the unit Vgraph) by analogy with the COLORS defined in <graphics.h> (or the unit Graph) for the BGI routines, i.e. for DOS programs. Thereby, portability between DOS and Windows programs is improved. For programs designed to run exclusively under Windows, it is nevertheless recommended to use fine-tuned colors defined by the RGB macro, instead of the predefined colors.

The size of the symbols may be modified with the function V_setSymbolSize. The thickness of the lines may be modified using V_setLineThickness.

Example of a C/C++ DOS program #include <VFstd.h>
#include <VFmath.h>
#include <Vgraph.h>
#include <conio.h>
void main( void )
{
     ui size=101;
     fVector X, Y1, Y2;
     V_initGraph( "C:\\BorlandC\\BGI\\" );
            /* Be sure the path is correct! */
     X = VF_vector( size );
     Y1 = VF_vector( size );
     Y2 = VF_vector( size );
     VF_ramp( X, size, -1.0, 2.0/100 );
     VFx_sincos( Y1, Y2, X, size, 3.1415927, 0.0, 1.0 );
     VF_xyAutoPlot( X, Y1, size,
                    PS_SOLID | SY_CROSS,
                    LIGHTGREEN );
     VF_xyDataPlot( X, Y2, size,
                    PS_SOLID | SY_CIRCLE | SY_DOTTED,
                    LIGHTRED );
     getch(); /* interrupt execution while watching;
                      then press any key */
     closegraph();
     V_nfree( 3, Y2, Y1, X );
}

For a Pascal demo program, see VDEMO.PAS.
Under Windows, call V_initPlot instead of V_initGraph, before performing plotting operations.

Error handlingnone
Return valuenone
See alsoVF_xyDataPlot,   VF_yAutoPlot,   VCF_autoPlot,   V_drawAxes,   V_findAxes,   V_setSymbolSize,  chapter 4.12

VectorLib Table of Contents  OptiVec home