Skip to content

Stacked horizontal bar chart

INFO

Basic data visualization rules are described in the D3 chart.

Description ​

Horizontal stacked bar chart is used to display multiple categories of values and illustrate their proportions relative to the total.

Key points for using horizontal stacked bar chart:

  • Choose this chart to compare more than two categories.
  • It's ideal for showing how parts contribute to a whole.
  • Pick distinctly different colors for clarity. Avoid using too many colors for categories. Shades of one color can work well.
  • Ensure the chart is large enough to easily read the data.

Usage ​

Refer to Horizontal bar chart > Usage.

Appearance ​

Choose contrasting colors for different categories.

bar-chart stacked

Margins ​

Refer to Horizontal bar chart > Margins.

Grid and axes ​

Refer to Horizontal bar chart > Grid and axes.

Category labels ​

Refer to Horizontal bar chart > Category labels.

Legend ​

Refer to Horizontal bar chart > Legend.

Interaction ​

Hovering highlights a bar with --chart-grid-bar-hover, indicating focus or clickability. The hover takes up half of the bars margin on the top and bottom sides.

stacked bar chart

Edge cases ​

Refer to Horizontal bar chart > Edge cases.

Initial data loading ​

Refer to Horizontal bar chart > Initial data loading.

Released under the MIT License.

Released under the MIT License.