Swimlane diagram
Steps in the band of the person who does them, joined by arrows. Good for who does what, and when the work changes hands.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'swimlane',
lanes: ['Customer', 'Sales', 'Warehouse', 'Finance'],
steps: [
{ id: 'order', label: 'Places an order', lane: 'Customer', shape: 'round' },
{ id: 'check', label: 'Checks the order', lane: 'Sales' },
{ id: 'stock', label: 'In stock?', lane: 'Warehouse', shape: 'diamond' },
{ id: 'buy', label: 'Orders from supplier', lane: 'Warehouse' },
{ id: 'invoice', label: 'Sends the invoice', lane: 'Finance' },
{ id: 'ship', label: 'Ships the parcel', lane: 'Warehouse' },
{ id: 'pay', label: 'Pays', lane: 'Customer' },
{ id: 'close', label: 'Closes the order', lane: 'Sales', shape: 'round' },
],
links: [
{ from: 'order', to: 'check' },
{ from: 'check', to: 'stock' },
{ from: 'stock', to: 'buy', label: 'no' },
{ from: 'stock', to: 'ship', label: 'yes' },
{ from: 'buy', to: 'ship' },
{ from: 'ship', to: 'invoice' },
{ from: 'invoice', to: 'pay' },
{ from: 'pay', to: 'close' },
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type swimlane takes:
/** A process across the people who do it: one band per lane, steps in their lane, arrows between them. */
interface SwimlaneSpec extends Base {
type: 'swimlane';
lanes: string[];
steps: { id: string; label: string; lane: string; shape?: 'box' | 'round' | 'diamond'; color?: string }[];
links: { from: string; to: string; label?: string }[];
}Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More