Navigation:  Programmer's Reference >

Sending data to DPlot from another application

Print this Topic Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Items

Beyond Copy/Paste and writing/reading files, there are 3 methods available for sending data to DPlot via dynamic-data exchange (DDE):

1.The DPLOTLIB DLL hides the complexities of DDE and provides a simple interface for sending command strings to DPlot from a variety of programming environments. Source examples for Microsoft C, C#, Borland C++, LCC-WIN32, GNU C (gcc), Microsoft Visual Basic, Visual Basic .NET, PowerBasic, FreeBASIC, Absoft FORTRAN, Compaq Visual FORTRAN, GNU FORTRAN, Salford FORTRAN, WATCOM FORTRAN, and Delphi are included in the DLL distribution. The DLL, example programs, and source for the examples may be found in or below  the \DPLOTLIB folder of the destination folder for DPlot.

 

2.For Excel users only, the optional DPlot Add-In will handle most of your needs. For everyday users it is as simple as selecting the data you want to plot, then selecting the appropriate Add-In command. For VBA programmers you can make use of Add-In commands to quickly produce a plot and then manipulate other plot parameters: line weight/style, symbol height/weight, colors, etc. See the VBA programming section of "Using the DPlot Interface Add-In for Microsoft Excel" for more information.
3.You can send a command or series of commands to DPlot from another application through a dynamic-data exchange (DDE) conversation, or "channel."  For commercial applications, you should refer to the documentation for the application to determine the method for initiating a conversation with DPlot and executing commands for another application.

This method is not recommended unless you are very comfortable with DDE and you need more control over DPlot than DPLOTLIB.DLL provides. (In the latter case, contact us to let us know exactly what you are trying to do. It is likely that there is already a better way.)

Following is a brief demonstration of how to send a command to DPlot from three different environments.

 

Visual Basic 3.0

Control.LinkMode = 0

Control.LinkTopic = "DPlot|System"

Control.LinkMode = 2

Control.LinkExecute "[FileNew()]"

Control.LinkMode = 0

where Control is any label, picture box, or text box.

 

Microsoft Excel 4 macro

Channel        

=INITIATE("DPlot","System")


=EXECUTE(Channel,"[FileNew()]")


=TERMINATE(Channel)

 

Microsoft Office products Visual Basic

Channel = DDEInitiate("DPlot", "System")

DDEExecute Channel, "[FileNew()]"

DDETerminate Channel

 

Following is a list of the commands supported by DPlot. All commands must be enclosed by square brackets. There should be no spaces in the command string, other than those embedded in character string arguments or used to delineate numeric parameters. Character arguments are always enclosed by double-quotation marks. Command names are not case-sensitive.

 

A

AAxisLabel

About

Activate

AddCurves

AppHide

AppMaximize

AppMinimize

AppRestore

AppShow

AutoScale

AutoSize

AverageAll

AverageAndReplace

Axes_At_Zero

AxisArrowheads

AxisColor

AxisType

B

BarChartStyle

BarWidth

BaselineShift

BkColor

BkPlotColor

Bubbles

C

Caption

ClearEditFlag

ClipY

Color

ColorBasis

ColorCycle

ColumnsAre

CombineCurves

Compare

Contour3D

ContourAxes

ContourBarWidth

ContourColorScheme

ContourCustomColors

ContourCustomLevels

ContourDrawSides

ContourGrid

ContourLabelLines

ContourLegend

ContourLegendFrequency

ContourLevels

ContourLighting

ContourMethod

ContourResetExtents

ContourScales

ContourView

ContourViewChange

CopyPicture

CopyText

CurveFit

CurveLabel

D

DataProcess

DataProcessLabels

DateFormat

DecimalDigits

DeferMinMaxCheck

DeleteImage

DeleteLabel

DeleteNote

DeleteRefLine

DeleteThinTriangles

DenseGridLines

Differentiate

Directory

DivideCurves

DocHide

DocMaximize

DocMinimize

DocRestore

DocShow

E

EditAddToX

EditAddToY

EditDecimate

EditEqualInts

EditErase

EditEraseData

