Skip to content

Columns in the Terminal ​

The catch of six lakes as columns of # cells, drawn by the vis layer on the terminal renderer in pixel units. The bands are snapped to whole cells, so every column is as wide as the others, with a gap of a cell between them.

js
const seafood = await d3.csv("/data/seafood.csv", d3.autoType);

const renderer = cm.terminal({width: 640, height: 400, units: "pixels"});
const root = cm.flow().renderer(renderer);

root
  .data(seafood)
  .transform(cm.encode, {x: "lake", y: "count"})
  .transform(cm.groupX, {y: "sum"})
  .transform(cm.spreadX)
  .transform(cm.plane)
  .add(cm.rect, {fill: "cell(#, steelblue)"});

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