Published-release documentation · release compatibility

Path Ordering Recipe

Three chronological country trajectories through fertility and life expectancy space
One explicit year order controls each country's path topology.

Minimal flow

Runnable: install ggaction and provide the named data array as plain row objects.

import { chart } from "ggaction";

const program = chart()
  .createCanvas({ margin: { top: 60, right: 180, bottom: 70, left: 70 } })
  .createData({ values: observations })
  .createLineMark()
  .encodeX({ field: "fertility" })
  .encodeY({ field: "life_expect" })
  .encodeColor({ field: "country" })
  .encodePathOrder({ field: "year", order: "ascending" })
  .createGuides();

observations is an array of plain row objects. Source rows may be shuffled; the order field controls vertices independently inside each color/group series. Each row has finite fertility, life_expect, and year, plus a non-empty country. Provide several years per country. The explicit right margin is for the country legend; longer names may require a wider margin.

You must decide

The library infers

Use removePathOrder() to return to the line’s automatic topology.

Continue

Series Encodings · Line-chart recipe

Documentation provenance

293 actions · sha256:e755591a2e5f5e2b494867583876e28020a478c5220b77bdc6ad469a6224891d