Published
Edited
Jun 13, 2019
Insert cell
Insert cell
Insert cell
graph = {
const graph = layout(exports);
graph.nodes.forEach((node) => {
node.color = color(node.index / graph.nodes.length);
});
graph.links.forEach((link) => {
link.gradient = DOM.uid("gradient");
link.path = DOM.uid("path");
});
return graph;
}
Insert cell
Insert cell
format = (value) => {
let f = d3.format(",.0f");
return f(value) + " (£M)";
}
Insert cell
color = (value) => {
return d3.interpolateRainbow(value);
}
Insert cell
Insert cell
size = [width - 2 * margin, height - 2 * margin]
Insert cell
height = 600
Insert cell
margin = 10
Insert cell
nodeWidth = 20
Insert cell
nodePadding = 10
Insert cell
duration = 250
Insert cell
arrow = "\u2192"
Insert cell
Insert cell
sankey = require("d3-sankey@0.12")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more