Understanding Scales
Scales allow us to transform data into values that we can use for drawing charts.
We'll cover the following...
We are going to step away from our project for a moment to talk about scales. After we have learned about scales, we will learn how to apply them to our visualizations. It will be much easier to learn about scales separately.
What are scales?
Scales is a simple concept, but the logic behind it is very complicated. Here is how D3 describes scales:
Scales are a convenient abstraction for a fundamental task in visualization: mapping a dimension of abstract data to a visual representation.
That is a good summary if you are already familiar with scales, but that is not very clear to beginners. Let’s break down scales in a simpler manner.
The problem
First, let’s identify the problem. The data we use will not always be suitable for drawing shapes. In the previous lesson, we attempted to position the circles with the weather data. We did not do anything to the data. Unfortunately, that did not work. It was not easy to discern between different circles, and we were left with a lot of empty room on the chart.
It is not uncommon to face problems like these. The shapes we draw need to represent our data. How do we represent ...