Lines
In CDP Data Visualization, a line chart displays information as a series of data points, or markers, connected by straight line segments. It reveals trends or change over time. Line charts show relationships within a continuous data set, and can be applied to a wide variety of categories. While line charts are similar to scatter plots, the line chart orders the measurements along the primary axis and it is often used to visualize a time series.
The following steps demonstrate how to create a new Lines visual on the World Life Expectancy dataset.
For an overview of shelves that specify this visual, see Shelves for lines visuals. For customization options, see Settings for lines visuals.
-
Start a new visual based on dataset World Life Expectancy.
For instructions, see Creating a visual.
-
In the VISUALS menu, find and click
Lines.
The shelves of the visual changed. The mandatory shelves are X Axis and Y Axis.
The fields placed on these two shelves may be easily swapped by switching X and Y.
-
Populate the shelves from the available fields (Dimensions,
Measures) in the DATA menu.
- Under Dimensions, select
year
and drag it to the X Axis shelf . - Click the Y Axis shelf and select the
life_expectancy
field from the DATA menu by clicking it. This adds the field to the shelf.
- Under Dimensions, select
- Click the field on the X Axis shelf, and in the FIELD PROPERTIES menu, select Order and Top K > Ascending.
-
If the field on the Y Axis appears as a sum aggregate, change
the aggregate to
avg(life_expectancy)
:- Click the field on the Y Axis shelf to open the FIELD PROPERTIES menu.
-
Select Aggregates > Average.
- Click the x icon at the top of the FIELD PROPERTIES menu to close it.
The shelf now contains the modified field with
avg()
aggregation function.Alternatively, you can change the aggregation at the level of the dataset, as described in Changing field aggregtion.
-
Click REFRESH VISUAL.
The Lines visual appears.
-
Alias the
year
field asYear
, and thelife_expectancy
field asLife Expectancy
:- Click the field to open the FIELD PROPERTIES menu.
- Select Alias and enter the alias name of the column in the text box as it should appear in the visual.
- Click the x icon at the top of the FIELD PROPERTIES menu to close it.
The shelf now shows the column with its alias name.
- Optional:
To see the individual countries in different colors, place the
country
field on the Colors shelf.To make the visual easier to understand, you can apply an Alias to it. -
Click REFRESH VISUAL again.
The single line is broken out into country components, and CDP Data Visualization automatically provides a color legend.
- Optional:
On the Tooltips shelf, add several fields from
Dimensions and Measures.
This enables you to see specific descriptive information in your visuals, such as input values, segment affiliation, and calculations.
-
On the Filters shelf, add several
Dimensions and Measures from the
DATA menu.
This enables you to dynamically control the data input and discover the data at a more granular level.
For example, from Dimensions, drag
country
,un_subregion
,un_region
,year
, andpopulation
onto the Filters shelf. -
On the Filters shelf:
-
Click the
population
field to open the FIELD PROPERTIES menu. - Select []Enter/Edit Expression.
-
Enter
[population]>10000000
. - Click VALIDATE & SAVE.
-
Click the
-
Click REFRESH VISUAL.
The updated Lines visual appears. Some of the lines do not originate at the beginning of the time series. This is because their population were lower than the
10,000,000
threshold that you set in the population filter. - To limit the dimensions available to the Drill Into feature (it appears on dashboards that include the visual), specify the fields that can remain visible by placing them on the Drill shelf.
- Click the (pencil ) icon next to the title of the visual to change the title to 'World Population - Lines'.
- At the top left corner of the Dashboard Designer, click SAVE.