Published
Edited
Aug 6, 2020
2 forks
5 stars
Insert cell
Insert cell
Insert cell
schedule = yaml`
- 8:00 AM: Wake up
- 8:30 AM: Change
- 9:00 AM: Breakfast
- 9:30 AM: Clean up
- 9:45 AM: Read book
- 10:00 AM: Daily activity
- 10:30 AM: Walk
- 11:00 AM: Play
- 11:30 AM: Prep lunch
- 12:00 PM: Lunch
- 12:30 PM: Clean up
- 1:00 PM: Read book
- 1:30 PM: Nap
- 4:00 PM: Snack
- 5:00 PM: Prep dinner
- 6:00 PM: Dinner
- 6:30 PM: Clean up / Walk
- 7:00 PM: Bath
- 7:30 PM: Change
- 7:45 PM: Read book
- 8:00 PM: Bed
`.flatMap(Object.entries)
.map(([time, activity]) => ({time: parse(time), activity}))
Insert cell
afternoon = d => 12 < (d.time.getHours()+ d.time.getMinutes()/60)
&& (d.time.getHours()+d.time.getMinutes()/60) <= 18
Insert cell
theta = d3.scaleTime()
.domain([parse('12:00 AM'), parse('12:00 PM')])
.range([0, 2 * Math.PI])
Insert cell
now = () => parse(format(new Date()))
Insert cell
w = Math.min(width, 600)
Insert cell
h = w
Insert cell
parse = d3.timeParse('%I:%M %p')
Insert cell
format = d3.timeFormat('%I:%M %p')
Insert cell
yaml = (await import('https://cdn.skypack.dev/yaml-template@1?min')).default
Insert cell
d3 = require('d3-array@2', 'd3-scale@3', 'd3-selection@1', 'd3-shape@1', 'd3-time-format@2')
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