Line properties
note
While specifying color values of the item, you can use the following formats: HEX, RGBA, RGB, HSL, or HSLA.
Common properties
Usage
const data = [
// line object
{
type?: "line" | "dash", // "line" by default
id?: string | number,
from?: string | number,
to?: string | number,
connectType?: "straight" | "elbow" | "curved",
strokeWidth?: number, // 2 by default
stroke?: string
},
// more line objects
];
Description
Each line object can include the following properties:
type
- (optional) the type of the connector line: "line" (default) or "dash"id
- (optional) the id of a connectorfrom
- (optional) the id of the parent shapeto
- (optional) the id of the child shapeconnectType
- (optional) the type of the connector line: "straight", "elbow" (the default type in the default/org chart modes), "curved" (the default type in the mindmap mode)strokeWidth
- (optional) the width of the line, 2 by defaultstroke
- (optional) the color of the line; "#2198F3" in the default mode, and "#CCC" in the org chart/mindmap modes by default
Properties specific for the default mode
Usage
const data = [
// line object
{
..., // common properties
forwardArrow?: string, // "filled" by default
backArrow?: string, // "filled" by default
fromSide?: "top" | "bottom" | "left" | "right" | "center",
toSide?: "top" | "bottom" | "left" | "right" | "center",
cornersRadius?: number,
customGap?: number,
points?: [
{ x: number, y: number, custom?: boolean },
// more point's objects
],
title?: {
fontSize?: number | string, // 14 by default
lineHeight?: number | string, // 14 by default
textAlign?: "center" | "left" | "right", // "center" by default
textVerticalAlign?: string,
fontStyle?: "normal" | "italic" | "oblique", // "normal" by default
fontColor?: string, // "#4C4C4C" by default
fontWeight?: string, // "500" by default
fill?: string,
editable?: boolean, // true by default
hidden?: boolean,
draggable?: boolean,
autoPosition?: boolean,
text?: [
{
id?: string | number,
type?: "$linetext",
width?: number,
height?: number,
distance?: number,
autoPosition?: boolean,
hidden?: boolean,
editable?: boolean, // true by default
draggable?: boolean,
fill?: string,
text?: string,
fontSize?: number | string, // 14 by default
lineHeight?: number | string, // 14 by default
fontStyle?: "normal" | "italic" | "oblique", // "normal" by default
fontColor?: string, // "#4C4C4C" by default
fontWeight?: string, // "500" by default
textAlign?: "center" | "left" | "right", // "center" by default
textVerticalAlign?: "center" | "top" | "bottom" // "center" by default
},
// more objects for text items of a line
]
}
},
// more line objects
]
Description
When preparing a data set for lines to load into the diagram in the default mode, you can add the following properties to the configuration object of a line:
forwardArrow
- (optional) sets a forward arrow connector and defines the type of the arrow ("filled" by default)backArrow
- (optional) sets a back arrow connector and defines the type of the arrow ("filled" by default)fromSide
- (optional) the side of the shape from which connection will start ("top", "bottom", "left","right", "center")toSide
- (optional) the side of the shape to which a different shape will be attached ("top", "bottom", "left", "right", "center")cornersRadius
- (optional) the radius of rounding corners of a connectorcustomGap
- (optional) sets the value of the lineGap property for the linepoints
- (optional) sets an array with point's objects for a line. Each object contains the following properties:x
- (required) the x coordinate of the pointy
- (required) the y coordinate of the pointcustom
- (optional) defines whether the point is fixed. If true, the position of the point can be changed only after interaction with it
title
- (optional) sets text items of a line. The title property presents an object with the following properties:fontSize
- (optional) the size of the font in pixels, 14 by defaultlineHeight
- (optional) the height of a line, 14 by defaulttextAlign
- (optional) the alignment of text: "center"(default), "left", "right"textVerticalAlign
- (optional) the vertical alignment of text: "center"(default), "top", "bottom"fontStyle
- (optional) the style of the text font: "normal" (default), "italic", "oblique"fontColor
- (optional) the color of the text font, "#4C4C4C" by defaultfontWeight
- (optional) the text font weight, possible values are: "normal", "bold", "bolder", "lighter", values "100"-"900", where "400" is the same as normal, and "600"+ is the boldest font; "500" by defaultfill
- (optional) the background color of the text itemeditable
- (optional) enables/disables the ability to edit the text of all text items of the line by double-clicking on it; true by defaulthidden
- (optional) defines, whether the text will be hiddendraggable
- (optional) enables/disables the ability to drag the textautoPosition
- (optional) defines the direction of the text, true - the direction of the text is the same as the line, false - the direction of the text is always horizontaltext
- (optional) an array of text items of a line. The text property presents an array of text items of a line, each item contains the following configuration:id
- (optional) the id of the text item of a linetype
- (optional) the type of an item, set it to "$linetext"width
- (optional) the width of the text item, calculated automaticallyheight
- (optional) the height of text item, calculated automaticallydistance
- (optional) defines the distance between the text and the parent shape, the value from 0 to 100autoPosition
- (optional) defines the direction of the text, true - the direction of the text is the same as the line, false - the direction of the text is always horizontalhidden
- (optional) defines, whether the text will be hiddeneditable
- (optional) enables/disables the ability to edit the text of the item by double-clicking on it; true by defaultdraggable
- (optional) enables/disables the ability to fix text item with set distance valuefill
- (optional) the background color of the text itemtext
- (optional) the text to be rendered in the text item of a linefontSize
- (optional) the size of the font in pixels, 14 by defaultlineHeight
- (optional) the height of a line, 14 by defaultfontStyle
- (optional) the style of the text font: "normal" (default), "italic", "oblique"fontColor
- (optional) the color of the text font, "#4C4C4C" by defaultfontWeight
- (optional) the text font weight, possible values are: "normal", "bold", "bolder", "lighter", values "100"-"900", where "400" is the same as normal, and "600"+ is the boldest font; "500" by defaulttextAlign
- (optional) the alignment of text: "center"(default), "left", "right"textVerticalAlign
- (optional) the vertical alignment of text: "center"(default), "top", "bottom"
Example
const data = [
// configuring shapes
{ "id": 1, "x": 200, "y": 0, "text": "Start", "type": "start" },
{ "id": 2, "x": 200, "y": 320, "text": "Call Client and \n set-up Appointment", "type": "process" },
// configuring lines
{
"type": "line",
"stroke": "#0AB169",
"connectType": "straight",
"from": "1",
"to": "2",
"fromSide": "bottom",
"toSide": "top",
"forwardArrow": "filled",
"title": {
"fontSize":14,
"lineHeight":14,
"text": [
{
"type":"$linetext",
"id":"t2-3",
"text":"Read the instruction",
}
]
},
},
];
Related articles: Configuring lines