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()
  .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.

You must decide

The library infers

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

Continue

Series Encodings · Line-chart recipe