Skip to main content
100%

Making a Bar Chart with D3.js

✓ Published1🌍 Public
Rrandy554
Last edited Nov 10, 2020
Created on Nov 8, 2020

This example shows a horizontal bar chart comparing the number of charging points across major Dutch cities in the Randstad region, using a CSV dataset with city names and numerical values. The visualization encodes the data with `d3.scaleLinear` for the x-axis and `d3.scaleBand` for the categorical y-axis. The code loads the data via `d3.csv`, converts the numeric column to integers, and uses a data join with `selectAll` and `enter()` to append SVG `rect` elements. The bars are positioned using the y-scale and sized by the x-scale's domain and range.

AI-generated description
MIT Licensed

Similar vizzes