Relationship · Advanced

Network

Who is connected to whom, and who sits at the center.

Open in playground
Use when
The structure of links matters more than their amount, such as calls between services, collaboration between teams or links between documents
Avoid when
The amount moving between stages is the point (sankey, chord), the links form a tree (sunburst), or there are more than about 300 nodes

Try it

40

Network

Calls per minute between services
NetworkNetwork. 14 nodes, 24 links. Most connected: Gateway (8 connections), Payments (7), Orders (5).Mobile appWebSearchCatalogGatewayCartOrdersLogsBillingPaymentsAuthUsersNotificationsShipping
Network data
Mobile app1 connection, 36K
Web1 connection, 42K
Search2 connections, 34K
Catalog3 connections, 47K
Gateway8 connections, 180K
Cart4 connections, 38K
Orders5 connections, 46K
Logs4 connections, 15K
Billing2 connections, 9K
Payments7 connections, 41K
Auth3 connections, 56K
Users3 connections, 25K
Notifications3 connections, 10K
Shipping2 connections, 11K
Web → Gateway42K
Mobile app → Gateway36K
Gateway → Auth30K
Gateway → Catalog22K
Auth → Users20K
Gateway → Search18K
Search → Catalog16K
Gateway → Cart14K
Gateway → Orders12K
Orders ↔ PaymentsOrders→Payments 9K, Payments→Orders 3K
Cart → Orders11K
Catalog → Cart9K
Orders → Shipping8K
Payments → Billing7K
Gateway → Logs6K
Payments → Auth6K
Payments → Notifications5K
Cart → Payments4K
Payments → Logs4K
Orders → Logs3K
Payments → Users3K
Shipping → Notifications3K
Users → Notifications2K
Billing → Logs2K
Payments talks to 7 servicesAdvanced

Hover over the chart, or Tab in and use the arrow keys to move between items. The numbers are sample data.

Variants

Named looks for this chart. Each one is the example above with a few options or fields changed. The CLI (ztd-charts example network --variant <id>) and the MCP server know the same names.

Most connected first

Calls per minute between services
Sample data

Data order

Calls per minute between services
Sample data

Dots by connections

Calls per minute between services
Sample data

Code

NetworkChart.tsx
import { ChartCard, NetworkChart } from "ztd-charts";

const data = [
  {"from":"Web","to":"Gateway","calls":42},
  {"from":"Mobile app","to":"Gateway","calls":36},
  {"from":"Gateway","to":"Auth","calls":30},
  {"from":"Gateway","to":"Search","calls":18},
  {"from":"Gateway","to":"Catalog","calls":22},
  {"from":"Gateway","to":"Cart","calls":14},
  // … 19 more rows
];

export function Example() {
  return (
    <ChartCard number="40" title="Network" subtitle="Calls per minute between services" takeaway="Payments talks to 7 services" level="advanced" replay>
      <NetworkChart
        data={data}
        source="from"
        target="to"
        value="calls"
        highlight="Payments"
        unit="K"
      />
    </ChartCard>
  );
}

Props

<NetworkChart> takes these props. Rows marked Common work the same on every chart.

29 props

Prop
dataRequiredAn array of objects. Pass CSV, REST or database rows as they areobject[]
sourceRequiredSource nodestring | (d, i) => string
targetRequiredTarget nodestring | (d, i) => string
valueLink weight. Without it every row counts 1string | (d, i) => number
layoutLayout. "arc" puts the nodes on one line and draws each link as an arc above it"arc"Default "arc"
sortNode order. "auto" keeps groups (or connected parts) together and orders nodes so arcs stay short; "data" keeps the order nodes first appear in; "group" orders by group; "degree" puts the most connected node first"auto" | "data" | "group" | "degree"Default "auto"
groupsNode name to group name, such as { "Payments": "Money" }. Each group gets its own gray step and sort "auto" and "group" keep a group together. The card legend ("auto") lists the groupsobject
nodeSizeDot size: "value" is the sum of the node's link values, "degree" the number of connected nodes"value" | "degree"Default "value"
heightCommonHeight in px. Without it, each chart picks a default that fits its widthnumber
widthCommonFixed width in px. Without it, the chart fits its parentnumber
highlightCommonItem to highlight. An index, a name, an array, or "max" | "min" | "first" | "last" | "none"number | string | (number|string)[] | "max" …
formatCommonValue format. "number" | "integer" | "percent" (values are already percents: 42 → "42%") | "ratio" (0.42 → "42%") | "compact" | "currency" (KRW for Korean locales, otherwise USD; for another currency pass Intl options with currency) | "decimal" or Intl.NumberFormat options"number" | "percent" | "compact" | …
unitCommonUnit appended to values. For example "%" or "ms"string
localeCommonLocale for numbers, dates and the text a chart writes itself (tooltips, screen reader sentences). "ko" or "ko-*" switches to Korean. Falls back to the ThemeProvider localestringDefault "en-US"
animateCommonEntry and update animationbooleanDefault true
durationCommonAnimation length (ms)number
easingCommonMotion curve"spring" | "easeOut" | "easeInOut" | "linear"Default "spring"
staggerCommonDelay between items as they enter (ms)number
reducedMotionCommon"auto" follows the OS setting. true always turns motion offanyDefault "auto"
animateOnViewCommonPlay when the chart scrolls into viewbooleanDefault true
showLabelsCommonLabels drawn on the chart (values and names)booleanDefault true
tooltipCommonShow tooltips. { template: "{label} · {value} · owner {owner}" } writes them: {label}, {value}, {series} or any other column of the row. \n starts a new line, and a line with an empty value is left outtooltipDefault true
syncIdCommonCharts with the same syncId show the hovered x together (line, area, bar, candlestick). <ChartGrid sync> sets one for every chart inside itstring
ariaLabelCommonName for screen readersstring
descriptionCommonDescription for screen readers. Built from the data when omittedstring
onHoverCommonRuns when hover or keyboard focus moves to another item(e: ChartEvent | null) => void
onClickCommonRuns on click, Enter or Space(e: ChartEvent) => void
replayKeyCommonReplays the entry animation when it changesstring | number
themeCommonChanges theme tokens for this chart onlyPartial<ChartTheme>