Exercise 1: Configuring Multi-Series Charts
COVE Data Definition Exercises
Learning Objective
This exercise, along with exercises 2 and 3, demonstrates the configuration of bar and line charts from different source data formats. (These instructions also apply to the basic combo chart, but combos typically have special settings not covered in this exercise. Exercise [ ] demonstrates the building of a combo chart.)
For explanations of the concepts demonstrated in these 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 multi-series chart data:
Visualization You’re Building
Follow the steps in this exercise to build the following bar chart. Note that the age groups are on the date/category axis. This fact is key in determining the orientation of the source data (horizontal). (In Exercise 2, you will use the same source data to build a chart with sex on the date/category axis.)
Step-by-Step Instructions
Create the Content Item
- From the WCMS content (folder) browser, select New Content Item, and when prompted, select Data Visualization.
- Click the button Open Visualization Editor.
- On the Choose Visualization Type tab, select Bar.
Import the Data
- On the Import Data tab, select Load from URL (top left of tool screen) and then copy and paste the following URL:
https://wwwdev.cdc.gov/wcms/4.0/cdc-wp/data-presentation/data/exercise-data/chart-hybrid-data-format.csv - Click Load.
- Select Horizontal for the Orientation. (The chart you’re building has age groups on the date-category axis, and they are formatted horizontally in the source file.)
- When asked whether there are multiple series, select Yes.
- The next question is essentially asking you in a generic way which row/column represents the legend categories. Select the column Sex.
- Click Configure your visualization.
Configure the Visualization
- In the General panel (on the left), and set the chart title, message, etc. as you like.
- In the Data Series panel select Male as the first data series and Female as the second. (Note that there are three viable options for the data series: Male, Female, and All. Feel free to include the All data series as well. You can reorder the data series by dragging the series labels. You can also change their display labels by clicking the arrow to the right of the Remove option and entering a new Series Name.)
- In the Left Value Axis panel, enter “Total Cases” as the Label.
- In the Date/Category Axis panel select Key as the Data Key. (Note that Age Group is not listed. Based on the information you provided on the Import Data tab, the tool has grouped the age group columns together as “Key.”) Leave the Data Scaling Type set to Categorical. You can add a Label to the axis if you like, but note that each category includes “Age” in the name.
- To see your chart, click “Done” in the preview area on the right. Note that your chart and its supporting data table need some fine-tuning. A key issue is that the first column in the data table does not have a header. This is a violation of accessibility standards.
Fine-Tune the Visualization
- To solve the issue above, open the Data Table panel and enter an Index Column Header (such as “Age Group”).
- The spacing of the label on the value axis may be tight. Open the Value Axis Panel and adjust the Size (Width) for better positioning of the label.
- While in the Left Value Axis panel, check Add Commas.
- Open the Legend panel and add a legend Title (such as “Total Cases by Sex”).
- Don’t forget to save your visualization (with the extension .json).
General Tips
- Note that source data orientation is not the same as chart orientation. Regardless of the source format, you can present a bar, line, or combo chart vertically or horizontally. You can change the chart orientation in the General panel.
- In the General panel, you can also change the Chart Type and other characteristics. Because bar, line, and combo charts are all cartesian charts, you can switch among these types fairly easily (although line charts are typically reserved for showing trends across time and therefore are configured with Date as the Data Scaling Type).
Next Exercise
Go to Exercise 2 to find out how to build a different bar chart with the same source file.