new Link(oLinks, oLinkOptsopt)
The Link object holds information(options) about a link within the control. The Links.Add() method creates and adds a link between two bars. The Item(id) method gets the link giving its index, identifier/key or reference.
Every option of the LinkOptions type has associated a property of the Link object. For instance, the option:
caption {string}, defines the link's captionis associated with the property:
Caption {string}, defines the link's captionwhich means that the following statements are equivalent:
oLink.Options = {caption: "link"}where oLink is an object of Link type
oLink.SetOptions({caption: "link"})
oLink.Caption = "link"
oLink.SetCaption("link")
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
oLinks |
Links | Indicates an object of Links type that's the owner collection of this link. | |
oLinkOpts |
object |
<optional> |
Specifies the options to create the link as an object of LinkOptions type. |
Members
Caption :string
The Caption property gets or sets the link's caption. The caption supports ex-HTML format, such as <b>, <i>, <img> and so on. The ex-HTML caption allows you to format the link's caption, or to include images within the caption. The images can be added using the exontrol.HTMLPicture.Add method. The GetCaption() method returns the link's caption. The Key property gets or sets the link's key. The Index property gets the link's index. The Visible property shows or hides the link. The Remove() method removes the link itself from links collection.
Type:
- string
Example
null {null}, indicates no caption
"caption" {string}, declares a plain-caption
"<b>text</b>" {string}, displays the text in bold
"<img>logo</img>" {string}, displays the "logo" image. The image can be added using the exontrol.HTMLPicture.Add method
Caption
From :number|string|ItemBar
The From property defines the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link starts from (in-item-bar). The To property gets or sets the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link ends to (out-item-bar). The Links.Add(oLinkOpts) method creates and adds a new link into the control. The Links.Item(id) method gets the link giving its index, identifier/key or reference. The Visible property shows or hides the link. The Remove() method removes the link itself from links collection. The From property can be assigned a value as one of the following:
- {number}, indicates a numeric value that defines the index of the item (single/first item-bar of the item)
- {string}, specifies a string expression that defines the identifier/key of the item (single/first item-bar of the item)
- {ItemBar}, specifies the object reference to the item-bar
Type:
- number | string | ItemBar
Example
The following statements are equivalents:
oLink.SetFrom(0), defines the from-item-bar of the link by index(0)
oLink.From = 0, defines the from-item-bar of the link by index(0)
where oLink is an object of Link type
From
(readonly) Index :any
The Index property retrieves the link's index. The index is zero-based. The Links.Item(id) method gets the link giving its index, identifier/key or reference. The Key property gets or sets the link's key. The Caption property gets or sets the link's caption. The Visible property shows or hides the link. The Remove() method removes the link itself from links collection. The Add, Remove, and Clear methods update the indexes of links automatically.
Type:
- any
Example
The following statements are equivalents:
oLink.GetIndex(), returns the index of the link
oLink.Index, returns the index of the link
where oLink is an object of Link type
Index
Key :string
The Key property gets or sets the key to the link. The Links.Item(key) method requests a link by its index, identifier/key or reference. The Index property gets the link's index. The Caption property gets or sets the link's caption. The Visible property shows or hides the link. The Remove() method removes the link itself from links collection.
Type:
- string
Example
"logo" {string}, defines the link with the giving key (logo). You can use the oGantt.Chart.Links.Item("logo") method to request the link giving its key.
Key
Lag :number
The Lag property gets or sets the link's lag (specifies the delay (in days) between linked-activities during the Items.SchedulePDM() method). The lag between two linked-activities can be positive or negative. A positive lag indicates a delay between two linked-activities, while a negative lag indicates an overlap between two linked-activities. The lag indicates the number of days between two linked-activities. The WorkingLag property gets or sets the delay (in working days) between linked-activities during the Items.SchedulePDM() method. By default, the link's lag is null, which indicates no lag between linked-activities.
Type:
- number
Example
null {null}, no lag between linked-activities
2 {number}, indicates 2 days between linked-activities
Lag
Link :DisplayLinkType
The Link property gets or sets the appearance of the link between item-bars. The Visible property shows or hides the link. The Caption property gets or sets the link's caption. The Key property gets or sets the link's key. The Index property gets the link's index. The Remove() method removes the link itself from links collection. By default, the Link property is null, which indicates that the link's visual appearance is defined by the Chart.Link property. The Link property specifies the appearance of the link between item-bars, as an object of {type, dir, width, color, arrow, style, startPos, endPos} type, where:
- type {exontrol.LinkTypeEnum}, specifies the type of the link as 0 (rectangular), 1 (direct), 2(straight) or 3(round)
- dir {number}, specifies whether the link's direction is shown or hidden as 0 (hidden), 1(shows the direction/arrow where the link begins), 2(shows the direction where the link ends, default) or 3 shows the arrows in both sides
- width {number}, specifies the link's width or size (1 by default)
- color {string}, indicates the link's color (partial-black by default)
- arrow {string}, indicates the arrow's color. If it is missing or not specified the arrow is shown using the link's color (gray by default)
- arrowSize {number}, indicates the arrow's size. If it is missing or not specified the arrow's size is defined by link's width (1 by default) (since 2.2)
- arrowShape {object}, defines an object of exontrol.Def.Shape type to customize the shape of the link's arrow (for instance shows the link's arrow as a circle instead of a triangle) (since 2.2)
- style {array}, specifies the link's dash pattern to show the lines (solid by default)
- startPos {any}, indicates the list of corners of in-element, the link can start from
- endPos {any}, indicates the list of corners of out-element, the link can end to
Type:
Example
{color: "red"}, sets the link's color to red
{type: 2, color: "blue", width: 2}, sets the link's type to straight(2), color to blue and width to 2
Link
Options :LinkOptions
The Options property gets or sets the link's options (visibility, caption, ...) at once. Changing the option through the Options property or through the property of the Link object has the same effect. Use the Options to assign multiple-options at once.
Each option has associated a property of the Link object, so the following statements are equivalents:
oLink.Options = {caption: "link"}
oLink.SetOptions({caption: "link"})
oLink.Caption = "link"
oLink.SetCaption("link")
Type:
Example
The following statements are equivalents:
oLink.SetOptions({ caption: "link" }), sets the caption of the link
oLink.Options = { caption: "link" }, sets the caption of the link
oLink.SetCaption("link"), sets the caption of the link
oLink.Caption = "link", sets the caption of the link
where oLink is an object of Link type
Options
To :number|string|ItemBar
The To property defines the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link ends to (out-item-bar). The From property gets or sets the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link starts from (in-item-bar). The Links.Add(oLinkOpts) method creates and adds a new link into the control. The Links.Item(id) method gets the link giving its index, identifier/key or reference. The Visible property shows or hides the link. The Remove() method removes the link itself from links collection. The To property can be assigned a value as one of the following:
- {number}, indicates a numeric value that defines the index of the item (single/first item-bar of the item)
- {string}, specifies a string expression that defines the identifier/key of the item (single/first item-bar of the item)
- {ItemBar}, specifies the object reference to the item-bar
Type:
- number | string | ItemBar
Example
The following statements are equivalents:
oLink.SetTo(1), defines the to-item-bar of the link by index(1)
oLink.To = 1, defines the to-item-bar of the link by
where oLink is an object of Link type
To
Type :any
The Type property gets or sets the link's type. Tasks may have multiple predecessors or multiple successors. The Lag property gets or sets the delay (in days) between linked-activities during the Items.SchedulePDM() method. The WorkingLag property gets or sets the delay (in working days) between linked-activities during the Items.SchedulePDM() method.
Before you begin establishing dependencies, it's important to understand that there are four types:
- Finish to Start (FS), the predecessor ends before the successor can begin
- Start to Start (SS), the predecessor begins before the successor can begin
- Finish to Finish (FF), the predecessor ends before the successor can end
- Start to Finish (SF), the predecessor begins before the successor can end
The Type property can be assigned a value as one of the following:
- 1 {number} indicates a SF link (SF, S(tart)-F(inish)) (the startPos is set on left, endPos is set on right, the Type returns 1)
- 2 {number} indicates a FS link (FS, F(inish)-S(tart)) (the startPos is set on right, endPos is set on left, the Type returns 2)
- 4 {number} indicates a FF link (FF, F(inish)-F(inish)) (the startPos is set on right, endPos is set on right, the Type returns 4)
- 8 {number} indicates a SS link (SS, S(tart)-S(tart)) (the startPos is set on left, endPos is set on left, the Type returns 8)
- "SF" {string} indicates a SF link (SF, S(tart)-F(inish)) (the startPos is set on left, endPos is set on right, the Type returns 1)
- "FS" {string} indicates a FS link (FS, F(inish)-S(tart)) (the startPos is set on right, endPos is set on left, the Type returns 2)
- "FF" {string} indicates a FF link (FF, F(inish)-F(inish)) (the startPos is set on right, endPos is set on right, the Type returns 4)
- "SS" {string} indicates a SS link (SS, S(tart)-S(tart)) (the startPos is set on left, endPos is set on left, the Type returns 8)
Type:
- any
- Since:
- 2.3
Example
2 or any other value except 1, 4 or 8 {number}, indicates a FS link (FS, F(inish)-S(tart))
4 {number}, indicates a FF link (FF, F(inish)-F(inish))
"SS" {string}, indicates a SS link (SS, S(tart)-S(tart))
Type
Visible :boolean
The Visible property shows or hides the link. The Caption property gets or sets the link's caption. The Key property gets or sets the link's key. The Index property gets the link's index. The GetVisible() method returns whether the link is visible or hidden. The Remove() method removes the link itself from links collection. By default, the link is visible.
Type:
- boolean
Example
false {boolean}, hides the link
true {boolean}, shows the link
Visible
WorkingLag :number
The WorkingLag property gets or sets the link's working-lag (specifies the delay (in working days) between linked-activities during the Items.SchedulePDM() method). The Lag property gets or sets the delay (in days) between linked-activities during the Items.SchedulePDM() method. The working-lag between two linked-activities can be positive or negative. A positive working-lag indicates a delay between two linked-activities, while a negative working-lag indicates an overlap between two linked-activities. The working-lag indicates the number of working-days between two linked-activities. By default, the link's working-lag is null, which indicates no lag between linked-activities.
Currently, the working-lag is not supported.
Type:
- number
Example
null {null}, no lag between linked-activities
2 {number}, indicates 2 working-days between linked-activities
WorkingLag
Methods
Remove()
The Remove() method removes the link itself from its collection. The Links.Remove() method removes a link from the collection, given the link's index, identifier/key or reference. The Remove() method of Link object is an equivalent of Links.Remove(oLink) method. The Links.Clear method removes all links of the control. The Visible property shows or hides the link.
Example
The following statements are equivalents:
oLink.Remove(), removes the link itself from its collection
oGantt.Chart.Links.Remove(oLink), removes the link from the collection
where oLink is an object of Link type, and oGantt is an object of Gantt type
Remove