Public
Edited
Jun 10, 2023
Insert cell
Insert cell
viewof bins = Inputs.range([3, 20], {step: 1, label: "Bins"})
Insert cell
Insert cell
// Extract the desired information from each timestamp
data = vitosha.map((d) => {
const tzdate = Temporal.Instant.from(d.time).toZonedDateTimeISO(
"Central European Standard Time"
); // date in localized timezone
const hour = tzdate.hour;

return {
hour,
};
})
Insert cell
Insert cell
vitosha = g3.sheet(0, { headers: true })
Insert cell
Insert cell
Insert cell
viewof nbins = Inputs.range([1, 23], {label: "number of bins", step: 1})
Insert cell
Plot.plot({
marks: [
Plot.rectY(vitosha, Plot.binX({y: "count"}, {x: "time", thresholds: nbins,
title: "time", fill: "gender"})),
Plot.ruleY([0])
]
})

Insert cell
import {Plot} from "@mkfreeman/plot-tooltip"
Insert cell
// Load the Temporal API using a Polyfill
Temporal = {
const TemporalLib = await require("@js-temporal/polyfill@0.3.0")
return TemporalLib.Temporal
}
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