EditFilter

EditMultiplyX

EditMultiplyY

EditNormalize

EditOperateX

EditOperateY

EditOperateZ

EditRemoveSpikes

EditRemoveTrend

EditReplaceData

EditSmooth

EditSort

EditSubtractMean

EditSwapXY

EditTruncate

Enable

ErrorBar

ErrorBarPenWidth

ErrorBarWidth

ErrorMessages

F

FFT

FFTMethod

FFTPhase

FileAppend

FileArrays

FileClose

FileExit

FileNew

FileNewEx

FileOpen

FilePageSetup

FilePrint

FilePrintMultiple

FileSaveAs

FileType

FillBetween

FillStyle

FindIntersections

FontPoints

FunctionOfXY1Y2

FXY1Y2_XFrom

G

GeneralOptions

GenerateMesh

GetPreferences

GrainSizeFlags

GrainSizeFlagsEx

GrainSizeOther

GridLines

GridLineType

GridLinesOnTop

H

HelpContents

HelpSearch

HideCurve

Histogram

I

IndependentTicks

InfoInterpolate

InfoScan

InsertImage

InsertLink

InsertXY

Integrate

InvertAxis

L

LabelDirection

Legend

LegendParams

LegendShow

LineType

LineWidth

ListPeaksOptions

LogTicks

Lump

M

ManualScale

Medians

MenuHide

MenuShow

MenuUpdates

MoveCurves

MultipleXAxes

MultipleYAxes

MultiplyCurves

N

NoteButtonText

NoteOptions

NotePosition

NoteTabstops

NoteText

NSEW

NumberFormat

NumTicks

O

OverlayDocument

P

Paste

PasteLink

PolarPlotStyle

PostponeRedraw

Preserve3DScaleFactor

ProbabilityFlags

R

Refline

RemoveLink

Request
ReorderCurves
Repaint

RunPlugin

S

SavePreferences

SaveUndo

Scale

ScatterPlotLines

SelectCurve

SetBackgroundImage

SetBitmapDims

SetClientRect

SetDecimalSymbol

SetFilename

SetImageCrop

SetMetafileDims

SetOutputWindow

SetPanFraction

SetPluginImageDims

SetWindowPos

ShowCaption

ShowCurve

ShowDate

Size

SplitDateTime

SquareLogCycles

StartStop

Stat_AddData

Stat_AddGroup

Stat_Box

Stat_BWOptions

Stat_DotOptions

Stat_DrawLegend

Stat_GrandMean

Stat_GroupInfo

Stat_LimitsAsCL

Stat_MeanFormat

Stat_Outliers

Stat_PlotType

Stat_RefLine

Stat_Rotated

Stat_Scaling

Stat_Whiskers

SubtractCurves

SwitchX

SymbolClip

SymbolCycleColors

SymbolFillBackground

SymbolFrequency

SymbolOpacity

SymbolOutline

SymbolOutlineColor

SymbolSize

SymbolSizeUnits

SymbolType

T

TextFont

TextNote

TextNote3D

TextNoteEx

TextNoteLeader

TextPointLabel

TextPointLabel3D

TextPointLabelLeader

TickInterval

TickMarks

TimeFormat

Title1

Title2

Title3

Title4

TriangleFlags

TripartiteFlags

U

UseNameAsLegend

V

VectorPlot

VectorPlotOptions

ViewRedraw

ViewStatusBar

ViewToolBar

W

WindowCascade

WindowTile

X

XAxisLabel

X2AxisLabel

XLabel

XY

XYLabel

XYXY

XYZ

XYZ_to_XY

XYZEx

XYZRegen

Y

Y2AxisLabel

Y2TopDown

YAxisHorizontal

YAxisLabel

YCutoff

Z

ZAxisLabel

 

Commands may be issued in sequence or appended to each other. For example, the following command string opens and prints a DPlot file entitled "TEST.GRF" before causing DPlot to close:

[FileOpen("TEST.GRF")][FilePrint()][FileExit()]

Notes

