Processing activity data

Before we start creating the activity chart itself, we need to look at how we should transform and prepare our data for the charts.

Let's look at what data we already have in our system. As far as the activities go, they all have a timestamp stored in the time field. However, for our chart, a list of timestamps is not sufficient enough. What we're looking for is a chart that displays one bar for each hour of the past 24 hours. Each one hour bar should represent the count of activities during that time.

The following illustration shows our source data, which is basically a time stream of activity events. On the lower arrow, we can see the data that we need to end up with for our chart:

An illustration displaying activities ...

Get Mastering Angular Components now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.