Skip to main content
100%

Letter Count Bar Chart

✓ Published0🌍 Public
115Dkatz
Last edited Feb 3, 2017
Created on Feb 3, 2017

This interactive bar chart visualizes the frequency of each letter in a text file, updating live as the user types in a textarea. The chart loads Peter Piper’s tongue twister asynchronously via `d3.text`, counts characters with JavaScript, and renders SVG rectangles using `d3.scaleLinear` and `d3.scaleBand`. Axes are drawn with `d3.axisBottom` and `d3.axisRight`, and the chart animates with D3’s enter/update/exit pattern on each `keyup` event.

AI-generated description

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 v4.

This is meant to be an introductory demo to expose students to HTML, CSS, JavaScript, D3.js, bl.ocks.org, and blockbuilder.org for the first time.

References

This is based off the following example:

http://bl.ocks.org/sjengle/e8c0d6abc0a8d52d4b11

It has been updated for D3.js v4 based on the following updated bar chart example:

https://bl.ocks.org/mbostock/3885304

Please see the original examples for videos and additional references.

forked from <a href='http://bl.ocks.org/sjengle/'>sjengle</a>'s block: <a href='http://bl.ocks.org/sjengle/1e23258249638a508426470a48ff2924'>Letter Count Bar Chart (d3v4)</a>

forked from <a href='http://bl.ocks.org/anonymous/'>anonymous</a>'s block: <a href='http://bl.ocks.org/anonymous/8f8acad4dbf8ca7a371601519c1bf018'>Letter Count Bar Chart (d3v4)</a>

forked from <a href='http://bl.ocks.org/15Dkatz/'>15Dkatz</a>'s block: <a href='http://bl.ocks.org/15Dkatz/a2a2b1fb551fe6f2b65c183745aa68fe'>Letter Count Bar Chart (d3v4)</a>

mit Licensed

Similar vizzes