<div style="
background: #fff;
display: grid;
height: ${screen.height / screen.width * 100}vw;
grid-template-areas: 'a b' 'a b' 'a b' 'c c';
grid-gap: 10px;
">
${cell(
htl.html`<div style="grid-area: a; border: solid 1px #ccc;">`,
({width, height}) => BarChart(alphabet, {
x: d => d.letter,
y: d => d.frequency,
xDomain: d3.groupSort(alphabet, ([d]) => -d.frequency, d => d.letter), // sort by descending frequency
yFormat: "%",
yLabel: "↑ Frequency",
width,
height,
color: "steelblue"
})
)}
${cell(
htl.html`<div style="grid-area: b; border: solid 1px #ccc;">`,
({width, height, invalidation}) => ForceGraph(miserables, {
nodeId: d => d.id,
nodeGroup: d => d.group,
nodeTitle: d => `${d.id}\n${d.group}`,
linkStrokeWidth: l => Math.sqrt(l.value),
width,
height,
invalidation // stop the simulation when the cell is re-run
})
)}
${cell(
htl.html`<div style="grid-area: c; border: solid 1px #ccc;">`,
({width, height}) => BandChart(temperatures, {
x: d => d.date,
y1: d => d.low,
y2: d => d.high,
color: "steelblue",
curve: d3.curveStep,
yLabel: "↑ Temperature (°F)",
width,
height
})
)}
</div>