title: Add labels to d3 line graph
body: <p>I am using D3.js to create a simple line graph.</p>
  
  <pre><code>&lt;div&gt;
      &lt;h6&gt;Price Over Time&lt;/h6&gt;
      &lt;div id="priceOverTimeChart"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  // Set the dimensions of the canvas / graph
      var margin = {top: 30, right: 20, bottom: 30, left: 50},
          width = 800 - margin.left - margin.right,
          height = 270 - margin.top - margin.bottom;
  
      // Parse the date / time
      var parseDate = d3.time.format("%d-%b-%y").parse;
  
      // Set the ranges
      var x = d3.time.scale().range([0, width]);
      var y = d3.scale.linear().range([height, 0]);
  
      // Define the axes
      var xAxis = d3.svg.axis().scale(x)
          .orient("bottom").ticks(10);
  
      var yAxis = d3.svg.axis().scale(y)
          .orient("left").ticks(10);
  
      // Define the line
      var valueline = d3.svg.line()
          .x(function(d) { return x(d.date); })
          .y(function(d) { return y(d.close); });
  
      // Adds the svg canvas
      var svg = d3.select("#priceOverTimeChart")
          .append("svg")
              .attr("width", width + margin.left + margin.right)
              .attr("height", height + margin.top + margin.bottom)
          .append("g")
              .attr("transform", 
                    "translate(" + margin.left + "," + margin.top + ")");
  
      // Get the data
      d3.csv("data.csv", function(error, data) {
      data.forEach(function(d) {
          d.date = parseDate(d.date);
          d.close = +d.close;
      });
  
      // Scale the range of the data
      x.domain(d3.extent(data, function(d) { return d.date; }));
      y.domain([0, d3.max(data, function(d) { return d.close; })]);
  
      // Add the valueline path.
      svg.append("path")
          .attr("class", "line")
          .attr("d", valueline(data));
  
      // Add the X Axis
      svg.append("g")
          .attr("class", "x axis")
          .attr("transform", "translate(0," + height + ")")
          .call(xAxis);
  
      // Add the Y Axis
      svg.append("g")
          .attr("class", "y axis")
          .call(yAxis);
  
  
      });
  </code></pre>
  
  <p>The data for the line graph uses the following data format:</p>
  
  <pre><code>26-Apr-12,0.048
  25-Apr-12,0.048
  24-Apr-12,0.048
  </code></pre>
  
  <p>I would like to add an optional string to each record so it looks like:</p>
  
  <pre><code>26-Apr-12,0.048, "product 1 launch",
  25-Apr-12,0.048, "product 2",
  24-Apr-12,0.048, "product 3"
  26-Apr-12,0.048, null
  25-Apr-12,0.048, null
  24-Apr-12,0.048, null
  </code></pre>
  
  <p>The graph would then look something like this with the labels on it:</p>
  
  <p><a href="https://i.stack.imgur.com/JBy8D.jpg" rel="nofollow noreferrer">Graph with optional labels</a></p>
  
  <p>How can I accomplish this? Thanks in advance!</p>