Skip to main content
100%

A Bar Chart

✓ Published0🌍 Public
Mmbostock
Last edited Feb 26, 2019
Created on Nov 23, 2011

A bar chart displays U.S. state populations from a CSV file, sorted descending by value, with white value labels at the end of each steel-blue bar and axis ticks along the top and left. It uses D3 v3 to load and parse the data, then builds scales with `d3.scale.linear` and `d3.scale.ordinal`, rendering SVG elements via `append` and styling with CSS classes. The `d3.svg.axis` component draws the ordinal left axis and linear top axis, while `d3.format` formats the numeric labels.

AI-generated description

This simple bar chart demonstrates two new features of D3 2.6:

  • Namespaces are now optional! You can now append an SVG element by just saying append("svg"), without specifying the namespace explicitly as "svg:svg". Adding an element whose name is a known prefix (in d3.ns.prefix) implies a namespace; similarly, appending or inserting an element will inherit the namespace from its parent.

  • The axis component now supports ordinal scales. The labels on the left side of the bar chart are rendered with the axis component.

gpl-3.0 Licensed

Similar vizzes