Questions  /  Working with Data  /  SQL

How to normalize data for animated visualizations

Learn how to generate normalized column values for animated (or Torque) visualizations.

Torque animations are based on date- or number-type columns. Our system detects the minimum and maximum values in the column, bins them, and then maps those bins to a range: 0-255. If your number column values exceed 255 you will have to normalize them. One way to normalize a field is by getting its maximum value:


Then you can update a new column using the following expression (where 360 is the maximum value in our example column and norm_col is our new column):

  norm_col = column*255/360

The final steps are to select the Animated aggregation in your Builder layer’s STYLE panel, select your style settings, set the panel’s toggle to CartoCSS, then replace the Torque aggregation function argument: