- Tutorials >
- Visualizing Movie Details >
- Column Chart Showing Directors with the Most Awards
Column Chart Showing Directors with the Most Awards¶
Estimated Time to Complete: 5 minutes
To create each chart, you will populate the chart’s encoding channels with fields from your schema. Encoding channels represent the information passed to MongoDB Charts which allows Charts to create the visualization. For more information on encoding channels and the different types of channels available, refer to the encoding channels section of the documentation.
Construct the Chart¶
To discover which directors of films represented in this dataset have
won the most awards, use the directors
and awards.wins
database
fields in your chart. Additionally, you can see which genres the
award-winning films belong to stacking the genres
field in the
columns. A column chart makes it easy to
sort and compare fields with numerical values, so it is a good choice
for this use case.
Click Add My First Chart.¶
In the Data Source dropdown, select test.movieDetails.¶
Select the Chart Type.¶
- In the Chart Type dropdown menu, select Column.
- Select the panel labeled Stacked below the Chart Type dropdown menu.
Add the desired fields to the proper encoding channels.¶
Drag the
director
property from the Fields section of the Chart Builder view to the X Axis encoding channel. This tells MongoDB Charts to create a column for eachdirector
value in the dataset.In the Fields section click the
awards
field to expand theawards
object and view its properties.Drag the
awards.wins
field to the Y Axis encoding channel. The Y Axis encoding channel determines which field to use for the chart’s aggregation.Aggregation
Aggregation processes data records using a wide variety of methods and returns computed results which may not be available in the original dataset. Because we are interested in the total number of awards won by each director, we use the
awards.wins
field here and will use an aggregation operator which will allow us to add up the total wins for each director.Leave the Aggregate dropdown menu for the Y Axis encoding channel on its default value of sum. This value directs the aggregation operation to return the total number of award wins for each director.
Apply a limit to the X axis.¶
At this point there are too many columns in our X axis to show any meaningful results. To bring the number down to a manageable level, we’ll use the default sorting and apply a limit to get the top ten:
Toggle the Limit setting of the
directors
field and set Show to 10Note
The default sort behavior sorts directors by number of award wins in descending order.
Group awards by genre.¶
Drag the
genres
field to the Series encoding channel, then click on the Array Reductions dropdown menu and selectunwind array
. The X axis columns are now broken down by movie genre.Note
Some movies contain more than one genre, so the numbers shown in the columns may not be the exact number of awards for each director.
Title your chart.¶
Hover over your chart title above the center of the chart and click the pencil icon.
Copy the following into the chart title input:
Click the green check mark to save your title.
Your chart should now look like this:
Click Save and Close to return to your dashboard.
Next Steps¶
Follow along to the next section of the tutorial to build a scatter chart of award-nominated movies and their respective TomatoMeter ratings.