This chapter covers
- Recognizing data types and dataset formats
- Loading, formatting, and measuring data
- Binding data to DOM elements
- Using scales to translate data into visual attributes
- Adding labels to a chart
The common denominator of any data visualization is, obviously, the underlying presence of data. As data visualization developers, we meet different types of data and datasets that we need to understand and manipulate to generate visualizations. In this chapter, we’ll discuss a data workflow that applies to most D3 projects. This strategy, illustrated in figure 3.1, starts with finding data for our project. This data can contain different data types, such as nominal or ordinal data, and can come in different dataset formats, such as CSV or JSON files. There’s usually a lot of work implied at this stage to prepare and clean the data, but we won’t cover that in this book.
Once a dataset is assembled, we can use D3 to load, format, and measure the data. Then we’re ready to generate visual elements, usually SVG shapes, based on the data. This powerful process is called data binding, and we’ll use it to generate all the rectangles for the bar chart we’ve started building in chapter 2.