Public
Edited
May 19, 2023
1 star
Insert cell
Insert cell
// usando el archivo adjunto
mc1 = FileAttachment("MC1.json").json()
Insert cell
Insert cell
mc1.nodes
Insert cell
mc1.links
Insert cell
node_tbl = mc1.nodes
Insert cell
node_tbl
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
nodos_filtrados = mc1.nodes.filter((d) => d.id == eai)
Insert cell
Insert cell
id_eai = nodos_filtrados.map((d) => d.id)
Insert cell
only_sources = links_filtrados.map((d) => d.source)
Insert cell
only_targets = links_filtrados.map((d) => d.target)
Insert cell
function getType(s) {
return mc1.nodes.filter((d) => d.id == s).map((d) => d.type)[0];
}
Insert cell
[...d3.union(id_eai, only_sources, only_targets)].map((d) => ({
id: d,
type: getType(d)
}))
Insert cell
Inputs.table(mc1.links)
Insert cell
import { ForceGraph } from "@d3/force-directed-graph"
Insert cell
import { Swatches } from "@d3/color-legend"
Insert cell
grafo_a_dibujar = ({
nodes: [...d3.union(id_eai, only_sources, only_targets)].map((d) => ({
id: d,
type: getType(d)
})),
links: links_filtrados
})
Insert cell
// import { Plot } from "@observablehq/plot-0-6-7"
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