DADiSP Worksheet Functions > Function Categories > Annotation > LINEDRAW
Draws a polyline between specified coordinates.
|
win, color, style, target, match, focus, width, x1, y1, ..., xN, yN) |
win |
- |
Optional. The target window. Defaults to the current window. |
||||||||||
color |
- |
Optional. An integer or macro color name (e.g. RED) specifying the line color. Defaults to color of primary series. |
||||||||||
style |
- |
Optional. An integer specifying the line style:
|
||||||||||
target |
- |
Optional. An integer specifying the spatial relationship of the line to the Window:
|
||||||||||
match |
- |
Optional. An integer that sets the line color to match the color of the selected overplot. Defaults to 1 (primary series). 1 implies use color parameter. |
||||||||||
focus |
- |
Optional. An integer specifying 1-based focus offset for PAPER annotations. |
||||||||||
width |
- |
Optional. An integer specifying the line width in pixels. Defaults to 1. |
||||||||||
|
- |
Real number coordinates representing endpoints of each line segment. |
An integer object handle that can be used to set or adjust line properties.
gtri(100,.01,2);linedraw(purple,2,1,-1,0.09,0.04,0.9,0.5)
creates a purple dashed (2) line in "glass mode" (1). The color of the line is purple, and is unrelated to any overplots (match == -1); the line spans from coordinates (0.09, 0.04) to (0.9, 0.5).
Line annotations can be manipulated by setting the line properties of the returned object handle.
W1: gsin(100,.01)
h = linedraw(W1, 0.2, -0.5, 0.6, 1.0);
h.color = lred; h.width = 4;h.style = 2;
A line is placed in W1 at coordinates (0.2, -0.5), (0.6, 1.0) and the color is set to light red, the line width is set to 4 and the line style is dashed.
In general, LINEDRAW replaces the older LINEANN functions.
Line properties can be manipulated with the object handle. The following properties are available:
Name |
Type |
Description |
x |
real |
x coordinate |
y |
real |
y coordinate |
tag |
string |
object identifier |
xor |
integer |
xor background flag |
fill |
integer |
background color |
lock |
integer |
lock interactive movement |
type |
string |
type of object, "shape" |
color |
integer |
line color |
focus |
integer |
target overlay focus |
match |
integer |
overplot number to match color |
shape |
string |
readonly type of shape, "line" |
style |
integer |
line style |
width |
integer |
line width |
coords |
series |
line coordinates as a series |
handle |
integer |
line handle |
onmove |
string |
move callback function |
onsize |
string |
size callback function |
tagnum |
integer |
same as handle, line handle |
target |
integer |
line coordinate target, glass, paper, etc. |
winnum |
integer |
readonly window number of line target |
showtag |
integer |
show line string tag |
visible |
integer |
line visibility |
oncreate |
string |
creation callback function |
ondelete |
string |
deletion callback function |
onlclick |
string |
mouse left click callback function |
onmotion |
string |
motion callback function |
onrclick |
string |
mouse right click callback function |
onsizing |
string |
sizing callback function |
position |
series |
readonly bounding box coordinates of the line in window coordinates. Lower left X coordinate, Y coordinate, height and width |
devposition |
series |
readonly bounding box coordinates of the line in device coordinates |
Readonly properties can only be queried. All other properties can be set and queried using the handle.property dot syntax.
LINEDRAW can be used directly from the command line or as part of an SPL routine to draw lines in a Window that contains data. The result is identical to adding lines via the Drawing Toolbar and the lines can subsequently be manipulated with the mouse.
Use -2 to specify the default value for any integer parameter.
All polylines created with a single call to LINEDRAW (or LINECUR) are displayed in the same color. Specify the color explicitly for a polyline by using the "color" argument or by supplying an overplot index number.
The overplot index match associates a polyline annotation with a specific overplot by guaranteeing that the polyline color will be the same as the overplot color.
When setting an index match, use 1 to refer to the color of the primary series; use 2 to refer to the color of the first overplot; 3 for the second overplot, etc..
The rules for determining the drawing color used for LINEDRAW (or LINECUR) follow. If a color is supplied as the first argument, that color will be used to draw all polylines. If -1 is specified as the first argument, DADiSP checks the overplot index match, the fourth argument. If an overplot index is specified, DADiSP draws all polylines using the color that corresponds to the index. If the color argument is -1 and the overplot index is -1 (or omitted), DADiSP draws the polylines using the color of the primary series.
The onmove, onsize, oncreate, ondelete, onlclick, onmotion, onrclick and onsizing callbacks specify functions to run when the associated event occurs. For example, consider the following callback function:
/* motion callback */
shape_onmotion(h)
{
A callback function accepts the annotation handle as the sole input.
Now for the line:
h = linedraw(0.0, 0.0, 1.0, 1.0);h.onmotion = "shape_onmotion";
The shape_onmotion function is invoked when the line moves via the mouse. In this case, the coordinates of the line are displayed in the status line.
See FINDSHAPE to return the handles of shape objects based on specific property values.
See ARROWDRAW to draw an arrow line.
See ELLIPSEDRAW to draw an ellipse line.
See POLYGONDRAW to draw a closed polygon.
See RECTDRAW to draw a rectangle.