Skip to main content
100%

Pathetic Bar Chart

✓ Published1🌍 Public
WWaseem Medhat
Last edited Nov 21, 2020
Created on Oct 17, 2020

This example shows a horizontal bar chart of the top 10 countries by population, but only displays the bars without axes, labels, or a scale, creating a deliberately “pathetic” visualization. The chart uses React’s state and effect hooks to fetch and preprocess CSV data from a GitHub gist via `d3.csv`, filtering down to the first ten records. D3’s `scaleBand` and `scaleLinear` map country names and population values to screen coordinates, and each bar is rendered as an SVG `<rect>` with width proportional to its population. The `width` and `height` properties are fixed at 960 and 500 pixels, with no margin handling.

AI-generated description

Basic D3 bar chart (with React). It includes basic rendering, filtering data before visualization, and the margin convention.

MIT Licensed

Similar vizzes