liveBook · Manning

Structured data

As explained in D3.js in Action, Third Edition

Tabular data is data organized into rows and columns, with each row representing a record and each column representing a field.

Structured data organizes information in recognizable patterns. Tabular data uses rows and columns: each row represents a record, while columns identify fields. It commonly appears in spreadsheets, database tables, and delimited files. section 3.1.3

Identify tabular data by its delimiter and loading method:

  • CSV separates values with commas, TSV uses tabs, and DSV lets you specify another delimiter, such as a pipe or semicolon. section 3.1.3
  • The first line usually contains column headers, and each following row contains one dataset entry. section 3.1.3
  • D3 loads these formats with d3.csv(), d3.tsv(), and d3.dsv(), then transforms the data into an array of objects. section 3.1.3 section 3.6
  • Wait for asynchronous loading to finish before manipulating values or building a visualization; use then() to access the complete dataset. section 3.6

One dataset, three delimiters

An employee dataset can be written as CSV with commas, TSV with tabs, or DSV with pipes. Each version can contain the same headers—id, name, and works_with_d3—and the same rows for Zoe, James, Alice, and Hubert. section 3.1.3

Table 3.1 Delimited data expressed in CSV, TSV, and DSV formats
CSV: Comma-Separated Values
TSV: Tab-Separated Values
DSV: Delimiter-Separated Values (with a pipe delimiter)
id,name,works_with_d3
id name works_with_d3
id|name|works_with_d3
1,Zoe,false
1 Zoe false
1|Zoe|false
2,James,true
2 James true
2|James|true
3,Alice,true
3 Alice true
3|Alice|true
4,Hubert,false
4 Hubert false
4|Hubert|false

Compare the same tabular dataset expressed in CSV, TSV, and pipe-delimited DSV form. section 3.1.3

How D3.js in Action, Third Edition covers it

How deep it goes
Explains rows, headers, delimiters, D3 loaders, and asynchronous access, then stops short of deeper data modeling.
Examples
Uses an employee dataset expressed as CSV, TSV, and pipe-delimited DSV files.
What you can do after
Apply it via D3 loaders to access, convert, and prepare tabular data for visualization.
How it connects
Connects CSV, TSV, DSV, JSON, asynchronous loading, data binding, and D3 scales.

Also explained in

Compare how 24 books explain structured data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of D3.js in Action, Third Edition. The section links point to the parts of the book it draws on.