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
].
World Life Expectancy
[data source samples.world_life_expectancy
]; see Creating Visuals.In the visuals menu, find and click Combo (row 1, column 5).
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.
year
and drag it over Dimension shelf on the main part of the screen. Drop to add it to the shelf.life_expectancy
and drag it over Bar Measures shelf on the main part of the screen. Drop to add it to the shelf.gdp_per_capita
and drag it over Line Measures shelf on the main part of the screen. Drop to add it to the shelf.Change the aggregate of the life_expectancy
field from
sum(life_expectancy)
to avg(life_expectancy)
:
On the shelf of the visual, click the icon to the right of the field.
In the Column Properties menu, click the icon next to Aggregates.
From the list of aggregate functions, select Average.
Click icon at the top of the Column Properties menu to close it.
Note that the shelf now contains the modified field with avg()
aggregation
function.
Similarly, change the aggregate of the gdp_per_capita
field from
sum(gdp_per_capita)
to avg(gdp_per_capita)
:
On the shelf of the visual, click the icon to the right of the field.
In the Column Properties menu, click the icon next to Aggregates.
From the list of aggregate functions, select Average.
Click icon at the top of the Column Properties menu to close it.
Note that the shelf now contains the modified field with avg()
aggregation
function.
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 for avg(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.
Alias the life_expectancy
field as Life Expectancy
, and the
gdp_per-capita
field as GDP Per Capita
according to these steps:
On the shelf of the visual, click the icon to the right of the field.
In the Field Properties menu, click the icon next to Alias.
In the text box below Alias, enter the alias name of column, as it should appear in the visual.
Click icon at the top of the Field Properties menu to close it.
Note that the shelf now shows the column with its alias name.