Skip to content

Ribbon Area ​

The stacked area of the unemployed by industry, with each date's stack sorted by value by cm.stackY, so that the bands swap places. After Observable Plot.

js
const data = await d3.csv("/data/bls-industry-unemployment.csv", d3.autoType);

const renderer = cm.svg({width: 640, height: 400});
const root = cm.flow().renderer(renderer);

root
  .data(data)
  .transform(cm.encode, {x: "date", y: "unemployed", fill: "industry"})
  .transform(cm.stackY, {order: "value"})
  .transform(cm.plane, {y: {grid: true}})
  .add(cm.areaY);

root.render();
document.body.append(renderer.node());