Bars

In Cloudera 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.

The following steps demonstrate how to create a new Bars visual on the World Life Expectancy dataset.

For more information, see Adding data and Creating datasets. For an overview of shelves that specify this visual, see Shelves for bars visuals.

  1. Start a new visual based on the World Life Expectancy dataset. For instructions, see Creating a visual.
  2. In the VISUALS menu, find and click Bars.

    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.

  3. Populate the shelves from the available fields (Dimensions, Measures) in the DATA menu.
    1. Under Dimensions, select country and drag it to the X Axis shelf .
    2. Under Measures, select life_expectancy and drag it to the Y Axis shelf .
    3. Change the aggregate of the life_expectancy field from sum(life_expectancy) to avg(life_expectancy):
      • Click the field on the shelf of the visual to open the FIELD PROPERTIES menu.

      • Open the Aggregates menu and select Average from the list of aggregate functions.

      • 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.

  4. Alias the country field as Country, and the life_expectancy field as Life Expectancy:
    • Click the field on the shelf of the visual to open the FIELD PROPERTIES menu.

    • Open the Alias menu and enter the alias name of column in the textbox as it should appear in the visual.

    • Click the 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.

  5. Click REFRESH VISUAL.

    The Bars visual appears.

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

    Drag the un_region field to the Colors shelf and click REFRESH VISUAL to see the changes.

  7. To group all countries of UN Regions together, change the order for the un_region field on the Colors shelf:
    • Click the field on the shelf of the visual to open the FIELD PROPERTIES menu.

    • Open the Order and Top K menu and select Ascending from the list of options.

    • Click the x icon at the top of the FIELD PROPERTIES menu to close it.

  8. Click REFRESH VISUAL to see changes.
  9. 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. 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.

  10. 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.

  11. At the top left corner of the Dashboard Designer, click SAVE.
  12. At the top left corner of the Dashboard Designer, click CLOSE.

After learning how to create a basic bar chart, you can explore the following additional uses.