Relationship · Advanced
Network
Who is connected to whom, and who sits at the center.
- 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
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
Data order
Calls per minute between services
Dots by connections
Calls per minute between services
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> |
Also in Relationship
- HeatmapValues where two categories meet, shown as color depth
- Bubble chartThree values at once: x, y and size. Without size it is a scatter plot
- Parallel coordinatesSeveral numeric metrics, each on its own axis, compared as one line per row
- Scatter plotHow two numbers relate, one dot per item, colored by series