|
| 1 | +.. _choropleth-ref: |
| 2 | + |
| 3 | +================ |
| 4 | +Choropleth Chart |
| 5 | +================ |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. contents:: On this page |
| 10 | + :local: |
| 11 | + :backlinks: none |
| 12 | + :depth: 1 |
| 13 | + :class: singlecol |
| 14 | + |
| 15 | +Choropleth charts are maps that use shading to depict differences |
| 16 | +across regions. The shading of a region (e.g. states, countries) is |
| 17 | +based on an aggregated value and is proportional to the corresponding |
| 18 | +value of other regions. |
| 19 | + |
| 20 | +Unlike other geospatial charts, choropleths do not require coordinate |
| 21 | +data in your collections. Instead you can have names of regions as |
| 22 | +strings, so long as the region strings correspond to the names used in |
| 23 | +a supported :ref:`Shape Scheme <choropleth-shape-scheme>`. |
| 24 | + |
| 25 | +.. _choropleth-regions: |
| 26 | + |
| 27 | +Regions |
| 28 | +------- |
| 29 | + |
| 30 | +To help define regions, |charts| provides |
| 31 | +:ref:`Shape Schemes <choropleth-shape-scheme>`. For example, with the |
| 32 | +:guilabel:`US States` scheme, you can define regions at a state level, |
| 33 | +and your location field value must be one of the 50 states. |
| 34 | + |
| 35 | +.. _choropleth-enc-channels: |
| 36 | + |
| 37 | +Encoding Channels |
| 38 | +----------------- |
| 39 | + |
| 40 | +Choropleth charts use the following :ref:`encoding channels |
| 41 | +<encoding-channels>`: |
| 42 | + |
| 43 | +.. list-table:: |
| 44 | + :header-rows: 1 |
| 45 | + :widths: 20 80 |
| 46 | + |
| 47 | + * - Encoding Channel |
| 48 | + - Description |
| 49 | + |
| 50 | + * - .. data:: Location |
| 51 | + - Defines the :ref:`regions <choropleth-regions>` to be shaded |
| 52 | + on the map. |
| 53 | + |
| 54 | + The value must match (case insensitive) a region value for the |
| 55 | + selected :guilabel:`Shape Scheme`. For example, when using the |
| 56 | + :guilabel:`US States` scheme, the region of ``California`` |
| 57 | + matches ``california`` and ``CA`` as well as ``California``. |
| 58 | + |
| 59 | + For a complete list of shape schemes and their expected values, |
| 60 | + refer to the :ref:`Shape Schemes <choropleth-shape-scheme>` |
| 61 | + page. |
| 62 | + |
| 63 | + * - .. data:: Color |
| 64 | + - Defines the :guilabel:`Aggregation` that determines the |
| 65 | + shading of the corresponding :guilabel:`Location`. You |
| 66 | + can customize the range of colors that corresponds to |
| 67 | + the relative aggregated values. |
| 68 | + |
| 69 | +Use Cases |
| 70 | +--------- |
| 71 | + |
| 72 | +Choropleth charts can be used to depict differences in your |
| 73 | +selected aggregated field between geographic subregions, such as |
| 74 | +states or countries. They are useful when you have a dataset with |
| 75 | +clearly defined subregions compatible with one of the |
| 76 | +:ref:`Shape Schemes <choropleth-shape-scheme>` |charts| provides. |
| 77 | + |
| 78 | +A choropleth chart is a good choice to compare: |
| 79 | + |
| 80 | +- Population density across US states. |
| 81 | + |
| 82 | +- Annual rainfall across European countries. |
| 83 | + |
| 84 | +- Number of cellphone towers across Australian states. |
| 85 | + |
| 86 | +.. seealso:: |
| 87 | + |
| 88 | + If you are looking for a chart to depict exact values rather than |
| 89 | + a high-level comparison, consider using a |
| 90 | + :ref:`Data Table <data-table-ref>`. |
| 91 | + |
| 92 | +Example |
| 93 | +------- |
| 94 | + |
| 95 | +The following choropleth chart visualizes the total count of |
| 96 | +movie releases across various countries. Each document in the |
| 97 | +collection contains an array of countries where a particular movie was |
| 98 | +released. |
| 99 | + |
| 100 | +.. figure:: /images/charts/choropleth-example.png |
| 101 | + |
| 102 | +In this chart, we specify a |
| 103 | +:ref:`Shape Scheme <choropleth-shape-scheme>` of |
| 104 | +:guilabel:`World Countries` to divide the map into countries. |
| 105 | + |
| 106 | +The ``countries`` array in the :guilabel:`Location` field contains |
| 107 | +an array of elements representing each country where a movie |
| 108 | +was released. These elements match the values expected by the |
| 109 | +:guilabel:`World Countries` shape scheme. We unwind the array so |
| 110 | +each movie contributes to the count for each country where it was |
| 111 | +released. |
| 112 | + |
| 113 | +The :guilabel:`Color` field of ``id`` is aggregated by |
| 114 | +:guilabel:`Count`. As a result, each country is shaded based on its |
| 115 | +number of movies released. |
| 116 | + |
| 117 | +The custom color palatte for this chart ranges from yellow for |
| 118 | +lower ratings to dark red for higher ratings. Based on the |
| 119 | +visualization, we see that France, India, and Japan have relatively |
| 120 | +high movie release counts compared with other countries. |
| 121 | + |
| 122 | +.. seealso:: |
| 123 | + |
| 124 | + For a complete list of choropleth :guilabel:`Shape Schemes` and |
| 125 | + their expected values, refer to the |
| 126 | + :ref:`Choropleth Regions <choropleth-regions>` page. |
| 127 | + |
| 128 | +.. class:: hidden |
| 129 | + |
| 130 | + .. toctree:: |
| 131 | + :titlesonly: |
| 132 | + |
| 133 | + Shape Schemes </chart-type-reference/choropleth-regions> |
0 commit comments