title: How to assign random colors to D3 bar chart?
body: <p>I am working on a D3 bar chart as per the mock-up below:</p>
  
  <p><img src="https://i.stack.imgur.com/dZAJm.png" alt="Bar Chart"></p>
  
  <p>How do I make the bars to have random colors?</p>
  
  <p><a href="http://jsfiddle.net/rdesai/MjFgK/" rel="nofollow noreferrer">jsFiddle</a></p>
  
  <p>Code:</p>
  
  <pre><code>svg.append("g")
  .attr("class", "x axis")
  .attr("transform", "translate(0," + height + ")")
  .call(xAxis);
  </code></pre>