title: How to assign colors according to a index in d3.js?
body: <p>I'm trying to get a color according to a metricValue variable (an integer) but the code below is returning the same color #1f77b4. What am I doing wrong?</p>
  
  <pre><code>function getColorForNode(d) {
      var p=d3.scale.category10();
      var metricValue = metrics.getScore(d.id)
      return(p(metricValue)); // Returns the same color independently of metricValue
  }
  </code></pre>