title: How to calculate y value for given x using d3.js
body: <p>I have defined a line generator with <code>d3.js</code> as follows:</p>
  
  <pre><code>var line = d3.svg.line()
      .interpolate("monotone")
      .x(function(d) {return x(d.date); })
      .y(function(d) {return y0(d.visits); });
  </code></pre>
  
  <p>The data is read from a csv with the following format:</p>
  
  <pre><code>date,visits
  12/08/12,1
  13/08/12,0
  14/08/12,0
  15/08/12,33
  16/08/12,28
  </code></pre>
  
  <p>The csv file is loaded into <code>data</code>, and parsed as:</p>
  
  <pre><code>data.forEach(function(d) {
      d.date = d3.time.format("%d/%m/%y").parse(d.date);
      d.visits = +d.visits;
  });
  </code></pre>
  
  <p>and added to the document with:</p>
  
  <pre><code>svg.append("path")
      .datum(data)
      .attr("class", "line")
      .attr("d", line)
  </code></pre>
  
  <p>Elsewhere in my script, I need to work out what the y value is at a particular date. So for example, I might want to get a y value for the line where the date is <code>15/08/12</code> (equivalent to <code>y0(33)</code>). How can I do this?</p>