Export Image
Export Code

Letter Count Bar Chart

Sophie Engle

Last edited Jan 27, 2020
Created on Jan 18, 2020
Forked from HTML Starter

Letter Count Bar Chart

In this demo, we asynchronously load a text file, use JavaScript to count the number of times each letter appears in that file, and generate a bar chart showing the letter count in D3.js v5.

This is meant to be an introductory demo to expose students to HTML, CSS, SVG, JavaScript, D3, Bl.ocks, Blockbuilder, and VizHub for the first time.

References

This example can be found at: Gist, Bl.ocks, Blockbuilder, VizHub

The starter template for this example can be found at: Gist

See the Wikipedia page Peter Piper Nursery Rhyme for the origins behind the text used in this example.

Inspirations

This example has undergone multiple iterations:

Below you can find videos related to an older version of this example. Please note that some content was discussed in-class only:

The original inspirations come from the following excellent tutorials on creating a bar chart in D3 for the first time:

  • D3 Bar Chart by Mike Bostock, Observable Notebook using D3v5, published on November 2017.

  • Let's Make a Bar Chart by Mike Bostock, Blog Post using D3v3, published on November 2013.

  • Making a Bar Chart by Scott Murray, Blog Post using D3v3, updated on December 2018.

MIT Licensed