Skip to content

Commit 0054b63

Browse files
(DOCSP-4606) Creating a tutorial for creating Choropleth Charts (#675)
* Created a tutorial for choropleth charts * Apply suggestions from code review Co-authored-by: davidhou17 <[email protected]> --------- Co-authored-by: davidhou17 <[email protected]>
1 parent ba5d697 commit 0054b63

File tree

1 file changed

+76
-1
lines changed

1 file changed

+76
-1
lines changed

source/chart-type-reference/choropleth.txt

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,19 @@ section.
119119
For more information, see :ref:`Color Palette Customization
120120
<color-palette-customization>`.
121121

122+
.. _choropleth-examples:
123+
122124
Examples
123125
--------
124126

125127
The following choropleth chart visualizes the total count of
126128
movie releases across various countries. Each document in the
127129
collection contains an array of countries where a particular movie was
128-
released.
130+
released.
131+
132+
To build the chart in this example, see the following tutorial:
133+
134+
- :ref:`create-choropleth-chart`
129135

130136
.. figure:: /images/charts/geo-type-choropleth.png
131137
:alt: Choropleth example chart
@@ -156,6 +162,75 @@ high movie release counts compared with other countries.
156162
their expected values, refer to the
157163
:ref:`Choropleth Regions <choropleth-regions>` page.
158164

165+
Tutorial
166+
--------
167+
168+
Prerequisites
169+
~~~~~~~~~~~~~
170+
171+
The tutorial on this page uses the ``sample_mflix.movies collection``. Before starting,
172+
you must load the sample data on your cluster. To learn how to load the sample data provided
173+
by |service| into your cluster, see :atlas:`Load Sample Data </sample-data/>`.
174+
175+
.. _create-choropleth-chart:
176+
177+
Create a Geospatial Choropleth Chart
178+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179+
180+
This tutorial demonstrates how to create :ref:`a geospatial choropleth chart <choropleth-examples>` that visualizes
181+
the total count of movie releases across various countries.
182+
183+
.. procedure::
184+
:style: normal
185+
186+
.. step:: Add a geospatial choropleth chart to your dashboard.
187+
188+
a. From the :guilabel:`Dashboards` page, select the dashboard
189+
where you want to add a new chart. For instructions on setting
190+
up a dashboard, see :doc:`Dashboards </dashboards>`.
191+
192+
#. Click :guilabel:`Add Chart`.
193+
194+
#. In the :guilabel:`Select Data Source` modal, click the
195+
:guilabel:`Project` tab.
196+
197+
#. In the cluster where you loaded the
198+
sample data, select the ``movies`` collection
199+
in the ``sample_mflix`` database.
200+
201+
#. In the :guilabel:`Chart Type` dropdown, click :guilabel:`Geo Choropleth`.
202+
203+
For more details, see :ref:`create-new-chart`.
204+
205+
.. step:: Add fields to your chart.
206+
207+
a. Select the :guilabel:`Encode` tab.
208+
209+
#. Navigate to the :guilabel:`Fields` pane on the left side of
210+
the Chart Builder. This section lists all available fields
211+
in the ``movies`` collection.
212+
213+
#. Drag the ``countries`` geopoint field to
214+
the :guilabel:`Location` encoding channel.
215+
216+
#. Under the :guilabel:`Choose Method` drop down for the :guilabel:`Location`
217+
encoding channel, click :guilabel:`Unwind Array`.
218+
219+
#. Drag the ``_id`` field to the :guilabel:`Color`
220+
encoding channel.
221+
222+
#. Under the :guilabel:`Aggregate` drop down for the :guilabel:`Color`
223+
encoding channel, click :guilabel:`Count`.
224+
225+
.. step:: Save the charts to your dashboard.
226+
227+
a. Optionally, in the :guilabel:`Preview` pane, :guilabel:`Enter a title`
228+
or :guilabel:`Enter a description` for your chart.
229+
230+
#. Click :guilabel:`Save and Close`
231+
at the upper right of the chart builder view.
232+
233+
159234
Limitations
160235
-----------
161236

0 commit comments

Comments
 (0)