Skip to main content
100%

Refactored Bar Chart

✓ Published1🌍 Public
MMATTE-blz
Last edited Mar 31, 2021
Created on Mar 31, 2021
Forked from axes Bar Chart

This bar chart displays the 2020 populations of the first ten countries from a UN dataset, with country names on the vertical axis and population on the horizontal axis. The visualization is built with React components that render SVG elements, using D3's `scaleBand` and `scaleLinear` for axes and data mapping. Axes and marks are each defined in separate files, demonstrating a modular, refactored architecture. The bottom axis uses `xScale.ticks()`, while the left axis maps the domain values; rectangles are drawn using the `Marks` component.

AI-generated description

{xScale.ticks().map((tickValue) => ( <line x1={xScale(tickValue)} y1={0} x2={xScale(tickValue)} y2={innerHeight} stroke={'black'} /> ))}

MIT Licensed

Similar vizzes