Published
Edited
Feb 8, 2021
1 fork
Importers
Insert cell
Insert cell
chart
Insert cell
import { chart } with { data, partition, color } from "966f4cd6ed3d1e45"
Insert cell
color = d3
.scaleOrdinal(d3.quantize(d3.interpolateRainbow, alphabet.length + 1))
.domain(
// set color domain to alphabet
alphabet.map((c, i) => {
let node = data.children.find(d => d.name.startsWith(c)); // colors set based on inner ring
if (node) {
// if inner ring has a multi letter prefix use that prefix
return node.name; // happens often with qu
}
return c;
})
)
Insert cell
alphabet = [...'abcdefghijklmnopqrstuvwxyz']
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
randomWords = getRandomSubarray(words, 10000)
Insert cell
Insert cell
words = FileAttachment("scrabble-words.txt")
.text()
.then(text => text.split(/\n/).map(word => word.toLocaleLowerCase()))
Insert cell
algos = require('typescript-algos')
Insert cell
d3 = require("d3@6")
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