API

Components

D3NetworkGraph

props

NameTypeDefaultDescription
nodesArray<D3Node>[]Array of nodes
linksArray<D3Link>[]Array of links
options?D3OptionsundefinedLinks, nodes, layout and simulation Options

events

NameTypeDescription
'node-click'functionCallback function called when a node is clicked
'link-click'functionCallback function called when a node is mouseovered

Events

D3NeworkGraphEmits

Ƭ D3NeworkGraphEmits: (event: "node-click", $event: TouchEvent | MouseEvent, node: D3Node) => void(event: "link-click", $event: TouchEvent | MouseEvent, link: D3Link) => void

Type declaration

▸ (event, $event, node): void

Event exposed by the D3NetworkGraph component

Parameters
NameType
event"node-click"
$eventTouchEvent | MouseEvent
nodeD3Node
Returns

void

▸ (event, $event, link): void

Event exposed by the D3NetworkGraph component

Parameters
NameType
event"link-click"
$eventTouchEvent | MouseEvent
linkD3Link
Returns

void

Node types

Ƭ D3Link: Object

Represents a link in the graph

Type declaration

NameTypeDescription
sourcestring | numberNode source id
targetstring | numberNode target id
id?number | stringUnique link id. If not provided uses array index
name?stringLink name
labels?string[]Link labels
class?string[]Link css class names
twoWay?booleanIs two-way link (bidirectional)

D3Node

Ƭ D3Node: Object

Represents a node in the graph

Type declaration

NameTypeDescription
idnumber | stringUnique node id. If not provided uses array index
name?stringNode name
labels?string[]Node labels
class?string[]Node css class names,
size?D3NodeSizeNode size
innerSVG?{ viewBox: string ; innerHtml: string }Node svg image
innerSVG.viewBoxstring-
innerSVG.innerHtmlstring-
group?numberGroup id
position?{ x?: number ; y?: number }Initial fixed position
position.x?number-
position.y?number-

D3NodeSize

Ƭ D3NodeSize: number | { width: number ; height: number }

Represents a node size

Options types

D3Options

Ƭ D3Options: Object

Graph options

Type declaration

NameTypeDescription
links?D3LinkOptionsDefault link options
nodes?D3NodeOptionsDefault node options
simulation?D3SimulationOptionsSimulation options
layout?D3LayoutOptionsLayout options

D3NodeOptions

Ƭ D3NodeOptions: Object

Default node options

Type declaration

NameTypeDescription
size?numberDefault node size Default Value 25
font?{ size?: number }-
font.size?numberDefault node size Default Value 12

D3LinkOptions

Ƭ D3LinkOptions: Object

Default link options

Type declaration

NameTypeDescription
widthnumberDefault link width Default Value 1
font?{ size?: number }-
font.size?numberDefault link font size Default Value 12

D3SimulationOptions

Ƭ D3SimulationOptions: Object

Simulation options

Type declaration

NameTypeDescription
force{ x?: number ; y?: number ; charge?: number ; collide?: number }d3 force configurations
force.x?numberd3 forceX strenght between 0 and 1 Default Value 0.1
force.y?numberd3 forceY strenght between 0 and 1 Default Value 0.1
force.charge?numberd3 forceManyBody strenght smaller than 0 Default Value -300
force.collide?numberd3 forceCollide radius Default Value 45

D3LayoutOptions

Ƭ D3LayoutOptions: Object

Layout options

Type declaration

NameTypeDescription
draggable?booleanIndicates if the nodes should be draggable Default Value false
directed?booleanIndicate if the graph is directed. Edge arrow will be displayed Default Value false
static?booleanIndicates if the simulation should not be animated Remarks Use this option if you want to use the simulation to calculate the positions of the nodes but you don't want to render them each 'tick' Default Value false
theme?ThemeCss Theme Default Value teal
dark?booleanIndicate if is dark mode enabled
Last Updated: