Exercise 3: Configuring Multi-Series Charts

COVE Data Definition Exercises

Learning Objective

This exercise, along with Exercises 1 and 2, demonstrates how to configure bar and line charts from different source data formats.  Whereas the first two exercises use the same source file, this exercise uses the same source data but in a different format.

Note that, once you get to the Configure tab, the step-by-step instructions are not as detailed as they are for the previous exercises.  We hope that by this point you are more comfortable with the COVE interface for charts and can find the key configuration settings on your own.

(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 multi-series data in a purely long format. (To see the complete file contents, click the link below the Excel screen capture.)

Screenshot of Excel file showing chart data in long format

View source file [XLS – 459 B]

Visualization You’re Building

For this exercise you’re essentially building the same chart you built in Exercise 1, but because the data are structured differently, the setup is different. Pay careful attention to the configuration instructions, particularly when you’re on the Import Data tab.

Note also the following features with this chart:

  • There is a horizontal anchor line at the 3,000 mark.
  • The legend behavior is set to “highlight.”  Try clicking a category in the legend to see how this setting works.

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 Bar.

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/chart-long-data-format.csv
  2. Click Load.
  3. Select Vertical for the Orientation.
  4. When asked whether there are multiple series, select Yes.
  5. For the next question, select Multiple Rows.  (The data series will be defined by the Sex column, which spans multiple rows.)
  6. The next question is essentially asking you in a generic way which row/column represents the legend categories. Select the column Sex.
  7. For the property that represents the values for the date-category axis, select Age Group.
  8. For the property that represents the numeric value, select Total Cases.  (The remaining import questions do not apply because the source file has no data to be ignored. You have defined all three columns.)
  9. Click Configure your visualization.

Configure Your Visualization

Tip: Before following the instructions below, try configuring your chart by looking only at the example above.

  • Select Male and Female as the data series.  (Note that the tool automatically names the data series with concatenated labels.  Click the down arrow for each data series to see the override option for the label.)
  • Set the Age Group as the Data Key (leaving the Data Scaling Type as Categorical).
  • Click “Done” in the preview area when you’re ready to preview your visualization.  In preview, try interacting with the legend by clicking a category.  Notice how the chart responds:  Only the bars for the selected category display.

Fine-Tune the Visualization

  • Set chart title and other supporting text as you like.
  • Add a legend Title.
  • Format the numeric values on the value axis to include commas.
  • Add a label for the value axis and set the chart width to improve the label positioning, if necessary.
  • Add a legend title.
  • Add an Index Column Header to the data table.
  • Feel free to try options in the Visual panel.

To add the features introduced in the example chart, follow these steps:

  • To add an anchor line, click Add Anchor in the Left Value Axis panel.  Click the down arrow to the right of the “Remove” option for anchor settings. Set the Value to 3000 or any valid value on the value axis.  Set the Color to any HTML-valid color code such as “gray” or a hex value like “#909497”.   Set the Line Style as you wish.
  • In the Legend panel set the Legend Behavior to Highlight.  In the preview chart, select a legend category and notice the change in response.  All bars continue to display, but non-selected series are dimmed.

Don’t forget to save your visualization.

Exercise Variation

At this point, you should be able to use the same source file to create a chart with Age Groups as the legend categories and the Sex categories on the date-category axis.  Try building the chart on your own, but just in case you need some help, here are the steps that differ from those above:

  • On the Import Data tab, for the question about properties that represent the series the row is describing, select Age Group.
  • For the data-import question about the date-category axis, select Sex.
  • On the Configure tab, select each Age Group as a Data Series and select Sex as the Data Key.

Next Exercise

Go to Exercise 4 to learn about building numeric data maps with COVE.