Published
Edited
Oct 18, 2021
3 forks
Insert cell
Insert cell
chart
Insert cell
data = Object.assign(
await splitgraph`SELECT country_of_import AS key, sum(COALESCE(commodity_deforestation, 0)) AS value
FROM "trase/supply-chains"."supply-chains"
WHERE scale = 'SUBNATIONAL'
AND country_of_production = 'INDONESIA'
AND commodity = 'PALM OIL'
AND year = '2015'
AND economic_bloc = 'EUROPEAN UNION'
GROUP BY country_of_import
ORDER BY value DESC`.then(res =>
res.map(d => ({ ...d, key: titleCase(d.key) }))
),
{ x: "Palm oil deforestation risk" }
)
Insert cell
margin = ({top: 30, right: 20, bottom: 20, left: 140})
Insert cell
import { splitgraph } from "@trase/splitgraph"
Insert cell
import { titleCase } from "@trase/visual-id"
Insert cell
import { chart } with { data, margin } from "@trase/horizontal-bar-chart@979"
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