All examples By author By category About

zollillo

Simple Horizontal Bar Chart

This code example is the result of the Module 3's exercise from the course “Data Visualization and Infographics with D3,” taught by Alberto Cairo and Scott Murray, and offered through the Knight Center for Journalism in the Americas at UT Austin.

It is a simple horizontal bar chart showing seismic events measured on March 20, 2015. The data set is sorted by the size of the event, given by the magnitude (mag) in the earthquakes_all_day.csv file. The result is then limited so that only the top ten data entries are used to make the horizontal bar chart.

The value of the magnitude is mapped to the width of each rectangle.