Sequence diagram
Messages between actors, in order. Good for describing an exchange between programs.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'sequence',
actors: ['Browser', 'Server', 'Database'],
messages: [
{ from: 'Browser', to: 'Server', text: 'Sign in' },
{ from: 'Server', to: 'Database', text: 'Find the user' },
{ from: 'Database', to: 'Server', text: 'User', dashed: true },
{ from: 'Server', to: 'Server', text: 'Check the password' },
{ from: 'Server', to: 'Browser', text: 'Token', dashed: true },
],
};
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 sequence takes:
interface SequenceSpec extends Base {
type: 'sequence';
actors: string[];
messages: { from: string; to: string; text: string; /** An answer. */ dashed?: boolean }[];
}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