DPLOTLIB Data Types

DPlot_Plot, DPlot_PlotBitmap, DPlot_PlotToRect, and DPlot_AddData each pass arrays of single-precision floating point numbers to DPlot. In C and C#, these are arrays of type float, in Visual Basic jargon they are Single, and in FORTRAN they are REAL*4. Double precision (C double, VB Double, FORTRAN REAL*8) versions of these functions are identical other than the arrays and an "8" suffix for the function name: DPlot_Plot8, DPlot_PlotBitmap8, DPlot_PlotToRect8, and DPlot_AddData8. DPlot stores data in double-precision arrays, so the precision of data passed to DPlot using these functions will be preserved.

For most applications single precision is sufficient. A notable exception is passing date and time values in Excel's serial format: the resolution of the date May 20, 2004 (38127 in Excel serial format - see below) is about 3.3 minutes. In other words 12 noon on that date is indistinguishable from 3 minutes past noon if the date and time are represented with single precision. The resolution for the same date using double precision is about 0.37 microseconds.

DPLOTLIB Arguments
This documentation describes the argument lists of the DPLOTLIB functions using C syntax and data types. The equivalent data types in other languages are shown below.
 
* prefixIndicates that the address of the argument, rather than the argument itself, is passed to the function. This is the default in FORTRAN. In Visual Basic this is equivalent to passing an argument ByRef. In C# this is equivalent to a ref prefix.
int4-byte signed integer. INTEGER*4 in FORTRAN, Long in Visual Basic.
float4-byte single-precision floating point number. REAL*4 in FORTRAN, Single in Visual Basic.
double8-byte double-precision floating point number. REAL*8 in FORTRAN, Double in Visual Basic.
DWORD4-byte unsigned integer. FORTRAN and Visual Basic do not have an exact equivalent, use INTEGER*4 and Long, respectively.
HWNDHandle to a window, 4-byte integer. Use INTEGER*4 in FORTRAN, Long in Visual Basic, IntPtr in VB.NET and C#.
HBITMAPHandle to a bitmap, 4-byte integer. Use INTEGER*4 in FORTRAN, Long in Visual Basic, IntPtr in VB.NET and C#.
HENHMETAFILEHandle to an enhanced metafile, 4-byte integer. Use INTEGER*4 in FORTRAN, Long in Visual Basic, IntPtr in VB.NET and C#.
LPSTRPointer to a null-terminated string of 8-bit Windows (ANSI) characters. CHARACTER in FORTRAN, String in Visual Basic. For FORTRAN, you must take special care to terminate character string arguments with a null character (ASCII 0) and pass the string by value rather than by reference. The latter is handled automatically in the interface code for all currently supported FORTRANs. Since this is not a part of the FORTRAN standard, the mechanism for passing strings by value will vary from compiler to compiler; consult your compiler documentation. Also be aware that all character strings returned by DPLOTLIB functions will be null-terminated. In Visual Basic, a null character is automatically appended to strings passed ByVal.
DPLOTA 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.

Excel 1900 Date System Serial Numbers
Although DPlot will display numbers along the axes using calendar dates and/or time of day, internally the data is always represented as double precision floating point numbers. Dates and date-and-time groups in DPlot use the same mechanism for storing this data as is used by Microsoft Excel: Excel's 1900 Date System. If your application passes dates to DPlot using DPlot_Plot or similar function, those dates must be represented using this format. The following code will convert a calendar date to an Excel serial number (day and month are 1-based; January=1, December=12):

if( Month > 2 )
    serial=(int)(365.25*year)+(int)(30.6001*(month+1))+day-694037;
else
    serial=(int)(365.25*(year-1))+(int)(30.6001*(month+13))+day-694037;

Time of day may be added to a serial number date simply by adding the time as a fractional part of the day. 0=midnight, 0.5=noon, etc.

 

 
Previous Home Next DPlot Home