Transformation of the data from the database into data for plotting.