Public
Edited
Jan 28
Insert cell
Insert cell
Insert cell
TimeSearcher(globalTempsByCountry, {
x: "date",
y: "AverageTemperature",
id: "Country",
width: 600,
brushesColorScale: d3.scaleOrdinal(d3.schemeGreys[3].reverse()),
selectedAlpha: 0.3,
defaultAlpha: 0.1
})
Insert cell
Insert cell
TimeSearcher(globalTempsByCountryByYear, {
x: "Year",
y: "AverageTemperature",
id: "Country",
width: 600,
selectedAlpha: 0.5,
brushesColorScale: d3.scaleOrdinal(d3.schemeGreys[3].reverse()),
defaultAlpha: 0.3
})
Insert cell
globalTempsByCountry = FileAttachment("GlobalLandTemperaturesByCountry.csv")
.csv({ typed: true })
.then((res) => {
return res.map((d) => {
d.date = new Date(d.dt);
return d;
});
})
Insert cell
globalTempsByCountryByYear = d3
.rollups(
globalTempsByCountry,
(v) => d3.mean(v, (e) => e.AverageTemperature),
(d) => d.Country,
(d) => d.date.getFullYear()
)
.map(([Country, temps]) =>
temps.map(([Year, AverageTemperature]) => ({
Country,
Year,
AverageTemperature
}))
).flat()
Insert cell
Inputs.table(globalTempsByCountry)
Insert cell
globalTempsByCountry[0].date.getFullYear()
Insert cell
TimeSearcher = require("time-searcher-plus")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more