Public
Edited
Jan 25, 2023
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
selectedYears = ["2000", "2021"]// selectedYears = ["2000", selectedYear]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//name = () => d => d.ancestors().reverse().map(d => d.data.ptTitle).join("/")
Insert cell
Insert cell
truncate = function (longString) {
if(!longString) return ''
return longString//.slice(0,17) + '...'
}
Insert cell
Insert cell
Insert cell
Insert cell
viewof checkboxCommodities = Inputs.checkbox(commodities.map((c) => c.text), {label: "Select some", value: ["01 - Animals; live"]})
Insert cell
Insert cell
countryList = d3.json('https://raw.githubusercontent.com/cameronkruse/food-security/main/pages/assets/reporting_areas.json')
Insert cell
// this returns the id of the text value chosen for countries
countryCode = Object.values(countryList.results)
.filter((item) => item.text == countrySelect)
.map((item) => item.id)
Insert cell
commodityColorScale = d3.scaleOrdinal()
.range(colorRange)
.domain(colorDomain)
Insert cell
Insert cell
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