Skip to main content
Public

Share visualization

Loading preview…

Stacked Bar Chart (ratings by genre)

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Stacked Bar Chart (ratings by genre)

1
KKrishna.
Last edited Oct 30, 2025
Created on Oct 30, 2025

This example shows a 100% stacked bar chart of movie ratings (G, PG, PG-13, R) by genre, where each bar represents the proportion of ratings within a genre. The chart uses d3.csv with d3.autoType to load data, then normalizes counts to percentages and builds horizontal stacks via d3.scaleBand, d3.scaleLinear, and d3.stack. Rectangles are rendered in SVG with d3.select and .join, and axes are created with d3.axisBottom and d3.axisLeft, while a legend uses d3.scaleOrdinal for colors.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed