class anychart.core.graph.elements.Node Improve this Doc
Graph chart node class.
Methods Overview
Specific settings | |
shape() | Elements shape. |
Appearance | |
fill() | Node fill. |
stroke() | Node stroke. |
Point Elements | |
labels() | Labels settings. |
Size | |
height() | Getter for node height. |
width() | Node width setter. |
State settings | |
hovered() | Hovered state settings. |
normal() | Normal state settings. |
selected() | Selected state settings. |
Miscellaneous | |
tooltip() | Tooltip getter |
Methods Description
fill
Getter for node fill.
Returns:
anychart.graphics.vector.Fill - Fill. See listing
var fill = chart.nodes().fill(); // By default fill is function.
Try it:
Setter for node fill.
Params:
Name | Type | Description |
---|---|---|
color | anychart.graphics.vector.Fill | string | Fill object or string color |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining.Try it:
Setter for node fill.
Params:
Name | Type | Description |
---|---|---|
Function | function | function for color resolve. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining.Try it:
Setter for node fill.
Params:
Name | Type | Description |
---|---|---|
imageSettings | anychart.graphics.vector.Fill | image settings object. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining.Try it:
height
Getter for node height.
Returns:
number - height of the node. See listing
var height = chart.nodes().height();
Try it:
Setter for node height
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 12 | Node height. |
See listing
chart.nodes().height(25);
Try it:
hovered
Getter for hovered state settings.
Returns:
anychart.core.StateSettings - Hovered state settings See listing
var hoveredState = chart.nodes().hovered(); hoveredState.fill('orange') //Set fill for nodes that has hovered state.
Try it:
Setter for hovered state settings.
Params:
Name | Type | Description |
---|---|---|
settings | Object | State settings to set. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining.Try it:
labels
Getter for elements labels.
Detailed description
Note: Labels for nodes has disabled state by default.
Returns:
anychart.core.ui.LabelsFactory - LabelsSettings instance. See listing
var nodesLabels = chart.nodes().labels(); nodesLabels.fontColor('#ccc'); nodesLabels.fontSize(13);
Try it:
Params:
Name | Type | Description |
---|---|---|
config | object | Settings object for labels |
See listing
var labelsConfig = {fontFamily: 'Arial', fontSize:14, fontColor: '#000'}; chart.nodes().labels(labelsConfig};
Try it:
normal
Getter for normal state settings.
Returns:
anychart.core.StateSettings - Normal state settings. See listing
var normalState = chart.nodes().normal(); normalState.shape('star5') //Set shape type for nodes that has normal state.
Try it:
Setter for normal state settings.
Params:
Name | Type | Description |
---|---|---|
settings | Object | State settings to set. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining. See listing
var config = {fill: #A2B5B3, shape: 'square'}; chart.nodes().normal(config};
Try it:
selected
Getter for selected state settings.
Returns:
anychart.core.StateSettings - Selected state settings See listing
var selectedState = chart.nodes().selected(); selectedState.stroke('3 blue') //Set stroke for nodes that has selected state.
Try it:
Setter for selected state settings.
var config = {fill: #A2B5B3, shape: 'square'};
chart.nodes().selected(config};
Params:
Name | Type | Description |
---|---|---|
settings | Object | State settings to set. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining.Try it:
shape
Getter for node shape.
Returns:
string - The elements shape. See listing
var shape = chart.nodes().shape();
Try it:
Setter for node shape.
Detailed description
All unknown shape types will fallback to 'rectangle' shape.
Use one of anychart.enums.MarkerType or 'rectangle'.
If you want custom shape you can use 'rectangle' shape with different sides length and image fill with disabled stroke see imageFill
Use one of anychart.enums.MarkerType or 'rectangle'.
If you want custom shape you can use 'rectangle' shape with different sides length and image fill with disabled stroke see imageFill
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.enums.MarkerType | 'rectangle' | 'circle' | Value to set. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining. See listing
var chart = anychart.graph(data); var imageSettings = { src: 'https://static.anychart.com/images/logo_anychart.png' }; chart.nodes() .width(30) .height(30) .shape('rectangle'); chart.nodes().stroke('none'); chart.nodes().fill(imageSettings); chart.container('container').draw();
Try it:
stroke
Getter for node stroke.
Returns:
anychart.graphics.vector.Fill - stroke. See listing
var stroke = chart.nodes().stroke(); // By default fill is function.
Setter for node stroke.
Params:
Name | Type | Description |
---|---|---|
stringOrObject | anychart.graphics.vector.Fill | string | Stroke object or string color |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining.Try it:
Setter for node stroke.
Params:
Name | Type | Description |
---|---|---|
function | function | Function for color resolve. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining.Setter for the graph elements slices stroke.
Learn more about stroke settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
color | anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | null | 'none' | Stroke settings. |
thickness | number | Line thickness. | |
dashpattern | string | Controls the pattern of dashes and gaps used to stroke paths. | |
lineJoin | string | anychart.graphics.vector.StrokeLineJoin | Line join style. | |
lineCap | string | anychart.graphics.vector.StrokeLineCap | Line cap style. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining.Try it:
tooltip
Tooltip getter
Returns:
anychart.core.ui.Tooltip - Tooltip instance. See listing
var nodesTooltip = chart.nodes().nodesTooltip(); nodesTooltip.format('tooltip for node') //Setup tooltip for nodes.
Try it:
Tooltip setter
Params:
Name | Type | Description |
---|---|---|
tooltipConfig | object | boolean | null | Config with settings for tooltip. |
Returns:
anychart.core.graph.elements.Node - Self instance for method chaining. See listing
var config = {enabled: true, format: 'Node', background: {fill: '#EF9A9A', stroke: '#1B5E20'}}; chart.nodes().tooltip(config); //setup tooltip via config
Try it:
width
Setter for node width
Detailed description
Note: width method works only for 'rectangle' node shape. Width of other shape types you can change via height method.
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 12 | Width of the node. |
Try it: