Skip to content

Line in the Terminal ​

Apple's daily close as a line on the terminal renderer. A column holds about twelve days, so the line is drawn one cell per column, at their mean, with characters that follow its slope.

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

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

root
  .data(aapl)
  .transform(cm.encode, {x: "Date", y: "Close"})
  .transform(cm.plane, {y: {grid: true}})
  .add(cm.lineY);

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