Bars

CDP Data Visualization Bar charts use either vertical or horizontal bars to show comparisons among categories. One axis shows specific categories (typically, dimensions), while the other axis represents discrete values (measures).

Bar charts are good for avoiding clutter when data labels are long, or when comparing a large number of items, typically more than ten. Bar charts can also display negative numbers.

After learning how to construct a basic bar chart, explore some additional uses for bar charts, including:

  • Filtering by year
  • Filtering by region
  • Horizontal bars
  • Stacked bars

The following steps demonstrate how to create a new bar visual representation on dataset World Life Expectancy [data source census-pop.csv.zip]. See Adding data and Creating dtasets. For an overview of shelves that specify this visual, see Shelves for bar visuals.

  1. Start a new visual based on dataset World Life Expectancy; see Creating a visual.
  2. In the visuals menu, find and click Bars.
    selecting bars chart type
    selecting bars chart type
  3. Note that the shelves of the visual changed. They are now X Axis, Y Axis, Colors, Tooltips, Drill, Labels, and Filters.

    The mandatory shelves are X Axis and Y Axis. Note also that the fields placed on these two shelves may be easily swapped by switching X and Y.

    shelves of this visual type
  4. Populate the shelves from the available fields (Dimensions, Measures, and so on) in the Data menu.
    1. Under Dimensions, select country and drag it over X Axis shelf on the main part of the screen. Drop to add it to the shelf.
    2. Under Measures, select life_expectancy and drag it over Y Axis 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 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.

        changing the aggregation to average
      • Click x 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.

  5. Alias the country field as Country, and the life_expectancy field as Life Expectancy:
    • 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.

  6. Click Refresh Visual.

    The bar visual graph appears.

  7. To see the bars as different colors, you can place a dimension onto the Colors shelf.

    Drag the un_region field onto the Colors shelf, and click Refresh Visual to see changes.

  8. To 'group' all countries of UN Regions together, change the order for the un_region field on the Colors shelf:
    • 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 Order and Top K.

    • From the list of options, select Ascending.

      changing the order to ascending
    • Click x icon at the top of the Column Properties menu to close it.

  9. Click Refresh Visual to see changes.
  10. 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, and year onto the Filters shelf. Note that the filter selection wizard appears each time you place a field on a Filters shelf; you can specify filter values at this time, or click Cancel and select them later.

  11. Change the title to World Population - Bars.
    • Click (pencil icon) next to the title of the visualization to edit it, and enter the new name.

    • [Optional] Click (pencil icon) below the title of the visualization to add a brief description of the visual.

  12. At the top left corner of the Visual Designer, click Save.
    clicking to save
  13. At the top left corner of the Visual Designer, click Close.