Vertex

The Vertex class represents a vertex (sometimes called an anchor point) in a path. For example, a triangle has three vertices; a rectangle has four vertices. A vertex can have its own visual styles such as geometric shape, fill color and size. By default, a vertex is invisible (width and height set to 0).

Vertices are automatically created when their parent path objects are instantiated. For rectangles and circles, the positions of the vertices are set automatically based on the top, left, width and height parameters of the Rect, or the x, y and radius parameters of the Circle. For lines, you can specify the positions of the start and end vertices as x1, y1, x2, y2 parameters. For polyline, you can specify the positions of the vertices as the vertices parameter. The API reference for Path contains some examples. You can also manually add a vertex, using the addVertex method in the Path class.

The properties of a vertex can be set individually. You can also set the properties of all the vertices on a path through the following path properties: vxShape, vxWidth, vxHeight, vxRadius, vxFillColor, vxStrokeColor, vxStrokeWidth, vxOpacity.

Properties

propertyexplanationtypedefault value
bounds the bounding rectangle of the vertexRectangle
dataScopethe data scope of the vertexDataScopeundefined
fillColorthe fill color of the vertex shapeColor“#555”
heightthe height of the vertex shapeNumber0
id the unique id of the vertexString
opacitythe opacity of the vertex shapeNumber1
parent the parent mark of the vertexPath
radiusthe radius of the vertex if the shape is “circle”Number0
shapethe shape of the vertex, currently supporting “rect” and “circleStringundefined
strokeColorthe stroke color of the vertex shapeColor“#aaa”
strokeWidththe stroke width of the vertex shapeNumber0
type the type of the vertexString“vertex”
widththe width of the vertex shapeNumber0
xthe x coordinate of the vertex centerNumber0
ythe y coordinate of the vertex centerNumber0