liveBook · Manning

Data section

As explained in Data Storytelling with Altair and AI

A data section is the part of a Vega specification that defines data sources, formats, locations, loading, and transformations.

A data section specifies the sources a Vega visualization uses, including their names, formats, locations, loading methods, and transformations. A specification can contain more than one data source. section 3.1.1

A data entry can provide data in several ways:

  • Embed records directly through the values property. section 3.1.1
  • Load a CSV file by combining a URL with a CSV format declaration. section 3.1.1
  • Retrieve data in other formats or embed it directly in the JSON specification. section 3.1.1

A named inline data source

The name myData lets other specification elements refer to four inline records containing x and y fields. section 3.1.1

Listing 3.2 An example data section
"data": [
    {
      "name": "myData",
      "values": [
        {"x": 10, "y": 20},
        {"x": 40, "y": 60},
        {"x": 70, "y": 40},
        {"x": 90, "y": 80},
      ]
    }
  ],

Inspect the complete JSON example showing the data array, source name, values, and records. section 3.1.1

How Data Storytelling with Altair and AI covers it

How deep it goes
Explains source naming, inline values, URLs, formats, and transformations, but defers detailed implementation to Vega documentation.
Examples
Uses a named myData source containing four inline records with x and y fields, alongside CSV loading syntax.
What it assumes
Assumes familiarity with JSON and Vega specifications while introducing the main specification sections from their basic structure.
What you can do after
Configure inline or externally loaded datasets for use within a Vega visualization specification.
How it connects
Connects data sources with scales, axes, marks, signals, and the broader Vega specification.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Storytelling with Altair and AI. The section links point to the parts of the book it draws on.