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

Donut Chart Reference

Donut charts display data in a series of segments of a circle, with larger segments representing larger data values. The entire circle represents the summation of all data values, and each segment indicates the proportion of each category in the data to the total.

Donut Chart Encoding Channels

Donut charts provide the following encoding channels:

Encoding Channel Description
Label

The category encoding channel. MongoDB Charts creates a segment in the donut for each unique value from this field.

Note

The Label encoding channel supports binning for numeric and date fields. The channel supports sorting and limiting for string fields.

Arc The aggregation encoding channel. MongoDB Charts aggregates this field based on the aggregation method selected. This field dictates the size of each circle segment.

Use Cases

Donut charts are ideal for giving readers a quick overview of the proportional distribution of a dataset. Use donut charts when the general trend of data is more important than precise data values. Donut charts are especially useful when there is a low number of categories to visualize, because it is easier to compare fewer segments of the circle to see which values make up the greatest parts of the whole.

Consider using donut charts to display:

  • The proportion of store customers who place orders in-store versus online
  • The proportion of various resources exported by a country
  • The choices thrown during several Rock, Paper, Scissors games

Note

Although you can bin or limit your data to reduce the number of categories in the visualization, this may not be the best choice for donut charts. The purpose of donut charts is to show each value as a proportion of a total, so excluding categories may result in a misleading visualization that reflects inaccurate proportions.

When looking to compare individual data values, rather than show values as a proportion to a whole, consider using a column or bar chart.

Examples

Donut Chart Using Count

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 customer conducting the purchase. This donut chart shows the proportional counts of the three different purchase methods the store provides:

Donut Chart Example

The Label field of purhcaseMethod tells MongoDB Charts to create a circle segment for each unique value in the purhcaseMethod field. MongoDB Charts proportions each segment according to the aggregated value signified in the Arc encoding channel. In this case, we aggregate to find the total count of documents with the same purhcaseMethod value.

We see based on the visualization that the most common purchase method is In store, followed by Online.

Note

In this example we are counting entire documents, so it does not matter what field we select for the Arc field. No matter what field we apply, the visualization will still be the same.

Donut Chart Using Sum

The following chart visualizes personal workout data. Each document in the collection represents a single workout activity, which includes information on the type of activity performed and the amount of time spent exercising. This donut chart shows the proportional time spent performing each exercise activity:

Donut Chart Example

The Label field of Activity Type tells MongoDB Charts to create a circle segment for each unique value in the Activity Type field. MongoDB Charts proportions each segment according to the aggregated value signified in the Arc encoding channel. In this case, we aggregate to find the total sum of workout times for documents with the same Activity Type value.

We see based on the visualization that the activity with the greatest total workout time is Surf, followed by Bike Ride.