title: How to customize the color scale in a D3 line chart?
body: <p>How do I change the color of lines in a d3 line chart, for example in Mike Bostock's multi-series D3 <a href="http://bl.ocks.org/mbostock/3884955" rel="noreferrer">line chart</a>.</p>
  
  <p>In his example chart, Mike Bostock uses D3's built-in "category10" color scale, as per this line of code:</p>
  
  <pre><code>var color = d3.scale.category10();
  </code></pre>
  
  <p>But suppose, instead of the built-in scale, we wanted the line for Austin to be blue, the line for New York to be red, and the line for San Francisco to be green. Should be simple enough, right? Just define a custom color scale:</p>
  
  <pre><code>var color = d3.scale.ordinal()
      .domain(["New York", "San Francisco", "Austin"])
      .range("#FF0000", "#009933" , "#0000FF");
  </code></pre>
  
  <p>I thought that might do the trick – but it turns all the series black. I've tried CSS styling each series by appending classes to them, but that didn't work.</p>