title: Confused about D3.js : SVGAnimatedLengthList is not a function error
body: <p>I am trying to make a bar plot object using D3.js but I can seem to get it to work.</p>
  
  <p>I defined the x-scale like this:</p>
  
  <pre><code>    var Barplot = function(){
              this.x = d3.linear().....
  
      ...
  </code></pre>
  
  <p>And then I try to use the scale like this</p>
  
  <pre><code>    this.bar.append("text")
          .attr("x", function(d){
               return this.x(d) + 5;
          } 
  </code></pre>
  
  <p>However when I run this I get this error -> </p>
  
  <pre><code>    TypeError: SVGAnimatedLengthList is not a function (evaluating 'this.x(d)' ).
  </code></pre>
  
  <p>and i have no idea why especially since it will work if I change this.x to var x.</p>