1) Each DDE conversation has an association with a DPlot document. This association is established when the conversation is initiated, and may be changed by an Activate, FileOpen, or FileNew command.  If, for whatever reason, either DPlot or the client application terminates the conversation and the client then establishes a new conversation, this association no longer holds. The client application should re-establish the association with a document with the Activate command, else any commands sent to DPlot may not operate on the intended document.

2) Character string arguments are always enclosed by double quotation marks. In some environments (Visual Basic, for example), double quotation marks are also used to delineate all character strings (including the command itself). The following example will always cause a syntax error in Visual Basic:

ret = DPlot_Command(docnum,"[FileOpen("myfile.grf")]")

Instead, use:

ret = DPlot_Command(docnum,"[FileOpen(""myfile.grf"")]")

in C, C++, C# you'd accomplish the same thing with:

ret = DPlot_Command(docnum,"[FileOpen(\"myfile.grf\")]");

3) You can use equations for numbers in the argument list to many commands. Equations must be prefaced by an equals sign (=). For example,

TickInterval(1,=10.^(FLOOR(LOG10($XRANGE)-1)))

sets the tick mark interval on the X axis to an integer power of 10 such that there will be at least 10 intervals but less than 100. For more information see the list of available functions and the text placeholders topics.

4) For real-time applications, it is strongly suggested that the client application use the ManualScale command to force the plot coordinates to the desired value. Otherwise, DPlot will continually adjust the plot coordinates to fit the incoming data. If the ManualScale command is issued DPlot keeps the extents of the X axis constant, shifting the plot window to the right when necessary. (If you do not want this shift to take place, use [SetPanFraction(0)].) For real-time applications that display a graph in their own window (rather than a DPlot document window), you will have much better performance using the SetOutputWindow command rather than retrieving a bitmap or metafile from DPlot after every graph update. For best performance turn off antialiasing with [GeneralOptions(32,0)].

5) For linear X, linear Y scales, DPlot draws individual line segments rather than redrawing the entire plot every time a new data point is added with the XY command. DPlot will only redraw the plot if the incoming data point lies outside the current plot extents. Although this optimization results in significantly faster plotting, there are several drawbacks: a) Since points are added one at a time rather than drawing a series of line segments, the pattern for a line style starts over at each point. Rather than using the slower line drawing routines that use a pattern (and would be incorrect anyway), DPlot uses the faster Windows API routines MoveTo and LineTo with solid lines. b) DPlot does not create and load the color palette selected by the user. Instead, the colors used to draw the line segments are the closest match of the system colors to the desired colors. Both of these limitations apply only to line segments that are drawn individually. Once the entire plot is redrawn, the lines will be drawn correctly.

6) DPlot returns one of 3 values in response to any command. The return codes sent to the DDEML (Dynamic Data Exchange Management Library) are DDE_FACK (=0x8000), DDE_FBUSY (=0x4000), and DDE_FNOTPROCESSED (=0). The various development environments respond to these return codes in different manners, usually by displaying a MessageBox in the case of DDE_FBUSY or DDE_FNOTPROCESSED. DDE_FACK indicates success. DDE_FBUSY indicates that DPlot is currently disabled (possibly because a MessageBox or other modal dialog box is displayed). DDE_FNOTPROCESSED indicates that the command was not valid or was unsuccessful for some other reason (exceeding the array sizes, for example). Note that DPlot does not cache incoming commands if it is currently busy... it is up to the client application to re-send the commands later, if necessary. Real-time client applications should not rely on DPlot to save incoming data values.

For optimum performance with real-time applications

1)If a graph is being rendered in DPlot (the default) rather than the calling application, prevent the user from selecting a menu command during real-time processing by using the Enable command, and turn off menu updating with a MenuUpdates command.
2)Use the ManualScale command.
3)Set all line widths to 0 with the LineWidth command for older processors.
4)Set all line styles to solid (type = 1) with the LineType command.
5)If rendering a graph in a window owned by the calling application, use SetOutputWindow.
6)Turn off antialiasing with [GeneralOptions(32,0)].

 

 


Page url: https://www.dplot.com/help/index.htm?helpid_prog_xtyp_execute.htm