Creating basic combos
CDP Data Visualization enables you to create Combo charts.
The following steps demonstrate how to create a new combined bar and line chart on dataset
World Life Expectancy
[data source
samples.world_life_expectancy
].
For an overview of shelves that specify this visual, see Shelves for combos.
- Start a new visual based on dataset
World Life Expectancy
[data sourcesamples.world_life_expectancy
]; see Creating a visual. - In the visuals menu, find and click Combo.
- Note that the shelves of the visual changed. They are now Dimension,
Bar Measure, Line Measure,
Tooltips, Highlight Mark Measure,
Tooltips, and Filters.
The mandatory shelves for bar and line visuals are Dimension that maps to the X-axis.
Bar Measure and Line Measure both map to the Y-axis.
- Populate the shelves from the available fields (Dimensions,
Measures, and so on) in the Data menu.
-
Under Dimensions, select
year
and drag it over Dimension shelf on the main part of the screen. Drop to add it to the shelf. -
Under Measures, select
life_expectancy
and drag it over Bar Measures shelf on the main part of the screen. Drop to add it to the shelf. -
Under Measures, select
gdp_per_capita
and drag it over Line Measures shelf on the main part of the screen. Drop to add it to the shelf.
-
Under Dimensions, select
- Change the aggregate of the
life_expectancy
field fromsum(life_expectancy)
toavg(life_expectancy)
:- On the shelf of the visual, click the caret-right icon to the right of the field.
- In the Column Properties menu, click the caret-right icon next to Aggregates.
-
From the list of aggregate functions, select Average.
- Click x icon at the top of the Column Properties menu to close it.
- Click x icon at the top of the Column Properties menu to close it.
- Similarly, change the aggregate of the
gdp_per_capita
field fromsum(gdp_per_capita)
toavg(gdp_per_capita)
:- On the shelf of the visual, click the caret-right icon to the right of the field.
- In the Column Properties menu, click the caret-right icon next to Aggregates.
-
From the list of aggregate functions, select Average.
- Click x icon at the top of the Column Properties menu to close it.
- Click x icon at the top of the Column Properties menu to close it.
- The shelves of your visual should now look something like the following image:
- Click Refresh Visual.
The bar and line visual appears.
Note that the two legends for the Y axis match the color of the plot: the orange line for
sum(gdp_per_capita)
, and the blue for the blue bars foravg(life_expectancy)
. However, you may not be able to see the bars because the values of that measure are so much smaller than the values for the line measure. To see the bars, Assign a measure to a secondary axis. - Alias the
life_expectancy
field asLife Expectancy
, and thegdp_per-capita
field asGDP Per Capita
according to these steps:- On the shelf of the visual, click the caret-right icon to the right of the field.
- In the Field Properties menu, click the caret-right icon next to Alias.
- In the text box below Alias, enter the alias name of column, as it should appear in the visual.
- Click x icon at the top of the Field Properties menu to close it.
- Note that the shelf now shows the column with its alias name.
- Click Refresh Visual again.