-
Book Overview & Buying
-
Table Of Contents
Learn D3.js - Second Edition
By :
Most of the data used in your D3 visualizations will probably be loaded from external sources. This chapter explores tools provided by D3 that you can use to asynchronously load and parse data, converting it to a native format that can be manipulated in JavaScript and used in a web-based data visualization.
JSON and XML sources have a hierarchical structure. Once loaded, they can be parsed using native code, but D3 provides functions to efficiently load and parse them in a single step, returning JavaScript promises. These functions are part of the d3-fetch module, which also provides asynchronous loaders and parsers for CSV, plain text, and binary data.
If you need more control, D3 provides additional support for tabular formats in the d3-dsv module, with configurable parsers and formatters to convert flat tabular data from strings to arrays and vice versa.
Loading and parsing data is an essential skill. To get the most out of this chapter, load and...