Bar Chart

A bar chart is a graphical representation that displays and compares discrete data categories using rectangular bars. Each bar's length or height is proportional to the frequency or value of its corresponding category, allowing users to identify which groups are the highest or most common and compare them with others.

Usage

We use the Cloudscape library for data visualization in our design system. Cloudscape offers high-quality, adaptable, and user-friendly tools for creating clear and comprehensive data visualizations. This helps our users understand and analyze data effectively, facilitating informed decision-making.

Do's

  • Ensure both the X and Y axes are labeled with appropriate units and descriptions.
  • Always plot bars against a zero-value baseline. It simplifies bar length comparison and ensures accurate data visualization. A non-zero baseline can distort the comparison as it disrupts the ratio between bar lengths and actual values.
  • When constructing a bar chart, consider the order in which you will plot the bars. A common convention is to sort the bars from longest to shortest. While comparisons can be made regardless of order, this approach can ease the reader's task. However, if the category labels have an inherent order, this should typically take precedence.

Don'ts

  • Avoid adding too many categories or bars in a single chart, which can make it cluttered and hard to read.
  • Consider breaking up data into multiple charts if necessary.
  • Avoid using abbreviations or jargon in labels that might not be understood by all viewers.

Variants

Bar chart variants
Summary of all the Bar Chart variants

Vertical Bar Chart

Vertical variant

Bars are oriented vertically with the X-axis representing categories and the Y-axis representing values.

  • Use Case: Comparing quantities across different categories.

Stacked Bar Chart

Stacked variant

Bars are stacked on top of each other. Each stack segment represents a different sub-category.

  • Use Case: Showing the composition of each category, as well as comparing total values across categories.

Grouped Bar Chart

Grouped variant

In a grouped bar chart, bars representing different sub-categories are placed next to each other, rather than stacked, for each main category.

  • Use Case: More direct comparison of sub-category values across different main categories.

Horizontal Bar Chart

Horizontal variant

Bars are oriented horizontally with the Y-axis representing categories and the X-axis representing values.

  • Use Case: Comparing quantities across different categories, especially when category names are long.

For more details on how to use this component, please refer to its original source, Cloudscape.

Elements of the Bar Chart

The Bar Chart is composed of several key elements that contribute to its effectiveness in visualizing data. They work together to provide a clear, accurate, and visually appealing representation of data, making it easier for viewers to understand and interpret the information being presented.

Bar chart elements
  1. 1.
    Title: A descriptive heading that explains what the bar chart is about.
  2. 2.
    Filter: Enable data filtering.
  3. 3.
    Category axis (x-axis): The horizontal axis in a vertical bar chart or the vertical axis in a horizontal bar chart. Typically represents categories or discrete data points.
  4. 4.
    Value axis (y-axis): The vertical axis in a vertical bar chart or the horizontal axis in a horizontal bar chart. Typically represents the scale of values or measurements.
  5. 5.
    Axis labels: Text labels that describe the data represented by each axis. Placed along the axes to identify categories (X-Axis) and units or magnitude (Y-Axis).
  6. 6.
    Axis titles: Descriptive titles for the X and Y axes that provide additional context about the data.
  7. 7.
    Tick marks: Small marks along the axes that indicate the scale or categories. Aid in aligning the bars with the corresponding values or categories.
  8. 8.
    Grid lines: Horizontal and/or vertical lines that help in reading the values of the bars against the axes. Their purpose is o enhance readability and precision in interpreting data values.
  9. 9.
    Average line (threshold): An average line in a bar chart is a horizontal (or vertical, depending on the chart orientation) line that represents the average value of the data points being displayed. It helps provide a quick visual reference for comparing individual bar values to the overall average of the dataset.
  10. 10.
    Bars: Rectangular blocks that represent data values. Can be vertical (column chart) or horizontal (bar chart).
  11. 11.
    Legend: A key that explains what different colors, patterns, or bar segments represent.
  12. 12.
    Details popover: Information box that appear when a user hovers over a bar. Displays detailed information about the data point.

Interactions

  • Hover interaction: Display popover when a user hovers over a bar.
  • Click interaction: Optional click events on bars to trigger additional actions (e.g., filtering data displayed in a table).