Public
Edited
Jan 9, 2023
Insert cell
Insert cell
// Access the API and retrieve the data for South Africa

// Process the data to extract the number of infections
const infections = data.map(d => d.Confirmed);

// Use D3 to create a bar chart of the infections
const svg = d3.select('svg');

svg.selectAll('rect')
.data(infections)
.enter()
.append('rect')
.attr('x', (d, i) => i * 10)
.attr('y', d => 500 - d)
.attr('width', 10)
.attr('height', d => d)
.attr('fill', 'steelblue');

Insert cell
apiUrl = 'https://api.covid19api.com/country/south-africa'
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