Navigation:  Programmer's Reference >

Executing DPlot commands from another application

Print this Topic Previous pageReturn to chapter overviewNext page
Expand All   Collapse All

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. The DPLOTLIB DLL (not included with the DPlot distribution, available free-of-charge from the DPlot web site) hides the complexities of DDE and provides a simple interface for sending command strings to DPlot from a variety of programming environments.

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

About

Activate

AddCurves

AppHide

AppMaximize

AppMinimize

AppRestore

AppShow

AutoScale

AutoSize

AverageAll

AverageAndReplace

Axes_At_Zero

AxisColor

AxisType

B

BarChartStyle

BarWidth

BaselineShift

BkColor

BkPlotColor

Bubbles

C

Caption

ClearEditFlag

ClipY

Color

ColorBasis

ColorCycle

ColumnsAre

CombineCurves

Compare

Contour3D

ContourAxes

ContourColorScheme

ContourCustomColors

ContourCustomLevels

ContourDrawSides

ContourGrid

ContourLabelLines

ContourLegend

ContourLegendFrequency

ContourLevels

ContourLighting

ContourMethod

ContourScales

ContourView

CopyPicture

CopyText

CurveFit

CurveLabel

D

DataProcess

DataProcessLabels

DateFormat

DecimalDigits

DeleteLabel

DeleteRefLine

DeleteThinTriangles

DenseGridLines

Differentiate

Directory

DivideCurves

DocHide

DocMaximize

DocMinimize

DocRestore

DocShow

E

EditAddToX

EditAddToY

EditDecimate

EditEqualInts

EditErase

EditEraseData

EditFilter

EditMultiplyX

EditMultiplyY

EditOperateX

EditOperateY

EditOperateZ

EditRemoveTrend

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

G

GeneralOptions

GenerateMesh

GetPreferences

GrainSizeFlags

GrainSizeFlagsEx

GrainSizeOther

GridLines

GridLineType

GridLinesOnTop

H

HelpContents

HelpSearch

HideCurve

Histogram

I

IndependentTicks

InfoInterpolate

InfoScan

InsertLink

InsertXY

Integrate

InvertAxis

L

LabelDirection

Legend

LegendParams

LegendShow

LineType

LineWidth

LogTicks

Lump

M

ManualScale

Medians

MenuHide

MenuShow

MenuUpdates

MoveCurves

MultipleXAxes

MultipleYAxes

MultiplyCurves

N

NoteButtonText

NoteOptions

NotePosition

NoteTabstops

NoteText

NumberFormat

NumTicks

P

Paste

PasteLink

PolarPlotStyle

PostponeRedraw

Preserve3DScaleFactor

ProbabilityFlags

R

Refline

RemoveLink

ReorderCurves
Repaint

RunPlugin

S

SavePreferences

SaveUndo

Scale

ScatterPlotLines

SelectCurve

SetBitmapDims

SetClientRect

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 character string arguments. The following example will always cause a syntax error in Visual Basic:

Control.LinkExecute "[FileOpen("myfile.grf")]"

Instead, use:

Control.LinkExecute "[FileOpen(""myfile.grf"")]"

3) 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. 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.

4) 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.

5) 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.

 

 


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