AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.graph.elements.Edge Improve this Doc

Graph chart edge class.

Methods Overview

Coloring
stroke()Stroke settings.
State settings
hovered()Hovered state settings.
normal()Normal state settings.
selected()Selected state settings.
Miscellaneous
labels()Labels getter
tooltip()Tooltip getter

Methods Description

hovered

Getter for hovered state settings.

Returns:

anychart.core.StateSettings - Hovered state settings
See listing
var edgesHovered = chart.edges().hovered();
var labels = edgesHovered().labels();
labels.enabled(true); //Enabled labels for hovered edges
labels.fontColor('#555F5E'); //and set font color
Setter for hovered state settings.

Params:

NameTypeDescription
settingsObjectState settings to set.

Returns:

anychart.core.graph.elements.Edge - Self instance for method chaining.

labels

Labels getter

Returns:

anychart.core.ui.LabelsFactory - LabelsSettings instance.
See listing
var labels = chart.edges().labels();
labels.enabled(true);
labels.fontSize(8);
Labels setter

Params:

NameTypeDescription
labelsConfigobjectConfig with settings for labels.

Returns:

anychart.core.graph.elements.Edge - Self instance for method chaining.
See listing
var labelsConfig = {fontFamily: 'Arial', fontSize:14, fontColor: '#000'};
chart.edges().labels(labelsConfig};

normal

Getter for normal state settings.

Returns:

anychart.core.StateSettings - Normal state settings.
See listing
var edgesNormal = chart.edges().normal();
edgesNormal.stroke('3 blue') //Set stroke for edges that has normal state.
Setter for normal state settings.

Params:

NameTypeDescription
settingsObjectState settings to set.

Returns:

anychart.core.graph.elements.Edge - Self instance for method chaining.

selected

Getter for selected state settings.

Returns:

anychart.core.StateSettings - Selected state settings
See listing
var edgesSelected = chart.edges().selected();
edgeSelected.stroke('2 red 0.5'); //Set stroke with opacity for selected edges.
Setter for selected state settings.

Params:

NameTypeDescription
settingsObjectState settings to set.

Returns:

anychart.core.graph.elements.Edge - Self instance for method chaining.

stroke

Getter for the graph elements slices stroke.
See listing
var stroke = chart.edges().stroke();
Setter for the graph elements slices stroke using function. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
fillFunctionfunction():anychart.graphics.vector.Stroke|anychart.graphics.vector.ColoredFill
// return stroke from the default palette.
function() {
  return anychart.color.darken(this.sourceColor);
};
Stroke-function, which should look like:
function() {
 //  this: {
 //  index : number  - the index of the current point
 //  sourceColor : anychart.graphics.vector.Stroke - stroke of the current point
 // }
 return myStroke; //anychart.graphics.vector.Stroke
};

Returns:

anychart.core.graph.elements.Edge - Self instance for method chaining.
Setter for the graph elements slices stroke. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | null
'none'
Stroke settings.
thicknessnumber
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 cap style.

Returns:

anychart.core.graph.elements.Edge - Self instance for method chaining.
Setter for the graph elements slices stroke using an object.

Params:

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

Returns:

anychart.core.graph.elements.Edge - Self instance for method chaining.

tooltip

Tooltip getter

Returns:

anychart.core.ui.Tooltip - Tooltip instance.
See listing
var edgesTooltip = chart.edges().tooltip();
edgesTooltip.enabled(false); //Disable tooltip for edges.
Tooltip setter

Params:

NameTypeDescription
tooltipConfigobject | boolean | nullConfig with settings for tooltip.

Returns:

anychart.core.graph.elements.Edge - Self instance for method chaining.
See listing
var config = {enabled: true, format: 'Edge', background: {fill: '#EF9A9A', stroke: '#1B5E20'}};
chart.edges().tooltip(config); //setup tooltip via config