Public
Edited
Fork of Waffle Chart
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
toCurrency = num => d3.format("$,.2f")(num)
Insert cell
color = d3.scaleOrdinal(d3.schemeTableau10)
.domain(sequence(chartData.length))
Insert cell
scale = d3.scaleBand()
.domain(sequence(10))
.range([0, waffleSize])
.padding(0.1)
Insert cell
sequence = (length) => Array.apply(null, {length: length}).map((d, i) => i);
Insert cell
whole = options.style === "whole"
Insert cell
isRect = options.shape === "rect"
Insert cell
Insert cell
Insert cell
width = 1024
Insert cell
height = 600
Insert cell
padding = ({x: 10, y: 40})
Insert cell
waffleSize = whole ? width < height ? width : height : 150;
Insert cell
import {form} from "@mbostock/form-input"
Insert cell
d3 = require("d3@6")
Insert cell
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