Displaying Events in a Heatmap Calendar
Learn how to create a heatmap-styled calendar to display event attendance for a location.
Last updated
Was this helpful?
Learn how to create a heatmap-styled calendar to display event attendance for a location.
Last updated
Was this helpful?
Event data provides critical insights into activities that can impact businesses. By tracking when and where events occur, businesses can optimize operations, marketing, and resource allocation. For instance, a surge in local events could indicate an increase in customer traffic, enabling businesses to adjust staffing and inventory levels accordingly.
This tutorial demonstrates how to use PredictHQ event data to build a heatmap calendar, starting with a simple build using , followed by guidance on filtering and retrieving the underlying event data from PredictHQ's Features API. The goal is to provide a simple example so you can incorporate events into your own calendar view.
Visualization and Insights, Workforce Optimization
Accommodation, Consumer Packaged Goods, Grocery and Supermarkets, Leisure, Travel and Tourism, Marketing and Advertising, Parking, Restaurants, Retail, Transportation and Delivery and Others
Heatmap calendars display data density over time, making it easier to identify patterns and trends, such as busy days. This visual tool allows users to quickly view upcoming peak periods at a glance. For example, a hotel booking platform might use a heatmap calendar to visualize peak booking periods associated with local events, aiding in pricing strategy, inventory management, and customer satisfaction by preempting high-demand times.
This section goes through a simple example to demonstrate the basic functionality of a heatmap calendar and the integration of PredictHQ data. Explore the example through the following Observable notebook:
To view the code used to call the Features API, Events API, and other functions (if not already pinned):
Click on the left margin of the cells in the Observable notebook.
Alternatively, click 'Edit' in the cell menu.
Date Range Start: Set the start date for the period of interest.
Location: Select one of the predefined locations.
Categories: Choose the event categories to consider.
The calendar updates automatically based on the specified parameters. In this example, the intensity of the shading on the calendar reflects the total attendance for each day, reflecting how busy each day is. Interact with the calendar by:
Hovering over the days to reveal more detailed information about the events.
Clicking on specific days to surface the specific events occurring, providing more granular details.
Use the notebook menu to select 'Export'.
Then choose 'Download code' for a local copy.
This tutorial has demonstrated how to create a heatmap calendar with PredictHQ’s APIs, from fetching event data to visualizing it interactively. It is an effective tool that helps you plan for events and their impacts, supporting informed, data-driven decisions. Adapt the provided example and customize the heatmap to align with your specific operational needs.
To experiment with this example, consider . This allows you to edit and modify the code as needed. For more information on Observable notebooks, see this .
An Access Token is required to access PredictHQ's APIs and run the notebook. Follow these to obtain one if needed.
Powered by aggregated event data from the , the heatmap calendar displays the total attendance per day. Selecting a specific day reveals additional event details via the , adding an interactive layer to the experience.
For more information on the Features API, see this .
The notebook can also be as a JavaScript module. To do this:
Another approach to using calendars is to showcase the most impactful events, including links to their respective pages in the WebApp. This method involves fetching event data from the , sorting by attendance, and then directly displaying the top events on the calendar.
This section provides guidance on how to customize the underlying event data using the Features API. Tailor your event data by specifying the following :
Guidance: For details on how to set locations, refer to .
Guidance: Start with prefixed by phq_attendance
for ; other categories may require additional adjustments. For details on how to set event categories, refer to .
Set a threshold to filter out small events that are unlikely to have a significant impact based on .
Guidance: For details on how to set the minimum event rank, refer to .
For an example of calling the API in JavaScript, see . For more information on using the Features API, see these .