AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.gantt.elements.ConnectorElement Improve this Doc

Extends: anychart.core.Base

Connector element settings.

Methods Overview

Coloring
fill()Connector fill settings.
previewStroke()Connector preview stroke settings.
stroke()Connector stroke settings.
Events
listen()Adds an event listener.
listenOnce()Adds a single time event listener.
removeAllListeners()Removes all listeners.
unlisten()Removes the listener.
unlistenByKey()Removes the listener by the key.
Interactivity
normal()Normal state settings.
selected()Selected state settings.

Methods Description

fill

Getter for the connector fill.

Returns:

anychart.graphics.vector.Fill | string - Connector fill.
Setter for fill settings using function.

Params:

NameTypeDefaultDescription
fillFunctionfunction():anychart.graphics.vector.Fill
function() {
}
Function that looks like:
function(){
   // this.sourceColor - Color with type anychart.graphics.vector.Fill (directly resolvable color).
   Type is anychart.graphics.vector.Fill, anychart.graphics.vector.PatternFill. The color is set from a theme
   or palette and is determined automatically for each colorized element.
   // this.fromItem - the item of the visual element from which the connector is drawn. Type is anychart.data.Tree.DataItem or anychart.data.TreeView.DataItem
   // this.fromItemIndex - the item linear index of the visual element from which the connector is drawn. Type is number
   // this.toItem - the item of the visual element to which the connector is drawn. Type is anychart.data.Tree.DataItem or anychart.data.TreeView.DataItem
   // this.toItemIndex - the item linear index of the visual element to which the connector is drawn. Type is number
   // this.connType - connector type. Type is anychart.enums.ConnectorType
   // this.fromPeriod - the period of the visual element from which the connector is drawn. Type is object. A period object with the index
   this.periodIndex at the data point this.item, corresponding to the visual display element. Works only with anychart#ganttResource
   // this.fromPeriodIndex - the period index of the visual element from which the connector is drawn.
   // this.toPeriod - the period of the visual element to which the connector is drawn. Type is object. A period object with the index
   this.periodIndex at the data point this.item, corresponding to the visual display element. Works only with anychart#ganttResource
   // this.toPeriodIndex - the period index of the visual element to which the connector is drawn.

   return fillValue; // type anychart.graphics.vector.Fill
}

Returns:

anychart.core.ui.Timeline - Self instance for method chaining.
Setter for connector fill settings using an object or a string. Learn more about coloring.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Fill | !Array.<(anychart.graphics.vector.GradientKey|string)> | null
'#000090'
Fill settings.
cxnumber
X ratio of center radial gradient.
cynumber
Y ratio of center radial gradient.
opacityOrModeanychart.graphics.math.Rect
If defined then userSpaceOnUse mode, else objectBoundingBox.
opacitynumber
Opacity.
fxnumber
X ratio of focal point.
fynumber
Y ratio of focal point.

Returns:

anychart.core.gantt.elements.ConnectorElement - Self instance for method chaining.

listen

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method. Function that looks like:
function(event){
   // event.actualTarget - actual event target
   // event.currentTarget - current event target
   // event.iterator - event iterator
   // event.originalEvent - original event
   // event.point - event point
   // event.pointIndex - event point index
}
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

listenOnce

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

normal

Getter for normal state settings.

Returns:

anychart.core.StateSettings - Normal state settings.
Setter for normal state settings.

Params:

NameTypeDescription
settingsObjectState settings to set.

Returns:

anychart.core.gantt.elements.ConnectorElement - Self instance for method chaining.

previewStroke

Getter for the connector preview stroke.

Returns:

anychart.graphics.vector.Stroke | string - Connector preview stroke.
See listing
var connectors = timeLine.connectors();
var previewStroke = connectors.previewStroke();
Setter for the connector preview stroke. Learn more about stroke settings.

Params:

NameTypeDescription
valueanychart.graphics.vector.Stroke | string | nullStroke settings.
thicknessnumberLine thickness.
dashpatternstringControls the pattern of dashes and gaps used to stroke paths.
lineJoinstring | anychart.graphics.vector.StrokeLineJoinLine join style.
lineCapstring | anychart.graphics.vector.StrokeLineCapLine cap style.

Returns:

anychart.core.gantt.elements.ConnectorElement - Self instance for method chaining.

removeAllListeners

Removes all listeners from an object. You can also optionally remove listeners of some particular type.

Params:

NameTypeDescription
typestringType of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

selected

Getter for selected state settings.

Returns:

anychart.core.StateSettings - Selected state settings
Setter for selected state settings.

Params:

NameTypeDescription
settingsObjectState settings to set.

Returns:

anychart.core.gantt.elements.ConnectorElement - Self instance for method chaining.

stroke

Getter for the connector stroke settings.

Returns:

anychart.graphics.vector.Stroke | string - Connector stroke settings.
Setter for the connector stroke settings. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | null
Stroke settings.
thicknessnumber
1
Line thickness.
dashpatternstring
Controls the pattern of dashes and gaps used to stroke paths.
lineJoinstring | anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCapstring | anychart.graphics.vector.StrokeLineCap
Line join style.

Returns:

anychart.core.gantt.elements.ConnectorElement - Self instance for method chaining.
Setter for connector stroke settings using function.

Params:

NameTypeDefaultDescription
strokeFunctionfunction():anychart.graphics.vector.Stroke|anychart.graphics.vector.ColoredFill
function() {
}
Function that looks like:
function(){
   // this.sourceColor - Color with type anychart.graphics.vector.Stroke (directly resolvable color).
   Type is anychart.graphics.vector.Stroke. The color is set from a theme or palette and is determined automatically for each colorized element.
   // this.fromItem - the item of the visual element from which the connector is drawn. Type is anychart.data.Tree.DataItem or anychart.data.TreeView.DataItem
   // this.fromItemIndex - the item linear index of the visual element from which the connector is drawn. Type is number
   // this.toItem - the item of the visual element to which the connector is drawn. Type is anychart.data.Tree.DataItem or anychart.data.TreeView.DataItem
   // this.toItemIndex - the item linear index of the visual element to which the connector is drawn. Type is number
   // this.connType - connector type. Type is anychart.enums.ConnectorType
   // this.fromPeriod - the period of the visual element from which the connector is drawn. Type is object. A period object with the index
   this.periodIndex at the data point this.item, corresponding to the visual display element. Works only with anychart#ganttResource
   // this.fromPeriodIndex - the period index of the visual element from which the connector is drawn.
   // this.toPeriod - the period of the visual element to which the connector is drawn. Type is object. A period object with the index
   this.periodIndex at the data point this.item, corresponding to the visual display element. Works only with anychart#ganttResource
   // this.toPeriodIndex - the period index of the visual element to which the connector is drawn.

    return strokeValue; // type anychart.graphics.vector.Stroke
}

Returns:

anychart.core.gantt.elements.ConnectorElement - Self instance for method chaining.
Setter for connector stroke settings using object.

Params:

NameTypeDescription
settingsObjectObject with stroke settings from anychart.graphics.vector.Stroke

Returns:

anychart.core.gantt.elements.ConnectorElement - Self instance for method chaining.

unlisten

Removes a listener added using listen() or listenOnce() methods.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object):boolean|undefined
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

unlistenByKey

Removes an event listener which was added with listen() by the key returned by listen() or listenOnce().

Params:

NameTypeDescription
keyObjectThe key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.