Data for charts

Added logic for generating data for charts and changed logic for selecting
measurement so that the aggregated measurement is used.