{ Object:
TYPE;
Handle: TYPE = REF Object;
A plotter is an active object that pulls events from an
eventSource, incorporates them in a circular buffer of
events, and maintains a graph showing event values vs.
event times.
PointShape:
TYPE = {none, filledBox, emptyBox, filledDiamond,
emptyDiamond, dot, circle};
Connectivity: TYPE = {solid, dotted, dashed, dotDash, vertical};
Create:
PROC
[label: Rope.
ROPE,
eventSource: RealEvent.StreamHandle,
nEvents:
NAT,
the length of the circular buffer.
plotValueDifferences: BOOLEAN ← FALSE,
plotValuePerSecond: BOOLEAN ← FALSE,
autoRepaint:
BOOLEAN ←
FALSE,
TRUE => repaint whenever a new event occurs
iconic: BOOLEAN ← TRUE,
connectivity: Connectivity ← solid,
how to draw the connecting line between
adjacent data points
pointShape: PointShape ← none
how to depict data points
]
RETURNS[Handle];
This provides a "pull-style" plotter.
CoCreate:
PROC
[label: Rope.
ROPE,
nEvents: NAT,
plotValueDifferences: BOOLEAN ← FALSE,
plotValuePerSecond: BOOLEAN ← FALSE,
autoRepaint: BOOLEAN ← FALSE,
iconic: BOOLEAN ← TRUE,
connectivity: Connectivity ← solid,
pointShape: PointShape ← none
]
RETURNS[plotter: Handle, eventSink: RealEvent.StreamHandle];
This uses PORTs to provide a "push-style" alternative.
Paint: PROC[self: Handle];
Destroy: PROC[self: Handle];
CreatePlotViewer:
PROC
[label: Rope.
ROPE,
verticalAxis: RealVec.Handle,
horizontalAxis: RealVec.Handle ←
NIL,
default: RealVec.IndexVec[verticalAxis.length]
iconic: BOOLEAN ← TRUE,
connectivity: Connectivity ← solid,
pointShape: PointShape ← none
]
RETURNS[ViewerClasses.Viewer];
This low-level procedure is used by Create and CoCreate.
The two RealVec.Object's must have the same length.
CreatePlotViewer creates a graph of
verticalAxis[i] vs. horizontalAxis[i]
for i IN [0..verticalAxis.length)
Subsequent changes to the two RealVec.Object's will be
reflected in the graph when it is repainted
(via ViewerOps.PaintViewer). For the purpose of connecting
adjacent data points with lines, adjacency of values in
verticalAxis is determined by the sort order of
corresponding values in horizontalAxis.
}.