Published
Edited
Jul 7, 2020
Fork of LOCAL 2019
Insert cell
Insert cell
chart = {
const root = tree(data);
const svg = d3.create("svg")
.style("max-width", "100%")
.style("height", "auto")
.style("font", "36px sans-serif")
.style("margin", "5px");

const link = svg.append("g")
.attr("fill", "none")
.attr("stroke", "#000")
//.attr("stroke", data.value)
.attr("stroke-opacity", 0.4)
.attr("stroke-width", 3.5)
.selectAll("path")
.data(root.links())
.join("path")
.attr("d", d3.linkRadial()
.angle(d => d.x)
.radius(d => d.y));
const node = svg.append("g")
.attr("stroke-linejoin", "round")
.attr("stroke-width", 3)
.selectAll("g")
.data(root.descendants().reverse())
.join("g")
.attr("transform", d => `
rotate(${d.x * 180 / Math.PI - 90})
translate(${d.y},0)
`);
node.append("circle")
.attr("fill", d => d.children ? "#555" : "#999")
.attr("r", 2.5);
node.append("text")
.attr("dy", "0.31em")
.attr("x", d => d.x < Math.PI === !d.children ? 6 : -6)
.attr("text-anchor", d => d.x < Math.PI === !d.children ? "start" : "end")
.attr("transform", d => d.x >= Math.PI ? "rotate(180)" : null)
.text(d => d.data.name)
.clone(true).lower()
.attr("stroke", "white");

yield svg.node();

svg.attr("viewBox", autoBox);
}
Insert cell
function autoBox() {
const {x, y, width, height} = this.getBBox();
return [x, y, width, height];
}
Insert cell
data = ( {"name": "GRAFIKSKOLEN", "children": [
{"name": "Online", "children": [
{"name": "English Homepage", "value": 3938},
{"name": "Open Processing", "value": 3938},
{"name": "Codepen + p5 + trinckets", "value": 3938},
{"name": "Pocket-tags-Wordpress", "value": 3938}
]},
{"name": "Pattern", "children": [
{"name": "Tegne med Passer", "value": 3938},
{"name": "Taprats + open source", "value": 3938},
{"name": "p5.js", "value": 3938},
{"name": "Python + Turtle", "value": 3938},
{"name": "Det Gyldne Snit LegoLineal", "value": 3938},
{"name": "Geometri", "value": 3938}
]},
{"name": "Draw", "children": [
{"name": "Edwards", "value": 3938},
{"name": "Goldstein", "value": 3938},
{"name": "Live Drawing", "value": 3938},
{"name": "Poser et al", "value": 3938},
{"name": "Draw-a-Goat", "value": 3938},
{"name": "Procreate-Painter et al", "value": 3938}
]},
{"name": "Digital", "children": [
{"name": "Raster", "value": 3938},
{"name": "Bitmap", "value": 3938},
{"name": "Retouch", "value": 3938},
{"name": "Displacements", "value": 3938},
{"name": "Kincect Ecke", "value": 3938},
{"name": "Portrait", "value": 3938}
]},
{"name": "Inspiration", "children": [
{"name": "Tumblr", "value": 3938},
{"name": "Pinterest", "value": 3938},
{"name": "Books", "value": 3938}
]},
{"name": "Crea-Boost", "children": [
{"name": "Boost", "value": 3938},
{"name": "TeknikTombola", "value": 3938},
{"name": "impro tools", "value": 3938}
]},
{"name": "Laser", "children": [
{"name": "Stencils", "value": 3938},
{"name": "Etching", "value": 3938}
]},
{"name": "Random Chaos ", "children": [
{"name": "how Processing", "value": 3938},
{"name": "Chaos Rules", "value": 3938}
]},
{"name": "Object Trouve", "children": [
{"name": "Beach", "value": 3938},
{"name": "Human Debris", "value": 3938},
{"name": "Collage", "value": 3938}
]},
{"name": "Natur", "children": [
{"name": "Phyllotaxis", "value": 3938},
{"name": "Fibonacci", "value": 3938},
{"name": "L systems", "value": 3938},
{"name": "Lego-strukturer", "value": 3938},
{"name": "Blender", "value": 3938}
]},
{"name": "Redskabskassen", "children": [
{"name": "Posivtiv Resist", "value": 3938},
{"name": "Waterless/Muco lito", "value": 3938},
{"name": "Plastic Plate Engrave", "value": 3938},
{"name": "Paptryk", "value": 3938},
{"name": "Silketryk", "value": 3938},
{"name": "Cyanotypi", "value": 3938},
{"name": "'Jako-transfer'", "value": 3938},
{"name": "LaserTransfer", "value": 3938}
]}
]})
Insert cell
tree = data => d3.tree()
.size([2 * Math.PI, radius])
.separation((a, b) => (a.parent == b.parent ? 1 : 2) / a.depth)
(d3.hierarchy(data))
Insert cell
width = 2500
Insert cell
radius = width / 2
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