Published
Edited
Jan 5, 2022
2 stars
Insert cell
Insert cell
Insert cell
stacked = Plot.plot({
marks: [
Plot.barY(chartsByYearAndTag, {x: "year", y: "chart_count", fill: "tag_name", title: "tag_name"}),
Plot.ruleY([0])
]
})
Insert cell
chartsByYearAndTag = owid.sql`select t.name as tag_name, count(ct.chartId) as chart_count, STRFTIME('%Y', c.publishedAt) as year
from chart_tags ct
left join charts c on ct.chartId = c.id
left join tags t on t.id = ct.tagId
group by ct.tagId,
year
having ct.tagId in (select ct.tagId from chart_tags ct group by ct.tagId having count(ct.chartId) > 50)
order by year, chart_count desc`
Insert cell
owid
select ct.tagId, t.name , count(c.id) as chart_count
from chart_tags ct
left join charts c on ct.chartId = c.id
left join tags t on t.id = ct.tagId
group by ct.tagId
having chart_count > 50
order by chart_count desc
Insert cell
Insert cell
owid = new DatasetteClient(
"https://owid-datasette-y43qr.ondigitalocean.app/owid"
)
Insert cell
//Inputs.table(variables.query(`SELECT * from variables ${whereClause}`))
Insert cell
import {DatasetteClient} from "@ambassadors/datasette-client"
Insert cell
import {debounce} from "@mbostock/debouncing-input"
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