title: Logarithmic range
body: <p>I have a very sparse dataset and I want to plot it in a histogram with a logarithmic scale. I would like the X axis to look something similar to:</p>
  
  <p>[1, 10, 100, 1000, 10000]</p>
  
  <p>Meaning that the first bin would include the observations with a cost of 1-10, the second 11-10 and so on, and the last would be +10.000. </p>
  
  <pre><code>function (pow, min, max) {
      var range = [];         
      for (i = min; i &lt; max; i++) {
          range.push(Math.pow(pow, i));
      }
      return range;
  }
  </code></pre>
  
  <p>I am able to generate the given array of powers of 10. Now, what I would like is to map a set of continuous values to that array, meaning that:</p>
  
  <p>[1, 23, 2, 105, 2000, 30000]</p>
  
  <p>would be output as: </p>
  
  <p>[1, 10, 1, 100, 1000, 10000]</p>
  
  <p>I have tried using d3.scale.threshold, but it does not seem to be working as expecting.</p>