Navigation:  DPLOTLIB Functions >

DPlot_Plot function

Print this Topic Previous pageReturn to chapter overviewNext page

int DPlot_Plot(DPLOT *DPlot, float *array1, float *array2, LPSTR commands);

int DPlot_Plot8(DPLOT *DPlot, double *array1, double *array2, LPSTR commands);

Parameters

*DPlot

Address of a DPLOT structure. A DPLOT structure contains format information for the graph: number of curves, number of points in each curve, line and symbol styles used, etc. This structure is defined in the header/include file accompanying the various source examples.

*array1

Address of the X array for XY plots or a 4-element array used for the extents of a contour plot on a rectangular grid. Not used for 3D/4D contour plots of random points, 3D/4D scatter plots, or 1D plots.

*array2

Address of the Y array for XY plots,

 

Z array for contour plots on a rectangular grid,

 

X,Y,Z triplets (in the order x(0),y(0),z(0),x(1),y(1),z(1),... etc.) for contour plots of randomly-spaced points and 3D scatter plots.

 

X,Y,Z,amplitude values for 4D surface or scatter plots in the order in the order x(0),y(0),z(0),amp(0),x(1),y(1),z(1),amp(1)... etc.

 

For scatter plots with multiple data sets, the second data set immediately follows the first with no empty array entries.

 

Y (amplitude) array for box-and-whisker plots and dot graphs.

commands

Character string with zero or more DPlot commands. Valid commands and the syntax for those commands are described in the Executing DPlot Commands section of DPlot's Help file. This string is limited to 32768 characters and must be null-terminated.

 

Please note:

1.Commands that render a plot to a device other than the display or save a plot to a disk file (FilePrint, CopyPicture, FileSaveAs) should not be included in the call to DPlot_Plot. Instead, these commands should be sent to DPlot via a subsequent DPlot_Command call. For example, rather than:

 

DocNum=DPlot_Plot(DPlot,x,y,"[DocMaximize()][FilePrint()]");

 

use

 

DocNum=DPlot_Plot(DPlot,x,y,"[DocMaximize()]");

DPlot_Command(DocNum,"[FilePrint()]");

 

This ensures that the plot has been rendered before saving it.

2.The entire command string is just that: a character string. All numeric values must be passed as ASCII text. For example, this:

 

width=0.5

DPlot_Command(DocNum,"[BarWidth(width)]")

 

will only result in a syntax error, since your development environment will attempt to read a number from the character string "width". Instead, use something like (in VB):

 

DPlot_Command(DocNum,"[BarWidth(" & str$(width) & ")]"

in C:

char cmd[512];

sprintf(cmd,"[BarWidth(",%g,")]",width);

DPlot_Command(DocNum,cmd);

 

3.Floating point values should not be localized. A "." should be used as the decimal point; thousand separators should not be used.

Return Values

>0

Success. The return value in this case is the index of the document created by the call. This value will be between 1 and 32, inclusive. The document index may be used in subsequent calls to DPlot_Command and DPlot_Request.

 0

Generic error attempting to communicate with DPlot. This most often indicates that DPlot is currently busy, e.g. a modal dialog box is open, or that one or more commands in the commands parameter is invalid. (In the latter case, DPlot will show an "Error processing this command" MessageBox.

-1

Could not find/execute DPlot.

-2

Could not establish a DDE connection with DPlot. This error should never occur.

-3

Invalid DataFormat type specified in the DPLOT structure. If you've filled out the structure correctly and get this error, it is most likely an indication that the structure is not being passed correctly.

-4

Unsupported version number in the DPLOT structure. Valid values are currently 2 and 3.

 

 

 

 


Page url: http://www.dplot.com/lib/index.htm?dplot_plot.htm