Line Visuals

A line chart 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. A line chart displays information as a series of data points, or markers, connected by straight line segments. It is a basic type of chart common in many fields. While it is similar to a scatter plot, the line chart orders the measurements along the primary axis and is often used to visualize a time series.

The following steps demonstrate how to create a new line visual on dataset World Life Expectancy [data source samples.world_life_expectancy].

  1. Start a new visual based on dataset World Life Expectancy [data source samples.world_life_expectancy]; see Creating Visuals.
  2. In the visuals menu, find and click lines (row 1, column 4).

    selecting line chart type
  3. Note that the shelves of the visual changed. They are now X, Y, Colors, Tooltips, and Filters.

    The mandatory shelves for line visuals are X and Y, representing the X-axis and Y-axis.

  4. Populate the shelves from the available fields (Dimensions, Measures, and so on) listed in the left navigation menu.

    • Under Dimensions, select year and drag it over X shelf on the main part of the screen. Drop to add it to the shelf.
    • Under Measures, select life_expectancy and drag it over Y shelf on the main part of the screen. Drop to add it to the shelf.
  5. On the shelf of the visual, on sum(life_expectancy) field, click the icon (down arrow), select Aggregates, and then select Average.

    changing the aggregation of life expectancy
  6. Note that the shelf now contains the modified field avg(life_expectancy).

    life expectancy with avg aggregation
  7. Click Refresh Visual.

    The line visual appears.

  8. Alias the year field:

    • On the shelf, on year field, click the icon (down arrow), select Alias, and then select Set.

    • In the Enter a column alias modal window, enter Year.

    • Click Save.

  9. Alias the life_expectancy field:

    • On the shelf, on life_expectancy field, click the icon (down arrow), select Alias, and then select Set.

    • In the Enter a column alias modal window, enter Life Expectancy.

    • Click Save.

  10. To see the individual countries, and in different colors, you must place country field on the Colors shelf.

    • On the Country field, click the icon (down arrow), then select Duplicate.

    • Click one of the Country fields on X shelf, drag it to the Colors shelf, and drop it.

  11. [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.

    For example,

    • From Measures, drag gdp_per_capita onto the Tooltip shelf.
    • From Dimensions, drag country, un_subregion, and un_region onto the Tooltip shelf.
    • For all items on the Tooltip shelf, click the icon (down arrow), select Aggregates, and then select Remove Aggregate.
    • For all numeric items on the Y shelf and the Tooltip shelf, click the icon (down arrow), select Display Format, and enter ,.2f.

      Note that these fields are typically from the Measures menu, and in this example include gdp_per_capita and life_expectancy.

  12. [Optional] On the Filters shelf, add several fields from Dimensions and Measures.

    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, and population onto the Filters shelf.

  13. On the Filters shelf,

    • Click the icon (down arrow) on the population field.
    • Select []Enter/Edit Expression.
    • Enter [population]>10000000.
    • Click Save.
  14. Click Refresh Visual.

    The updated line visual appears. Note that some of the lines do not originate at the beginning of the time series. This is because their population did were below the 10,000,000 threshold that was set in the population filter.

  15. Click Edit next to the title of the visualization.

  16. Change the title to World Population - Lines.
  17. Above the left navigation bar, click Save.