Syntax:
|
event OnPlotClick(Document, X, Y): HResult
|
PlotClick event allows to do something when user clicks a
given plot object. For example, in the
Plot Calculator Tool some
function of plot coordinates (passed as parameters) is calculated.
In the example below, we use coordinates of the clicked point just
to add a new item into the Container
and display new point (notice that current series must be not empty):
Example:
sub Server_OnPlotClick(Document, X, Y)
Document.Container.AddItem(Array(X, Y))
Document.Worksheet.Refresh
Document.Plot.CurrentSerie.AddPoint
end sub
Syntax:
|
event OnPlotPointClick(Document, Point, Serie, Result): HResult
|
Use this event if you want to do something when
user clicks plot point (that is, mouse coordinates
are inside some point). Notice that you can change
default behavior of plot eraser and editor modes if you
return false in this handler as shown in the example
below (in case of several event handlers, their results are
logically multiplied: Result1 and Result2 and ...)
Example:
function Server_OnPlotPointClick(Doc, Point, Serie)
Server_OnPlotPointClick=not ((Doc is TempWnd) and (Serie<>1))
end function
Please note that the result returned to DM2003 core processed
in some unclear and awkward manner due to limitations of JavaScript
language (which does not allow ByRef parameters). There may be a
lot of event handlers defined in various clients. All these handlers
divided into following groups:
Every group (except minibrowser) may contain arbitrary number of
event handlers. These groups invoked in the abovementioned order, and
if some group return false, subsequent groups are just not called!
So if your out-of-process automation client does not define this event
handler,
Scroller and
Point Editor tools will not work.
Inside first two groups, every attached handler is called (keep
in mind that COM object may have several client references), and the
results are logically summed (OR operator). This is because .Net clients
are connected to the event sink for every event handler (delegate object),
so the event called many times in the client and the most of calls return
false (since there is no handler defined for this connection).
Syntax:
|
event OnPlotGetPoint(Document, Point, Serie, X, Y, Result): HResult
|
OnPlotGetPoint event allows you to display points whose coordinates
calculated by your code. This is in contrast to usual mode, when plot
point coordinates are stored in containers
and possibly transformed by DM2003 application using axes and series
expressions and embedded expression parser.
To enable this feature for particular series, set IDMSerie3.EnableGetPointEvent property to True.
Notice that unlike OnPlotPointClick event, for which Point parameter is
a sequential index of the clicked point in the container (if any), for
OnPlotGetPoint event Point is a zero-based index! To find appropriate
data item for data-based series, you should calculate actual item index.
Also note that X,Y parameters are initialized by point coordinates.
Example:
Server.CreateDocument Server.InstallPath & "samples\data_1.dat"
Server.ExecuteCommand "ShowWorksheetAction"
Server.ExecuteCommand "SelectAllAction"
Server.ExecuteCommand "PlotLinesAction"
Server.ExecuteCommand "ShowPlotAction"
Server.ActiveDocument.Plot.CurrentSerie.EnableGetPointEvent=true
' Returns point coordinates
function Server_OnPlotGetPoint(Doc, Point, Serie, ByRef X, ByRef Y)
' enter your code here
Server_OnPlotGetPoint=true
if x<100 then y=0.5
end function