Network Graph.
PROExplore entities and their connections as a network.
LIVE EXAMPLE
Circular network
Appearance and style8
Legend and interaction11
Title and dimensions3
View nodes and connections in an evenly spaced circular layout. All values are sample data.
View code
<div id="chart-container" style="width: 100%; min-width: 0;"></div>
<script type="module">
import { defineCustomElement as define0 } from '@syidax/advanced-pro/components/sy-network-graph.js';
define0();
// Pro: complete registerLicense at app startup using your issued certificate.
// The website preview certificate is not for use in customer apps.
const specs = [
{
"id": "example-chart",
"tag": "sy-network-graph",
"props": {
"data": {
"links": [
{
"source": "Seoul",
"target": "Busan",
"value": 24
},
{
"source": "Busan",
"target": "Daegu",
"value": 18
},
{
"source": "Daegu",
"target": "Seoul",
"value": 30
},
{
"source": "Seoul",
"target": "Jeju",
"value": 12
},
{
"source": "Jeju",
"target": "Busan",
"value": 9
}
]
},
"layout": "circular",
"nodeLabels": "show",
"width": 640,
"height": 360,
"brandPosition": "bottom-right",
"brandLogo": ""
}
}
];
const container = document.querySelector('#chart-container');
const elements = specs.map(({ tag, id, props }) => {
const element = document.createElement(tag);
element.id = id;
Object.assign(element, props);
element.setAttribute('aria-label', 'network-graph example chart');
return element;
});
container.replaceChildren(...elements);
const chart = elements.at(-1);
const onEvent = event => {
console.log('nodeClick', event.detail);
};
chart.addEventListener('nodeClick', onEvent);
const observer = new ResizeObserver(([entry]) => {
const width = Math.max(160, Math.floor(entry.contentRect.width));
elements.forEach(element => { element.width = width; });
});
observer.observe(container);
// In an SPA, call this function when the view is disposed.
function disposeChart() {
observer.disconnect();
chart.removeEventListener('nodeClick', onEvent);
container.replaceChildren();
}
</script>Usage and data
#Inspect dependencies, collaboration, or service connections.
On-screen distance is a layout result. Do not interpret it as actual distance or relationship strength without an explicit definition.
Data contract
| Property | Input format |
|---|---|
data | nodes and links with source and target. |
layout | Choose circular, force, or hierarchical. |
Updating data
Assign a new array or object to the property instead of mutating values inside an array. Chart events provide selection results through event.detail. When disposing of the view, clean up ResizeObserver and event listeners registered by your app.
Feature examples
#Try 27 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.
Drag nodesPRO
Drag nodes to explore their connections.
View code
Hierarchical layoutPRO
Arrange directed relationships in a hierarchy.
View code
Inspect values with the pointerPRO
Point to data to view the value at that location.
View code
Drag to zoom and panPRO
Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.
View code
Replay animationPRO
Redraw the same example to inspect its initial display animation.
View code
AnimationPRO
Compare 2 examples of Animation. Buttons and options update both the live result and source code.
View code
BundlingPRO
Compare 3 examples of Bundling. Buttons and options update both the live result and source code.
View code
CapacityPRO
Compare 2 examples of Capacity. Buttons and options update both the live result and source code.
View code
ClusteringPRO
Compare 3 examples of Clustering. Buttons and options update both the live result and source code.
View code
Data inputPRO
Compare 1 examples of Data input. Buttons and options update both the live result and source code.
View code
DragPRO
Compare 3 examples of Drag. Buttons and options update both the live result and source code.
View code
LabelPRO
Compare 4 examples of Label. Buttons and options update both the live result and source code.
View code
LayoutPRO
Compare 6 examples of Layout. Buttons and options update both the live result and source code.
View code
LinksPRO
Compare 8 examples of Links. Buttons and options update both the live result and source code.
View code
Large datasetsPRO
Compare 2 examples of Large datasets. Buttons and options update both the live result and source code.
View code
SizePRO
Compare 1 examples of Size. Buttons and options update both the live result and source code.
View code
TooltipPRO
Compare 12 examples of Tooltip. Buttons and options update both the live result and source code.
View code
Zoom and panPRO
Compare 9 examples of Zoom and pan. Buttons and options update both the live result and source code.
View code
Context menuPRO
Compare 1 examples of Context menu. Buttons and options update both the live result and source code.
View code
HoverPRO
Compare 2 examples of Hover. Buttons and options update both the live result and source code.
View code
Link ClickPRO
Compare 4 examples of Link Click. Buttons and options update both the live result and source code.
View code
Node ClickPRO
Compare 2 examples of Node Click. Buttons and options update both the live result and source code.
View code
Data context menuPRO
Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.
View code
Read coordinates and dataPRO
Compare 1 examples of Read coordinates and data. Buttons and options update both the live result and source code.
View code
OptionalPRO
Compare 2 examples of Optional. Buttons and options update both the live result and source code.
View code
OverviewPRO
Compare 3 examples of Overview. Buttons and options update both the live result and source code.
View code
Streaming · Add and update live dataPRO
Compare 5 examples of Add and update live data. Buttons and options update both the live result and source code.
View code
Add to your interface
#The code tabs below the preview contain the full data, options, event bindings, and responsive sizing for the current example. Copy them into an app project, such as Vite, that can resolve the installed packages.
API reference
#The full public API for sy-network-graph. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.
Key properties
| Attribute / Property | Type / Default | Description |
|---|---|---|
NetworkGraphDataDefault: undefined | nodes and links with source and target. | |
numberDefault: 900 | Chart width in pixels. Update with ResizeObserver when the container changes. | |
numberDefault: 400 | Chart height in pixels. | |
| brandLogo | stringDefault: undefined | The default is the Syidax logo. With the Pro chart.branding entitlement, use none or a PNG, JPEG, or WebP data URL. |
| brandPosition | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'Default: 'bottom-right' | The corner where the logo is anchored. Applies equally to Community and Pro, on screen and in image exports. |
| nodeRadius | numberDefault: NETWORK_GRAPH_DEFAULT_NODE_RADIUS | The radius of each node in CSS pixels, including isolated nodes. |
| linkWidth | numberDefault: NETWORK_GRAPH_DEFAULT_LINK_WIDTH | The connecting line's width in CSS pixels; link values do not change its width. |
NetworkGraphLayoutDefault: 'circular' | Choose circular, force, or hierarchical. | |
| linkOpacity | numberDefault: DEFAULT_LINK_OPACITY | The connecting lines' opacity (0 … 1). |
| linkCurvature | numberDefault: NETWORK_GRAPH_DEFAULT_CURVATURE | Connecting-line curvature (0 … 1). Self and parallel links keep distinct paths. |
| nodeLabels | NetworkGraphLabelModeDefault: 'auto' | the node labels beside the nodes: `auto` (hidden where they would overlap), `show`, `hide`; `node-label-value` appends the throughput. |
| nodeLabelValue | booleanDefault: false | Set as an HTML attribute or JavaScript property. type: boolean. |
| chartTitle | stringDefault: undefined | The title inside the chart. Explain the data's unit and meaning alongside it. |
| chartSubtitle | stringDefault: undefined | The subtitle inside the chart. |
| nodeDrag | booleanDefault: true | Nodes can be dragged with a pointer (mouse, touch, pen) and nudged with Ctrl / ⌘ + arrows; a dragged node stays pinned where it was dropped. |
CartesianTooltipInputDefault: undefined | Tooltip settings for pointer-driven values, position, and content. | |
| tooltipEnabled | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| animated | booleanDefault: false | Whether to animate initial display and data changes. |
| animationDuration | numberDefault: 600 | Animation duration in milliseconds. |
| animationEasing | NetworkGraphEasingDefault: 'ease-out' | Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'. |
| animationType | NetworkGraphAnimationTypeDefault: undefined | Allowed values: initial, update. Default: undefined. |
CartesianZoomInputDefault: undefined | Settings for zooming and the visible range. |
Other properties 17
| Attribute / Property | Type / Default | Description |
|---|---|---|
| layoutIterations | numberDefault: NETWORK_GRAPH_DEFAULT_LAYOUT_ITERATIONS | Maximum force iterations, clamped to 0…10000; other layouts ignore this option. The solver also enforces its work budget. |
| linkDistance | numberDefault: NETWORK_GRAPH_DEFAULT_LINK_DISTANCE | Desired force spring length in CSS pixels; other layouts ignore this option. |
numberDefault: NETWORK_GRAPH_DEFAULT_REPULSION | Force repulsion strength; zero disables repulsion. Other layouts ignore this option. | |
NetworkGraphBundlingDefault: 'none' | `none` or `force`: bundle the connecting lines of distinct endpoint pairs toward compatible neighbours; positions, identities, lanes and hit rules stay. | |
| bundleStrength | numberDefault: NETWORK_GRAPH_BUNDLING_DEFAULT_STRENGTH | The bundling attraction, 0 … 1 (0 keeps straight centrelines); ignored while bundling is `none`. |
stringDefault: AUTO_COLOR | The nodes' fill: `auto` (the palette by index) or a CSS colour; a node's own `color` wins. | |
| linkColor | stringDefault: 'source' | The links' colour: `source` / `target` (the node's colour at that end) or a CSS colour; a link's own `color` wins. |
NetworkGraphClusteringDefault: 'none' | Community detection over the current graph, independent of `layout`: `none` or `louvain`; with `color="auto"` the palette follows the group instead of the node index. | |
| neighbourDim | numberDefault: DEFAULT_NEIGHBOUR_DIM | with a hovered / focused node, the links touching neither of its ends fade to this alpha factor (0 … 1; 1 = no dim). |
| activeColor | stringDefault: DEFAULT_ACTIVE_COLOR | The hovered / focused node or link. |
| enableMouseTracking | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| tooltipFormat | (detail: NetworkGraphHitDetail) => stringDefault: undefined | Pass as a JavaScript property. type: (detail: NetworkGraphHitDetail) => string. |
| streamSource | NetworkGraphStreamSourceDefault: undefined | A stream source for live data. Check the contract for the specific type. |
| streamMax | numberDefault: undefined | The maximum number of streaming data points to retain. |
| streamWindow | numberDefault: undefined | The streaming data range to keep visible. |
NetworkGraphEngineModeDefault: 'auto' | Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type. | |
NetworkGraphUnavailableBehaviourDefault: 'fallback' | Allowed values: fallback, error. Default: 'fallback'. |
Events 19
| Events | Detail type | Description |
|---|---|---|
NetworkGraphRenderResult & { tier: NetworkGraphEngineTier } | Emits rendering results in detail when chart drawing completes. | |
NetworkGraphNodeEventDetail | CustomEvent.detail type: NetworkGraphNodeEventDetail. Event names are case-sensitive. | |
NetworkGraphNodeEventDetail | null | CustomEvent.detail type: NetworkGraphNodeEventDetail | null. Event names are case-sensitive. | |
NetworkGraphLinkEventDetail | CustomEvent.detail type: NetworkGraphLinkEventDetail. Event names are case-sensitive. | |
NetworkGraphLinkEventDetail | null | CustomEvent.detail type: NetworkGraphLinkEventDetail | null. Event names are case-sensitive. | |
NetworkGraphSelectionChangeEventDetail | the selection (the pinned highlight) changed: a node or a link (never both) or nothing, and what changed it. | |
NetworkGraphNodeDragEventDetail | CustomEvent.detail type: NetworkGraphNodeDragEventDetail. Event names are case-sensitive. | |
NetworkGraphNodeDragEventDetail | CustomEvent.detail type: NetworkGraphNodeDragEventDetail. Event names are case-sensitive. | |
NetworkGraphNodeDragEventDetail | CustomEvent.detail type: NetworkGraphNodeDragEventDetail. Event names are case-sensitive. | |
ChartPointContextMenuEventDetail<NetworkGraphHitDetail> | CustomEvent.detail type: ChartPointContextMenuEventDetail<NetworkGraphHitDetail>. Event names are case-sensitive. | |
{ count: number; replaced: number } | CustomEvent.detail type: { count: number; replaced: number }. Event names are case-sensitive. | |
{ dropped: number } | CustomEvent.detail type: { dropped: number }. Event names are case-sensitive. | |
CartesianTooltipEventDetail | Whether to display the built-in tooltip. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
CartesianTooltipActionEventDetail | CustomEvent.detail type: CartesianTooltipActionEventDetail. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
CartesianZoomChangeEventDetail | Fired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new state. |
Methods 43
Stencil methods return Promises. Use await within an async function to read the result.
| Method / Arguments | Return type | Description |
|---|---|---|
Promise<NetworkGraphRenderResult> | An asynchronous method. Check the argument and return types below. | |
Promise<NetworkGraphEngineTier> | An asynchronous method. Check the argument and return types below. | |
Promise<string | undefined> | An asynchronous method. Check the argument and return types below. | |
| data: NetworkGraphData | Promise<void> | An asynchronous method. Check the argument and return types below. |
| link: NetworkGraphLinkInput | Promise<void> | Upsert one link (a tracked source → target pair replaces its link). |
| links: ReadonlyArray<NetworkGraphLinkInput> | Promise<void> | An asynchronous method. Check the argument and return types below. |
| count: number | Promise<void> | Drop the oldest streamed links (the `data` links are not the stream). |
| links: ReadonlyArray<NetworkGraphLinkInput> | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<NetworkGraphStreamSource | undefined> | An asynchronous method. Check the argument and return types below. | |
Promise<ChartEngineStatus> | Requested vs effective engine and why (CHART-ADD-08), with the chart.type.network-graph license state. | |
| options: { duration?: number; easing?: NetworkGraphEasing; enabled?: boolean; type?: NetworkGraphAnimationType } | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
| cssX: number, cssY: number | Promise<NetworkGraphHitDetail | null> | The node or link under a host-local CSS point (a node first, else the topmost link), or null (always without a valid license). |
| index: number | Promise<NetworkGraphNode | null> | An asynchronous method. Check the argument and return types below. |
| id: string | Promise<NetworkGraphNode | null> | An asynchronous method. Check the argument and return types below. |
Promise<NetworkGraphNode[]> | An asynchronous method. Check the argument and return types below. | |
Promise<NetworkGraphLink[]> | An asynchronous method. Check the argument and return types below. | |
Promise<number> | An asynchronous method. Check the argument and return types below. | |
Promise<number> | An asynchronous method. Check the argument and return types below. | |
Promise<NetworkGraphExtent> | An asynchronous method. Check the argument and return types below. | |
| id: string, x: number, y: number | Promise<NetworkGraphPinnedNode | null> | Holds a node (by id) at a plot-local, unzoomed position, as a finished drag does: the paths re-route and an update morph moves it there. Returns the applied (clamped) position, or null for an unknown id. |
| id: string | Promise<boolean> | Releases a pinned node back to its layout position (with an update morph); false when it was not pinned. |
Promise<number> | An asynchronous method. Check the argument and return types below. | |
Promise<NetworkGraphPinnedNode[]> | The pinned nodes of the current graph in id order, at their applied (clamped) positions. | |
Promise<{ nodes: number; links: number; total: number; dropped: number; nodeRadius: number; linkWidth: number; layout: NetworkGraphLayout; curvature: number; force?: NetworkGraphForceStats; hierarchical?: NetworkGraphHierarchicalStats; bundling?: NetworkGraphBundlingStats; pinned?: number }> | Settled node/link geometry, relationship totals and target layout diagnostics. A target's statistics do not describe animation progress. | |
Promise<NetworkGraphClusteringResult | null> | The current graph's communities while `clustering="louvain"` (deep copies; null when `none`). Layout, zoom and animation do not change them. | |
Promise<NetworkGraphNodeLabel[]> | the placed node labels in HOST-local CSS px as shown (the plot offset added; under a zoom the labels of the nodes outside the window are left out), shown or hidden with the reason. | |
Promise<NetworkGraphLayoutResult> | Host-local geometry as shown. Scale fields preserve ellipses under non-uniform viewport zoom. | |
| index: number | Promise<CartesianTooltipEventDetail | null> | Open a tooltip by point index: all nodes first, then links. |
Promise<void> | Close every tooltip. | |
| index: number | Promise<NetworkGraphNodeEventDetail | null> | Move the keyboard focus ring to a node (null off the nodes); emits nodeHover like the walk. |
| index: number | Promise<NetworkGraphNodeEventDetail | null> | Select (pin) a node: its neighbourhood stays highlighted after the pointer leaves; a negative or unknown index releases the selection. Emits selectionChanged when it changes. |
| index: number | Promise<NetworkGraphLinkEventDetail | null> | Select (pin) a link: its link keeps the accent after the pointer leaves; a negative or unknown index releases the selection. |
Promise<void> | Release the selection (emits selectionChanged when there was one). | |
Promise<NetworkGraphSelection> | The selection: the selected node's / link's detail (`null` = none); its anchors are Pro-derived, refused without a valid license. | |
| request: CartesianZoomRequest | Promise<CartesianZoomChangeEventDetail | null> | Zoom to explicit windows over the unit extents: `x` / `y` as `{ min, max }` or `[min, max]` (`null` clears that orientation). |
| factor: number, anchorFraction?: number | Promise<CartesianZoomChangeEventDetail | null> | Scale the current windows by `factor` (< 1 zooms in) around `anchorFraction` (0..1, default centre). |
| delta: { x?: number; y?: number } | Promise<CartesianZoomChangeEventDetail | null> | Slide the zoomed windows by unit-extent units (`{ x?, y? }`); a no-op at the full extent. |
Promise<CartesianZoomChangeEventDetail | null> | Back to the full diagram. | |
Promise<CartesianZoomState | null> | The current zoom state (`null` = the full diagram). | |
| request?: CartesianZoomExtentRequest | Promise<CartesianZoomExtentDetail | null> | The full extent (0 … 1) and key of the diagram's orientations (`null` before the first layout). |
No matching APIs.