Published
Edited
Jun 22, 2022
38 forks
Importers
Comments locked
14 stars
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
movies
Insert cell
flowers = {
// movie genre → `color` (color of petals)
// array of top genres: `topGenres`
// array of colors to map to: `petalColors`
// `rated` → `path` (type of flower petal)
// array to map to: `petalPaths`
// `rating` → `scale` (size of petals)
// `votes` → `numPetals` (number of petals)
return _.map(movies, (d, i) => {
return {
title: d.title,
translate: calculateGridPos(i), // util function that returns [x, y]
}
})
}
Insert cell
{
const svg = html`<svg width=${width} height=${svgHeight}></svg>`
d3.select(svg).selectAll('path')
.data(flowers).enter().append('path')
.attr('transform', (d, i) => `translate(${d.translate})scale(${d.scale || 1})`)
.attr('d', d => d.path)
.attr('fill', d => d.color)
.attr('fill-opacity', 0.75)
.attr('stroke', d => d.color)
return scrollSVG(svg)
}
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
Insert cell
Insert cell
_.keys({a:1, b:2, c:3})
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more