Layout SVG Elements on a Y Axis with a D3 Band Scale in React

InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

A band scale allows us to map a discrete set of values to a continuous range. In this lesson, we'll use a band scale in D3 to take the distinct "region" keys in our sample data and map those to evenly spaced and sized elements on our y-axis. We'll use this band scale to show a bar in the bar chart for each region, setting their size and position based on this scale.