demo D166
Sankey, chord and network
Relationships between categories
type, source, target, y
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/lattice-grid.min.css">
<script src="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/lattice-grid.min.js"></script>
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; height: 210px">
<div id="sankey"></div>
<div id="chord"></div>
<div id="network"></div>
</div>
<div id="grid" style="height: 340px; margin-top: 14px"></div>
<script type="module">
import { createChart } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/modules/charts';
const grid = LatticeGrid.createGrid(document.getElementById('grid'), {
rowKey: 'id',
columns: [
{ field: 'circuit', title: 'Circuit', layout: { width: 180 } },
{ field: 'region', title: 'Region', filter: { type: 'set' } },
{ field: 'status', title: 'Status', filter: { type: 'set' } },
{ field: 'bandwidth', title: 'Bandwidth', type: 'number' },
{ field: 'charge', title: 'Monthly charge', type: 'number',
format: { style: 'currency', currency: 'GBP' }, total: 'sum' },
],
rows,
});
// Flow types read source and target columns rather than x and y.
createChart({ grid, container: '#sankey', type: 'sankey', source: 'region', target: 'status', y: 'charge' });
createChart({ grid, container: '#chord', type: 'chord', source: 'region', target: 'status', y: 'charge' });
createChart({ grid, container: '#network', type: 'network', source: 'region', target: 'status', y: 'charge' });
</script>