Published
Edited
Feb 7, 2022
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
packit(hierarchy)
Insert cell
packit = d3.pack()
.size([width - 2, height - 2]) // can I set a min circle size?
.padding(1)


Insert cell
// first, get data into hierarchical structure
hierarchy = {
let h = d3.stratify()
.id(d => d.id)
.parentId(d => d.type)
(allNodes) // parse the nodes

// then use d3.hierarchy to calculate the size of each circle

return d3.hierarchy(h).sum(d => 1) // added a value that represent the number of elements in each type
// in this case the number of signtures in the city
}
Insert cell
allNodes = {

let addedID = suffragist.map(d=>{ // Appends the id and type to the dataset
d.id = 'child'
d.type = d.consistentCityRegion
return d
})
return _.union( // @shierlys magic
[{id: 'root', type: ''}],
_.map(typeIDs, id => new Object({id, type: 'root'})),
addedID,
)
}
Insert cell
Insert cell
runonce = [false]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
baseURL+suffragist[0].sheetURL // example of entry
Insert cell
Table(suffragist)
Insert cell
Table(allNodes)
Insert cell
Insert cell
import {Table, Search} from "@observablehq/inputs"
Insert cell
d3 = require('d3@6')
Insert cell
_ = require('lodash')
Insert cell
<style>

.katex-display,p,ul,h1,h2,h3,h4,li
{
font-family: sans-serif;
}

@media (hover: hover) {
.katex-display,p,ul,h1,h2,h3,h4,li {
max-width: ${width-14}px;
min-width: ${800}px; }
}
</style>
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