Published
Edited
Apr 15, 2020
Insert cell
Insert cell
projection = {
const p = d3
.geoAlbersUsa()
.fitExtent([[0, 0], [gifWidth, gifHeight]], nation);

return p;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
imageData = {
const height = gifHeight;
const width = gifWidth;
const canvas = DOM.element('canvas');
const context = canvas.getContext('2d');

const image = await gif.image();

d3.select(canvas)
.attr('height', height)
.attr('width', width);

context.drawImage(image, 0, 0, width, height);
const imageData = context.getImageData(0, 0, width, height);

// return canvas;
return imageData.data;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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