Skip to content
OpenChart

Time-lapse map

Play a choropleth, tile map or symbol layer through periods, with one color scale and legend held for the whole run.

A time-lapse map recolors its regions, or resizes its symbols, one period at a time. Use it to show where a change spread, such as unemployment claims rising across the states in 2020. A line chart compares one state’s path with another’s more precisely, because it shows every period at once.

Insured unemployment rose tenfold by July 2020, theneasedInsured unemployment rate by state, 13-week average, every other week through 20205.010.015.020.0Insured unemployment rate (%)Insured unemployment rose tenfold by July 2020, theneasedInsured unemployment rate by state, 13-week average, every other week through 20205.010.015.020.0Insured unemployment rate (%)
The average state went from 1.1% in the first week of January to 12.0% in the week ending July 4. Source: U.S. Department of Labor, weekly unemployment insurance claims; geography: US Census Bureau via us-atlas.
{
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 181 arcs; Copy includes it */},
    "projection": "albersUsa",
    "idField": "name"
  },
  "data": [
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-01-04",
      "rate": 2.64
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-01-18",
      "rate": 2.83
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-02-01",
      "rate": 2.96
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-02-15",
      "rate": 3.02
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-02-29",
      "rate": 3
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-03-14",
      "rate": 2.97
    },
    // … 1,320 more rows; Copy includes them
  ],
  "encoding": {
    "key": {
      "field": "state",
      "type": "nominal"
    },
    "color": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Insured unemployment rose tenfold by July 2020, then eased",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
}
import { GeoMap } from "@opendata-ai/openchart-react";
import type { GeoMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 1,326 rows; Copy includes them */];

const spec: GeoMapSpec = {
  data,
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 181 arcs; Copy includes it */},
    "projection": "albersUsa",
    "idField": "name"
  },
  "encoding": {
    "key": {
      "field": "state",
      "type": "nominal"
    },
    "color": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Insured unemployment rose tenfold by July 2020, then eased",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
};

export function Example() {
  return <GeoMap spec={spec} />;
}
<script setup lang="ts">
import { GeoMap } from "@opendata-ai/openchart-vue";
import type { GeoMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 1,326 rows; Copy includes them */];

const spec: GeoMapSpec = {
  data,
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 181 arcs; Copy includes it */},
    "projection": "albersUsa",
    "idField": "name"
  },
  "encoding": {
    "key": {
      "field": "state",
      "type": "nominal"
    },
    "color": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Insured unemployment rose tenfold by July 2020, then eased",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
};
</script>

<template>
  <GeoMap :spec="spec" />
</template>
<script lang="ts">
import { GeoMap } from "@opendata-ai/openchart-svelte";
import type { GeoMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 1,326 rows; Copy includes them */];

const spec: GeoMapSpec = {
  data,
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 181 arcs; Copy includes it */},
    "projection": "albersUsa",
    "idField": "name"
  },
  "encoding": {
    "key": {
      "field": "state",
      "type": "nominal"
    },
    "color": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Insured unemployment rose tenfold by July 2020, then eased",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
};
</script>

<GeoMap {spec} />
import { createGeoMap } from "@opendata-ai/openchart-vanilla";
import type { GeoMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 1,326 rows; Copy includes them */];

