Relationship Graph

Pro

A network of nodes and links in two layouts — a deterministic force layout and a chord diagram — with neighbour highlighting, one-tab-stop keyboard roving and a link table. In-house layouts, no dependencies. Pure SVG.

</>sv-relationship-graph chartnetworkgraphchordrelationships
import { SvRelationshipGraphComponent } from '@styloviz-pro/charts/relationship-graph';

Demo & usage

Basic usage

Pro

Usage example — open the gallery for the full interactive demo.

Pro

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Chord layout

Pro

Select a node

Pro

Async states

Pro

When to use

  • Who connects to whom: service dependencies, team collaboration, referral networks.
  • Chord: the volume between a handful of groups, in both directions.
  • For flow through ordered stages (budget → department → line), use a Sankey.

Async states

  • loading
  • empty
  • error
  • retry

Inputs

NameTypeDefaultDescription
loadingbooleanfalseTrue while the graph is being fetched.
errorSvDataError | string | nullnullLoad failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessagestring'No data to plot'Copy for the no-data state.
filteredbooleanfalseTrue when the emptiness is caused by a filter rather than an empty set.
nodesreadonly SvGraphNode[][]Nodes: `{ id, label, group?, value? }`.
linksreadonly SvGraphLink[][]Relationships: `{ source, target, value?, label? }`. A missing value means 1.
layoutSvRelationshipGraphLayout'force'`'force'` (deterministic force-directed) or `'chord'` (arcs and ribbons).
widthnumber560Drawing width in SVG units; the SVG scales to its container.
heightnumber360Drawing height in pixels.
titlestring''Chart title rendered above the drawing.
ariaLabelstring''Accessible name override. Falls back to a generated summary.
customClassstring''Extra CSS classes applied to the root wrapper.
localestringsvLocale()BCP 47 locale for numbers and plural forms.

Outputs

EventPayload typeDescription
retryvoidThe host should re-run the failed load.
nodeSelectSvGraphNodeSelectEventEmitted when a node is clicked or activated with Enter/Space: the node and its neighbours.

Wire it to your API

This component is headless about transport: it renders what you give it and reports what the user asks for. Nothing below requires @styloviz/data — drive it from whatever you already use.

Template

Pro

Bound to the names this component actually exposes.

Host class

Pro

Drive the three async inputs from your own fetch.

  • This component does not emit a query, so it renders what you give it. Call `load()` on your own trigger and bind `nodes`, `loading` and `error`.
  • Set `filtered` when a search or filter is active. It is the difference between "you have no orders" and "no orders match this filter" — telling a customer with 4,000 orders the first one reads as a bug.
  • Normalize failures with `toSvDataError()` from `@styloviz/core`. It derives `retryable` from the status, so a 404 does not get a "Try again" button that can only fail again.

Full walkthrough: Connecting to a backend.

Customization & theming

  • `layout`: `force` (default) or `chord`.
  • Node size from `value` (square-root scale); link width from `value` (a missing value counts as 1).
  • `width` / `height` of the drawing.
  • Links to unknown nodes, self-links and NaN, negative or zero values are left out and named in a notice under the plot.

Best practices

  • Do: Group nodes (`group`) — the legend and the chord layout both read it, and the colour is backed by the group name in every node’s label.
  • Do: Keep it to tens of nodes. Past ~150 the force layout still runs (about 45 ms) but the picture stops being readable; filter first.
  • Don't: Rely on a link to an id you did not send — it is dropped and named under the plot, never drawn to nowhere.
  • Tip: The same input always draws the same picture, so server-rendered and browser views agree and screenshots are stable.

Accessibility

  • One tab stop; arrow keys move between nodes in label order, Home/End to the ends, Enter or Space emits `nodeSelect`, Escape clears the highlight. A hidden hint says so.
  • Each node is named with its group and its connections: “Chen, Engineering: 3 connections — Ana, Dev, Eli”.
  • Hover or focus dims everything but the node, its links and its neighbours — opacity only, no motion under reduced-motion.
  • The data table lists every drawn link (“Source → Target”, value, relationship), and the chart a11y module can put it on screen.

Feedback on Relationship Graph

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.