Top Item charts show information from the document with the greatest or smallest value for a specified field.
When you create a Top Item chart, you specify:
- The field by which to sort your collection.
- Whether you want to sort in ascending or descending order.
- The fields you want to display from the first document returned by your specified sort.
Top Item charts utilize the following encoding channels:
The field by which to sort the collection. You can specify an ascending or descending sort.
The fields to display from the top item in the collection after sorting.
You cannot perform aggregations on Display fields.
Use Top Item charts to show information about the most extreme or most recent instance of a particular field value. For example, you can use Top Item charts to show information on:
- The most recent reading from a collection of sensor data, such as temperature readings.
- The highest rated movie in a collection.
- The cheapest available room in a collection of available hotel listings.
- The largest sale recorded in the past month (when combining a Top Item chart with date filters).
The following chart uses a data source containing Sample AirBnB
Listing data and shows information on the
document with the highest
monthly_price in the collection:
The chart sorts the documents based on
descending order, and returns the first document appearing in the sort.
The chart displays the following fields: