3D flow
A Sankey diagram lying on a floor: blocks for the stages, thick ribbons for the flows. Good for where visitors, money or goods go, stage after stage.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
import 'nervure/3d';
const spec = {
type: 'flow3d',
links: [
{ source: 'Search', target: 'Home', value: 35 },
{ source: 'Social', target: 'Home', value: 28 },
{ source: 'E-mail', target: 'Product', value: 17 },
{ source: 'Search', target: 'Product', value: 33 },
{ source: 'Home', target: 'Product', value: 14 },
{ source: 'Home', target: 'Exit', value: 14 },
{ source: 'Product', target: 'Basket', value: 40 },
{ source: 'Product', target: 'Exit', value: 36 },
{ source: 'Basket', target: 'Order', value: 19 },
{ source: 'Basket', target: 'Exit', value: 20 },
],
};
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 flow3d takes:
/** A Sankey diagram lying on a floor: blocks for the stages, thick ribbons as wide as the flows between them. */
interface Flow3DSpec extends Base3D {
type: 'flow3d';
links: { source: string; target: string; value: number }[];
colors?: Record<string, string>;
}
interface Base3D extends Base {
/** Where the eye stands, in degrees: `azimuth` turns around the vertical axis, `elevation` rises from the floor (0) to straight above (90). */
view?: { azimuth?: number; elevation?: number };
/** Drag the chart, or focus its turn button and use the arrow keys, to turn the view. Home on the button goes back to `view`. */
rotate?: 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