Published
Edited
Jul 8, 2020
3 forks
Insert cell
md`# Sankey with filter`
Insert cell
// Anche qui: come si fa la transizione?
Insert cell
viewof dd1 = select({
title: "Dimmi da dove vieni e ti dirò dove vai.",
description: "Scegli la città che preferisci.",
options: d3.map(input, function(d){return d.provincia;}).keys(),
value: "Milano"
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
md`# Import`
Insert cell
input = d3.csv(sankey_csv, d3.autoType)
Insert cell
data = {
const links = Fdata;
const nodes = Array.from(new Set(links.flatMap(l => [l.source, l.target])), name => ({name}));
return {nodes, links};
}
Insert cell
Fdata = input.filter(d => d.provincia === dd1)
Insert cell
sankey_csv = 'https://raw.githubusercontent.com/JohnPFL/ciao/master/sankey_pr_3.csv'
Insert cell
import { select } from "@jashkenas/inputs"
Insert cell
width = 954
Insert cell
height = 600
Insert cell
d3 = require("d3@5", "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