title: Making histogram of frequency of words
body: <p>So I have successfully created a histogram of frequencies of numbers. I'd like to do the same with words. </p>
  
  <pre><code>bins = [1,1,1,2,3,4,4,4,4,5,5,6,6,6,2,2,3,3,1,23,54,6,6,7,6,5,4]
  
  @svg = d3
    .select('.histogram')
    .append('svg')
    .attr('width', @model.get('width'))
    .attr('height', @model.get('height'))
    .append('g')
  data = d3
    .layout
    .histogram().bins(bins.length)(bins)
  bar = @svg
    .selectAll('.bar')
    .data(data)
    .enter()
    .append('g')
  bar
    .append('rect')
    .attr('x', 0)
    .attr('y', (d) -&gt; return d.x*5)
    .attr("width", (d) -&gt; return d.y * 20)
    .attr("height", 5)
    .attr('fill','steel')
  </code></pre>
  
  <p>I'd like to build a histogram of frequencies for an array like this -</p>
  
  <pre><code>    bins = ['hello','hello','goodbye','goodbye','beatles','kill','harry','harry']
  </code></pre>
  
  <p>how do I go about doing that? It seems like using the histogram layout's value function would be a good bet, but that implies I need to maintain state somehow. Also, I'd like it so that the word appears as a label next to its associated bar.</p>
  
  <p>Thanks</p>