Published
Edited
Sep 19, 2022
Insert cell
Insert cell
colorCell = (color) => `<div style="background-color:${color}; width: 20px">&nbsp;</div>`
Insert cell
colorCell("#33aa22")
Insert cell
Insert cell
colorsCell = (colors) => `<div style="display:flex">${colors.map(color => colorCell(color))}</div>`
Insert cell
viewof chartsTable = Inputs.table(chartsWithCustomColorsAndFlaggings, {
width: {id: "2%", slug: "15%"},
format: {
slug: (slug) => html`<a href="https://ourworldindata.org/grapher/${slug}">${slug}</a>`,
owidColors: (colors) => html`${colorsCell(colors)}`,
manualColors: (colors) => html`${colorsCell(colors)}`
}
})
Insert cell
chartsWithCustomColorsAndFlaggings = chartsWithParsedColors.map(row => ({id: row.id, slug: row.slug, owidColors: row.colors.filter(color => oldOwidDistinct.has(color)), manualColors: row.colors.filter(color => !oldOwidDistinct.has(color))}))
Insert cell
chartsWithParsedColors = chartsWithCustomColors.map(row => ({...row, colors: JSON.parse(row.colors).map(row => row.name)}))
Insert cell
owid
select
id,
slug,
regexp_matches('(?P<name>#[\da-f]{6,6})(?P<dummy>[\w"])', config) as colors
from
charts
where json_array_length(regexp_matches('(?P<name>#[\da-f]{6,6})(?P<dummy>[\w"])', config)) > 0
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