Public
Edited
Nov 8, 2023
Insert cell
# D3 Scale Time
Insert cell
visualizeTicks(
d3.scaleTime()
.domain([ Date.now(), Date.now() + 21 * 60 * 60 *1000])
.nice()
)
Insert cell
Insert cell
{
const scale = d3.scaleTime();
do {
const t = Date.now();
scale.domain([t - 1 * 1 * 5 * 1000, t + 1 * 1 * 5 * 1000]);
yield visualizeTicks(scale);
} while (!stop);
}
Insert cell
{
const scale = d3.scaleTime();
do {
const t = Date.now();
scale.domain([t - 1 * 1 * 1 * 1000, t + 1 * 1 * 1 * 1000]);
yield visualizeTicks(scale);
} while (!stop);
}
Insert cell
viewof stop = checkbox(["Stop if this gets too distracting"])
Insert cell
d3= require("d3@6")
Insert cell
Insert cell
import { visualizeTicks } from "@d3/continuous-scales"
Insert cell
import { checkbox } from "@jashkenas/inputs"
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