Initializing help system before first use

svgaddline

svgaddline


Purpose
Add a line or polyline to an object group.
Synopsis
procedure svgaddline(gid: string, x1: real, y1: real, x2: real, y2: real)
procedure svgaddline(x1: real, y1: real, x2: real, y2: real)
procedure svgaddline(gid: string, points: list of integer|real)
procedure svgaddline(points: list of integer|real)
Arguments
gid 
Object group ID.
x1 
The x coordinate of the first point.
y1 
The y coordinate of the first point.
x2 
The x coordinate of the second point.
y2 
The y coordinate of the second point.
points 
A list of points.
Example
The following code draws the outline of a triangle, given the correct aspect ratio of the user graph.
svgaddgroup("t", "triangle", SVG_ORANGE)
svgaddline([-2, -2, 0, 2, 2, -2, -2, -2)])
svgsetgraphviewbox(-5, -5, 10, 10)
If the shape is to be filled (here: using the group color), you need to use polygon drawing instead of a polyline:
svgaddpolygon([-2, -2, 0, 2, 2, -2)])
svgsetstyel(svggetlastobj, SVG_FILL, SVG_CURRENT)
Further information
1. The line connects the two points whose coordinates are given as parameters or the points contained in the specified list in their order of appearance in the list.
2. If no group ID is specified, the line is added to the last group that has been created.
Related topics