Number charts display a single aggregated value from a data field.
Number charts only require a single encoding channel, called Number. This is an aggregation encoding channel which aggregates based on the field and aggregation method chosen, and displays the result in the chart.
Number charts are useful for highlighting grand totals or values which represent the overall state of your data. For example, a store may use a number chart to represent the total dollar value of all sales. Additionally, a hotel chain may use a number chart to represent the average number of vacant rooms across all hotels, or apply a filter to see the total number of vacant rooms in a select region.
You can style the number that your chart displays with conditional formatting rules. These rules are applied dynamically: if your number changes to match or stop matching a condition you define, its styling updates.
To learn how to use conditional formatting rules, see the Conditional Formatting customization option.
The following chart visualizes sales data from a mock office supply store. Each document in the collection represents an individual sale, which contains information on the item(s) sold and the purchaser. This number chart shows the total sum of all sales stored in the collection:
The Number field of
items.price tells MongoDB Charts to
aggregate the field based on the selected method of
items is an array, we have to select an array reduction option
before we can aggregate. In this example, we choose
Unwind Array, which creates a new document for each
element in the
items array. MongoDB Charts sums the
price of each
newly created document and displays the value in the visualization.
The following chart visualizes workout data. Each document in the
collection represents an individual workout activity, which contains
information on the type of activity performed and the amount of
calories burned during the workout. This number chart shows the
maximum calories burned across all
The Number field of
Calories Burned (kCal) tells
MongoDB Charts to aggregate the field based on the selected method of
We have applied a filter to this chart
to restrict the documents MongoDB Charts examines to only those with an
Activity Type of
Indoor Swim. MongoDB Charts
determines the maximum value of the
Calories Burned (kCal) field
across all documents which match this criteria and displays the value
in the visualization.
The maximum query response size for a number chart is 5000 documents.