Navigation
This documentation refers to the on premises version of MongoDB Charts. For documentation on the MongoDB Charts SaaS application in Atlas, click here.

Number Chart Reference

Number charts display a single aggregated value from a data field.

Number Chart Encoding Channel

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.

Use Cases

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.

Examples

Total Value of Store Sales

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:

Sales number chart example

The Number field of items.price tells MongoDB Charts to aggregate the field based on the selected method of $sum. Since 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.

Maximum Calories Burned During Workouts

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 swimming and surfing workouts:

Workout number chart example

The Number field of Calories Burned (kCal) tells MongoDB Charts to aggregate the field based on the selected method of $max.

We have applied a filter to this chart to restrict the documents MongoDB Charts examines to only those with an Activity Type of Surf, Swim, or 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.