const spec: GeoMapSpec = {
  data,
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 181 arcs; Copy includes it */},
    "projection": "albersUsa",
    "idField": "name"
  },
  "encoding": {
    "key": {
      "field": "state",
      "type": "nominal"
    },
    "color": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Insured unemployment rose tenfold by July 2020, then eased",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createGeoMap(container, spec);

Add time to a choropleth

A time-lapse choropleth is a choropleth with encoding.time naming the period field. Supply one row per region and period. encoding.key joins each row to a feature, as it does without time, and also identifies each region from one period to the next.

claims-map.ts
import states from "us-atlas/states-10m.json";

const spec = {
  type: "map",
  geo: { features: states, projection: "albersUsa", idField: "name" },
  data: rows, // [{ state: "Michigan", code: "MI", week: "2020-04-04", rate: 3.58 }, ...]
  encoding: {
    key: { field: "state", type: "nominal" },
    color: { field: "rate", type: "quantitative", title: "Insured unemployment rate (%)", format: ".1f" },
    time: { field: "week", type: "temporal" },
  },
  playback: { duration: 20000, period: { format: "%b %Y" } },
};

encoding.color must be quantitative, because playback recolors each region by its value in every period. Two rows with the same key and period fail validation and ask you to aggregate them. The playback block sets timing and controls, and the playback page lists every option. labels and trails draw only on point charts, so a map rejects them.

One color scale for the whole run

The classes and the legend are computed once over every period, so a color means the same value in January as in July. This map’s five classes break at 5, 10, 15 and 20 percent, chosen from the whole year’s values. A tile map’s gradient legend runs from the lowest value of any period to the highest in the same way.

Between two periods each region’s value moves in a straight line, and its fill is the class of that value. A region changes color when its value crosses a class break, which can happen partway between two periods. On a tile map the shade changes continuously with the value.

Regions with no value

A gap between two periods with values is filled in by default, so the region keeps a color through it. playback.gaps: "drop" leaves the gap empty, so the region takes the no-data fill for those periods, and "hold" repeats the last value.

Before its first value and after its last, a region shows the no-data fill. The fill switches a quarter of the way into the interval after its last value, and three quarters of the way into the interval before its first.

When any region lacks a value in any period, the legend shows its “No data” swatch for the whole run. A region with no rows in any period keeps the no-data fill throughout, as it would on a static map.

The period label

The large faint label in a corner shows the current period. With position: "auto", the default on maps, it takes the corner where it covers the least geography, trying the lower left first. Alaska and Hawaii fill part of the lower left on a US map, so the label often lands in another corner. The corner is chosen once for the run and fits the widest period text, so the label never moves during playback. period.format changes its date format, and period: false hides it.

Tile maps

Every state ended 2020 with a higher rate than it startedwithInsured unemployment rate by state, 13-week average, every other week through 2020ME2.4VT4.1NH3.7WA5.0ID1.2MT3.5ND1.8MN4.3WI3.4MI5.1NY5.5MA6.2OR4.7NV7.9WY2.1SD1.0IA2.6IL6.1IN3.0OH3.1PA5.8NJ4.5CT5.4CA8.3UT1.1CO3.7NE1.4MO1.9KY3.0WV3.5VA2.6MD4.1DE3.4RI3.8AZ3.6NM6.5KS3.0AR2.1TN2.0NC2.0SC2.5DC6.2AK6.4OK3.7LA5.6MS3.6AL1.4GA6.2HI9.0TX4.2FL2.40.323.1Every state ended 2020 with a higher rate than it startedwithInsured unemployment rate by state, 13-week average, every other week through 2020ME2.4VT4.1NH3.7WA5.0ID1.2MT3.5ND1.8MN4.3WI3.4MI5.1NY5.5MA6.2OR4.7NV7.9WY2.1SD1.0IA2.6IL6.1IN3.0OH3.1PA5.8NJ4.5CT5.4CA8.3UT1.1CO3.7NE1.4MO1.9KY3.0WV3.5VA2.6MD4.1DE3.4RI3.8AZ3.6NM6.5KS3.0AR2.1TN2.0NC2.0SC2.5DC6.2AK6.4OK3.7LA5.6MS3.6AL1.4GA6.2HI9.0TX4.2FL2.40.323.1
Nevada peaked highest, at 23.1% in the week ending August 1. Source: U.S. Department of Labor, weekly unemployment insurance claims.
{
  "type": "tilemap",
  "data": [
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-01-04",
      "rate": 2.64
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-01-18",
      "rate": 2.83
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-02-01",
      "rate": 2.96
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-02-15",
      "rate": 3.02
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-02-29",
      "rate": 3
    },
    {
      "state": "Alaska",
      "code": "AK",
      "week": "2020-03-14",
      "rate": 2.97
    },
    // … 1,320 more rows; Copy includes them
  ],
  "encoding": {
    "state": {
      "field": "code",
      "type": "nominal"
    },
    "value": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Every state ended 2020 with a higher rate than it started with",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
}
import { TileMap } from "@opendata-ai/openchart-react";
import type { TileMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 1,326 rows; Copy includes them */];

const spec: TileMapSpec = {
  data,
  "type": "tilemap",
  "encoding": {
    "state": {
      "field": "code",
      "type": "nominal"
    },
    "value": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Every state ended 2020 with a higher rate than it started with",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
};

export function Example() {
  return <TileMap spec={spec} />;
}
<script setup lang="ts">
import { TileMap } from "@opendata-ai/openchart-vue";
import type { TileMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 1,326 rows; Copy includes them */];

const spec: TileMapSpec = {
  data,
  "type": "tilemap",
  "encoding": {
    "state": {
      "field": "code",
      "type": "nominal"
    },
    "value": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Every state ended 2020 with a higher rate than it started with",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
};
</script>

<template>
  <TileMap :spec="spec" />
</template>
<script lang="ts">
import { TileMap } from "@opendata-ai/openchart-svelte";
import type { TileMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 1,326 rows; Copy includes them */];

const spec: TileMapSpec = {
  data,
  "type": "tilemap",
  "encoding": {
    "state": {
      "field": "code",
      "type": "nominal"
    },
    "value": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Every state ended 2020 with a higher rate than it started with",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
};
</script>

<TileMap {spec} />
import { createTileMap } from "@opendata-ai/openchart-vanilla";
import type { TileMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 1,326 rows; Copy includes them */];

const spec: TileMapSpec = {
  data,
  "type": "tilemap",
  "encoding": {
    "state": {
      "field": "code",
      "type": "nominal"
    },
    "value": {
      "field": "rate",
      "type": "quantitative",
      "title": "Insured unemployment rate (%)",
      "format": ".1f"
    },
    "time": {
      "field": "week",
      "type": "temporal"
    }
  },
  "playback": {
    "duration": 20000,
    "period": {
      "format": "%b %Y"
    }
  },
  "chrome": {
    "title": "Every state ended 2020 with a higher rate than it started with",
    "subtitle": "Insured unemployment rate by state, 13-week average, every other week through 2020"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createTileMap(container, spec);

A tile map with time takes data as rows, not a record of state codes, and encoding.state is the identity: one row per state code and period. encoding.value must be quantitative, and colors or encoding.color is an error, since playback shades each tile by its value. Each tile’s printed value updates with its shade.

Symbols over time

GDP of twenty large economies, 1980 to 2024. This chart is drawn in the browser.

Russia enters in 1988, the first year the data has a value for it. Source: World Bank, GDP (current US$); geography: Natural Earth via world-atlas.
{
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 182 arcs; Copy includes it */},
    "projection": "equalEarth"
  },
  "data": [],
  "encoding": {
    "key": {
      "field": "id",
      "type": "nominal"
    }
  },
  "points": {
    "data": [
      {
        "country": "Argentina",
        "year": 1980,
        "gdp": 77,
        "lon": -64.7,
        "lat": -34.53
      },
      {
        "country": "Argentina",
        "year": 1982,
        "gdp": 84,
        "lon": -64.7,
        "lat": -34.53
      },
      {
        "country": "Argentina",
        "year": 1984,
        "gdp": 117,
        "lon": -64.7,
        "lat": -34.53
      },
      {
        "country": "Argentina",
        "year": 1986,
        "gdp": 106,
        "lon": -64.7,
        "lat": -34.53
      },
      {
        "country": "Argentina",
        "year": 1988,
        "gdp": 127,
        "lon": -64.7,
        "lat": -34.53
      },
      {
        "country": "Argentina",
        "year": 1990,
        "gdp": 141,
        "lon": -64.7,
        "lat": -34.53
      },
      // … 450 more rows; Copy includes them
    ],
    "longitude": {
      "field": "lon",
      "type": "quantitative"
    },
    "latitude": {
      "field": "lat",
      "type": "quantitative"
    },
    "size": {
      "field": "gdp",
      "type": "quantitative",
      "title": "GDP ($ billions)"
    },
    "key": {
      "field": "country",
      "type": "nominal"
    },
    "time": {
      "field": "year",
      "type": "temporal"
    },
    "tooltip": [
      {
        "field": "country",
        "type": "nominal",
        "title": "Country"
      },
      {
        "field": "gdp",
        "type": "quantitative",
        "title": "GDP ($ billions)",
        "format": ",.0f"
      }
    ]
  },
  "playback": {
    "duration": 15000
  },
  "chrome": {
    "title": "China's economy grew from smaller than Spain's to second largest",
    "subtitle": "GDP of twenty large economies, current US$ billions, every other year from 1980 to 2024"
  }
}
import { GeoMap } from "@opendata-ai/openchart-react";
import type { GeoMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const spec: GeoMapSpec = {
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 182 arcs; Copy includes it */},
    "projection": "equalEarth"
  },
  "data": [],
  "encoding": {
    "key": {
      "field": "id",
      "type": "nominal"
    }
  },
  "points": {
    "data": [/* 456 rows; Copy includes them */],
    "longitude": {
      "field": "lon",
      "type": "quantitative"
    },
    "latitude": {
      "field": "lat",
      "type": "quantitative"
    },
    "size": {
      "field": "gdp",
      "type": "quantitative",
      "title": "GDP ($ billions)"
    },
    "key": {
      "field": "country",
      "type": "nominal"
    },
    "time": {
      "field": "year",
      "type": "temporal"
    },
    "tooltip": [
      {
        "field": "country",
        "type": "nominal",
        "title": "Country"
      },
      {
        "field": "gdp",
        "type": "quantitative",
        "title": "GDP ($ billions)",
        "format": ",.0f"
      }
    ]
  },
  "playback": {
    "duration": 15000
  },
  "chrome": {
    "title": "China's economy grew from smaller than Spain's to second largest",
    "subtitle": "GDP of twenty large economies, current US$ billions, every other year from 1980 to 2024"
  }
};

export function Example() {
  return <GeoMap spec={spec} />;
}
<script setup lang="ts">
import { GeoMap } from "@opendata-ai/openchart-vue";
import type { GeoMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const spec: GeoMapSpec = {
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 182 arcs; Copy includes it */},
    "projection": "equalEarth"
  },
  "data": [],
  "encoding": {
    "key": {
      "field": "id",
      "type": "nominal"
    }
  },
  "points": {
    "data": [/* 456 rows; Copy includes them */],
    "longitude": {
      "field": "lon",
      "type": "quantitative"
    },
    "latitude": {
      "field": "lat",
      "type": "quantitative"
    },
    "size": {
      "field": "gdp",
      "type": "quantitative",
      "title": "GDP ($ billions)"
    },
    "key": {
      "field": "country",
      "type": "nominal"
    },
    "time": {
      "field": "year",
      "type": "temporal"
    },
    "tooltip": [
      {
        "field": "country",
        "type": "nominal",
        "title": "Country"
      },
      {
        "field": "gdp",
        "type": "quantitative",
        "title": "GDP ($ billions)",
        "format": ",.0f"
      }
    ]
  },
  "playback": {
    "duration": 15000
  },
  "chrome": {
    "title": "China's economy grew from smaller than Spain's to second largest",
    "subtitle": "GDP of twenty large economies, current US$ billions, every other year from 1980 to 2024"
  }
};
</script>

<template>
  <GeoMap :spec="spec" />
</template>
<script lang="ts">
import { GeoMap } from "@opendata-ai/openchart-svelte";
import type { GeoMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const spec: GeoMapSpec = {
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 182 arcs; Copy includes it */},
    "projection": "equalEarth"
  },
  "data": [],
  "encoding": {
    "key": {
      "field": "id",
      "type": "nominal"
    }
  },
  "points": {
    "data": [/* 456 rows; Copy includes them */],
    "longitude": {
      "field": "lon",
      "type": "quantitative"
    },
    "latitude": {
      "field": "lat",
      "type": "quantitative"
    },
    "size": {
      "field": "gdp",
      "type": "quantitative",
      "title": "GDP ($ billions)"
    },
    "key": {
      "field": "country",
      "type": "nominal"
    },
    "time": {
      "field": "year",
      "type": "temporal"
    },
    "tooltip": [
      {
        "field": "country",
        "type": "nominal",
        "title": "Country"
      },
      {
        "field": "gdp",
        "type": "quantitative",
        "title": "GDP ($ billions)",
        "format": ",.0f"
      }
    ]
  },
  "playback": {
    "duration": 15000
  },
  "chrome": {
    "title": "China's economy grew from smaller than Spain's to second largest",
    "subtitle": "GDP of twenty large economies, current US$ billions, every other year from 1980 to 2024"
  }
};
</script>

<GeoMap {spec} />
import { createGeoMap } from "@opendata-ai/openchart-vanilla";
import type { GeoMapSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const spec: GeoMapSpec = {
  "type": "map",
  "geo": {
    "features": {/* TopoJSON, 182 arcs; Copy includes it */},
    "projection": "equalEarth"
  },
  "data": [],
  "encoding": {
    "key": {
      "field": "id",
      "type": "nominal"
    }
  },
  "points": {
    "data": [/* 456 rows; Copy includes them */],
    "longitude": {
      "field": "lon",
      "type": "quantitative"
    },
    "latitude": {
      "field": "lat",
      "type": "quantitative"
    },
    "size": {
      "field": "gdp",
      "type": "quantitative",
      "title": "GDP ($ billions)"
    },
    "key": {
      "field": "country",
      "type": "nominal"
    },
    "time": {
      "field": "year",
      "type": "temporal"
    },
    "tooltip": [
      {
        "field": "country",
        "type": "nominal",
        "title": "Country"
      },
      {
        "field": "gdp",
        "type": "quantitative",
        "title": "GDP ($ billions)",
        "format": ",.0f"
      }
    ]
  },
  "playback": {
    "duration": 15000
  },
  "chrome": {
    "title": "China's economy grew from smaller than Spain's to second largest",
    "subtitle": "GDP of twenty large economies, current US$ billions, every other year from 1980 to 2024"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createGeoMap(container, spec);

points.time plays a symbol map’s points layer, and points.key is its identity, required once the layer has time. The size scale and size key cover every period, as the color classes do. A point fades in over the second half of the interval before its first value and fades out over the first half of the interval after its last. Russia appears this way in 1988, the first year with GDP data for it.

A map can play both layers. When encoding.time and points.time are both set, the two layers share one list of periods and one playhead, and the period label and controls follow the choropleth’s time field.

Zoom, focus and hover

Zoom, pan, camera methods such as zoomTo, and geo.focus keep working while the map plays, and playback keeps running through a zoom. Hovering a region shows its value for the nearest period, titled with that period, such as “Alabama, Jul 4, 2020”. A value filled in for a gap is marked “(estimated)”, and a region without a value shows “No data”.

Pages without JavaScript, compileGeoMap, compileTileMap and renderStaticSVG draw the final period. Pass t to renderStaticSVG to draw another, counting periods from zero. The demos here play every other week, so t: 13 is the week ending July 4, 2020.

Fields that matter

Field What it does
encoding.time The period field on a choropleth or tile map: temporal, ordinal or quantitative.
encoding.key Choropleth identity. Joins rows to features and follows each region across periods.
encoding.color Required and quantitative on a choropleth with time.
encoding.state Tile map identity: one row per state code and period.
encoding.value Required and quantitative on a tile map with time.
points.time, points.key The points layer’s period field and identity. key is required with time.
playback.gaps "interpolate", "hold" or "drop" for gaps between two periods with values.
playback.period The period label’s format and position, or false.