Public
Edited
Dec 20, 2024
Insert cell
Insert cell
Insert cell
Insert cell
container ={viewof selection = CohortGrid(data, {maxCohorts})}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
csv = FileAttachment("cohorts.csv").csv({typed: true})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = processCohortData(csv)
Insert cell
Insert cell
numCohorts = d3.max(data, d => d.period_number)
Insert cell
lineChartData = data.filter(d => d.period_number > 0)
Insert cell
cyclePlotData = data.filter(d => d.period_number > 0 && d.period_number <= cyclePlotPeriodsToShow)
Insert cell
dateFormat = d3.utcFormat("%B %d, %Y")
Insert cell
pctFormat = d3.format(".1%")
Insert cell
Insert cell
import {CohortGrid, processCohortData, validationRules} from "@observablehq/cohort-grid"
Insert cell
import {Table} from "@observablehq/table-validator"
Insert cell
import {legend, swatches} from "@d3/color-legend"
Insert cell
import {toc} from "@observablehq/templates-table-of-instructions"
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