Published
Edited
Oct 22, 2021
Insert cell
Insert cell
Insert cell
md`# MEP Schematics Series

One of a series of experiments in automatic layout of MEP schematics diagrams of a simple building air supply system.

See also:
- [mep-air-handling-force-directed-graph](https://observablehq.com/@lacunae/mep-air-handling-force-directed-graph)
- [mep-schematics-cluster-dendrogram](https://observablehq.com/@lacunae/mep-schematics-cluster-dendrogram)
- [mep-schematics tidy-tree](https://observablehq.com/@lacunae/tidy-tree)
- [mep-schematics-radial-tidy-tree](https://observablehq.com/@lacunae/mep-schematics-radial-tidy-tree)
- [mep-schematics-radial-tidy-tree](https://observablehq.com/@lacunae/mep-schematics-tree-of-life)`
Insert cell
data = FileAttachment("dGraph1.json").json()
Insert cell
height = 600
Insert cell
color = {
const scale = d3.scaleOrdinal(d3.schemeCategory10);
return d => scale(d.group);
}
Insert cell
drag = simulation => {
function dragstarted(d) {
if (!d3.event.active) simulation.alphaTarget(0.3).restart();
d.fx = d.x;
d.fy = d.y;
}
function dragged(d) {
d.fx = d3.event.x;
d.fy = d3.event.y;
}
function dragended(d) {
if (!d3.event.active) simulation.alphaTarget(0);
d.fx = null;
d.fy = null;
}
return d3.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended);
}
Insert cell
d3 = require("d3@5")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more