Assignment #2 Visualizing Amounts with P5
✓ Published0🌍 Public
This example visualizes fuel economy (mpg) for eight car models using a static bar chart, with the title "Economy mpg by Car Type" and a CSV data source. The chart renders bars in steelblue, with axis labels and tick marks styled via CSS classes. The code uses d3.csv to load the data, d3.scaleBand for the categorical x-axis, d3.scaleLinear for the numeric y-axis, and d3.axisBottom and d3.axisLeft to draw the axes. The SVG output is created within a fixed 1500x500 container with margins, and bars are drawn as rect elements with heights proportional to the mpg values.
AI-generated descriptionMIT Licensed