Skip to content

Commit b639ac6

Browse files
(DOCSP-11785): Add Top Item chart (#408)
* (DOCSP-11785): Add Top Item chart * edits per review
1 parent ed46914 commit b639ac6

File tree

5 files changed

+104
-0
lines changed

5 files changed

+104
-0
lines changed

source/chart-type-reference/text-charts.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Text Charts
1616
/chart-type-reference/data-table
1717
/chart-type-reference/number-chart
1818
/chart-type-reference/word-cloud
19+
/chart-type-reference/top-item
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
.. _top-item-ref:
2+
3+
==============
4+
Top Item Chart
5+
==============
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Top Item charts show information from the document with the
16+
greatest or smallest value for a specified field.
17+
18+
When you create a Top Item chart, you specify:
19+
20+
- The field by which to sort your collection.
21+
22+
- Whether you want to sort in ascending or descending order.
23+
24+
- The fields you want to display from the first document returned by
25+
your specified sort.
26+
27+
Encoding Channels
28+
-----------------
29+
30+
Top Item charts utilize the following :ref:`encoding channels
31+
<encoding-channels>`:
32+
33+
.. list-table::
34+
:header-rows: 1
35+
:widths: 20 80
36+
37+
* - Encoding Channel
38+
- Description
39+
40+
* - Sort
41+
- The field by which to sort the collection. You can specify an
42+
ascending or descending sort.
43+
44+
* - Display
45+
- The fields to display from the top item in the collection after
46+
sorting.
47+
48+
.. note::
49+
50+
You cannot perform aggregations on :guilabel:`Display`
51+
fields.
52+
53+
Use Cases
54+
---------
55+
56+
Use Top Item charts to show information about the most extreme or most
57+
recent instance of a particular field value. For example, you can use
58+
Top Item charts to show information on:
59+
60+
- The most recent reading from a collection of sensor data, such as
61+
temperature readings.
62+
63+
- The highest rated movie in a collection.
64+
65+
- The cheapest available room in a collection of available hotel
66+
listings.
67+
68+
- The largest sale recorded in the past month (when combining a Top
69+
Item chart with :ref:`date filters <charts-filter-documents>`).
70+
71+
Example
72+
-------
73+
74+
The following chart uses a data source containing :atlas:`Sample AirBnB
75+
Listing </sample-data/sample-airbnb/>` data and shows information on the
76+
document with the highest ``monthly_price`` in the collection:
77+
78+
.. figure:: /images/charts/top-item-example.png
79+
:figwidth: 700px
80+
:alt: Top Item Chart with AirBnB Data
81+
82+
The chart sorts the documents based on ``monthly_price`` in
83+
descending order, and returns the first document appearing in the sort.
84+
85+
The chart displays the following fields:
86+
87+
- ``monthly_price``
88+
89+
- ``property_type``
90+
91+
- ``country``
92+
93+
- ``suburb``

source/chart-types.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ keywords and phrases.
8282
.. figure:: /images/charts/word-cloud-small.png
8383
:figwidth: 525px
8484

85+
:ref:`Top Item Charts <top-item-ref>`
86+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87+
88+
Top Item charts display information from the document with the greatest
89+
or smallest value for a specified field.
90+
91+
.. figure:: /images/charts/top-item-small.png
92+
:figwidth: 525px
93+
:alt: Example Top Item Chart
94+
8595
:ref:`Geospatial Charts <geo-spatial>`
8696
--------------------------------------
8797

232 KB
Loading
135 KB
Loading

0 commit comments

Comments
 (0)