Exercise 4: Building a Numeric Map and Setting Up Filter Controls

COVE Data Definition Exercises

Learning Objectives

The first three exercises in this series focused on chart building. With this exercise the focus shifts to data maps. We’ll start with a numeric (quantitative) map of the U.S.  Then in Exercise 5 you will use the same source file to build a categorical map.  These two map exercises provide a solid introduction to data mapping with COVE.

This exercise also introduces the configuration of filter controls (which you can create for charts as well as maps). Along the way, you will learn about some key options for controlling the look and behavior of your maps.

(For explanations of the concepts demonstrated in this series of exercises, see Defining Data for Visualization.  For descriptions of the other exercises in this series, see the Exercise Index.)

Source Data

This exercise uses the following source data. Every column is involved in the configuration of the map you’re building (see below).   To see the full source data file, click the link below the image.

Screen capture of source data in Excel

View source file [XLS – 332 KB]

Visualization You’re Building

Below is an example of the data map you’re building. Let’s look how each source column is used in the configuration:

  • State — A geography column is required for all data maps.  In addition to U.S. states and territories, the geography could be U.S. counties (for a state or U.S. county map) or countries (for a world map).
  • Year, Sex, and Age Group — These three columns are used for chronological and demographic categorization.  Three filter controls, one for each of these columns, resolve the issue of duplicate data.  (Duplicate data exist in that there is a series of state values for every combination of the values from these three columns.  Check out the source file [XLS – 332 KB], and you can see that it has a large number of rows to support all the filter combinations.)
  • Status — This is simply additional attributive data that are used to create a single special class in the legend called “Not Applicable” (based on the source value “NA”).  States in special classes are automatically coded in shades of gray.
  • Cases per 100K — This column contains the numeric series of data required for a numeric data map.
  • URL — For this exercise, you’re building a combination data map and navigation map. Selecting a state opens an associated web page, as defined by this optional column.

Note also the following:

  • The data classification is based on quantiles. (In COVE, this classification is also referred to as “equal number.”)  With this classification, each of the regular classes has roughly the same number of states or territories.  In the Legend panel, you can also configure maps as “equal interval.”  For explanations of the two types of numeric data maps, see Example Numeric Maps.
  • The filter control for Year is a series of tabs while drop-down menus are used for Sex and Age Group.
  • The legend shows a “0” (zero) class, but you may not see any states color-coded as having zero Cases per 100K.  To see why zero is in the legend, change the year filter to 2017.  Then you can see that Alaska has zero cases.  This configuration is called a “unified legend,” which means that the legend classes are based on the data across all filter settings.
  • The inclusion of zero as a separate class is an option that you can control.
  • The legend has six total classes, including the special class “Not Applicable.”  You can control this number.
  • The numbers in the legend are rounded.
  • The map includes two territories:  Guam and Puerto Rico, which are represented by the “roundtangles” below the map.

Step-by-Step Instructions

Create the Content Item

  1. From the WCMS content (folder) browser, select New Content Item, and when prompted, select Data Visualization.
  2. Click the button Open Visualization Editor.
  3. On the Choose Visualization Type tab, select United States (State- or County-Level) under Maps.

Import the Data

  1. On the Import Data tab, select Load from URL and then copy and paste the following URL:
    https://wwwdev.cdc.gov/wcms/4.0/cdc-wp/data-presentation/data/exercise-data/us-map-3-filters.csv
  2. Click Load.
  3. Select Vertical for the Orientation.
  4. When asked whether there are multiple series, select No.  (Data maps are inherently single-series.)
  5. Click Configure your visualization.

Configure Your Visualization

  1. Open the Type panel to observe the default settings for the selected visualization type.  Note that the Data Classification Type is Numeric/Quantitative. It’s important that this setting is correct when you start configuration.
  2. Open the Legend panel and observe that the Legend Type is set by default to Equal Number (Quantiles).
  3. In the General tab, set the Title and other supporting text as you wish.
  4. In the Columns panel, select State as the Geography column and Cases per 100K as the Data column.  The map displays in the Preview panel as soon as these columns are set.  Note that there are only three data classes in the legend.
  5. In the Filters panel, add filters for Year, Sex, and Age Group.   (Tip: It’s important that you get in the habit of setting filter controls as soon as you select the primary columns so that you have less chance of forgetting them.  You may even want to set them as your first configuration step.)
  6. For the Year filter, set the Filter Style to Tab.
  7. Test the filters to ensure that the map is refreshing.  (If the filter do not seem to work, revisit the Filters panel and double-check the three selections for Filter Column.)
  8. Select a state and note that no navigation happens at this point.
  9. Return to the Columns panel and select URL for the Navigation column.
  10. While in the Columns panel, click Add Special Class.  Select Status as the Data Key, with NA as the Value and “Not Available” as the Label.  Note the addition of “Not Available” in the legend.

Fine-Tune the Visualization

Take a minute to compare your chart to the example at the top of the page.  Note the following:

  1. The numbers in the legend need formatting.  You can manage these settings in the Columns panel, just below your selection of the data column.  (Set the Round value to 0 and check Add Commas to Numbers.)
  2. Zero is not a separate class in the current legend.  In the Legend panel, check Separate Zero.
  3. The legend is not unified.  (Try changing the filter settings and notice how the ranges of the numeric classes shift.)  In the Legend panel, check Unified Legend.
  4. Your legend at this point has only four classes.  In the Legend panel, increase the Number of Items to 5.  This sets the number of regular classes, so with the one special class, you should now see six classes in the legend.
  5. Don’t forget to enter a legend Title.
  6. The special class comes first in the legend.  In the Legend panel, check Show Special Classes Last.
  7. If the drop-down filters for Sex and Age Group do not have labels, return to the Filters panel and set the Labels for these two filters.
  8. Note that the default selection for Age Group is <15.  Change the Filter Order to Descending Alphanumeric.  The default selection should now be All because it’s at the top of the drop-down list.  (Note the Custom option, which allows you to fine-tune the order by dragging.)
  9. Change the Filter Sort for Year so that the most recent year, 2020, is the default selection.

General Tips

  • The darker colors in the example map correspond to the larger numeric classes in the legend.  In the Visual panel, there is an option for reversing the selected color palette.  This is especially important to know when you are presenting multiple data maps.  Depending on the health indicators being mapped, you may need to reverse the color ramp for some maps so that, for example, dark colors always represent negative outcomes and light colors represent positive outcomes (or vice versa).
  • In addition to state-based maps, COVE can color-code counties for the U.S. or for individual U.S. states.  To show county-level data, select the same option on the Choose Visualization Type tab — United States (State- or County-Level) — but fine-tune the settings in the Type panel, specifically the Geography and Geography Subtype settings.  See example U.S. county map.  See example state county map.
  • Special classes are automatically coded in shades of gray.  Try to avoid creating more than two special classes because some users may have trouble distinguishing multiple shades of gray.

Next Exercise

Go to Exercise 5 to build a categorical map using the same source file that you used for this exercise.