title: How to add an if condition in my d3js example
body: <p>consider the jsfiddle link <a href="http://jsfiddle.net/5D5eD/5/" rel="nofollow">http://jsfiddle.net/5D5eD/5/</a>. It has data values [2,2],[3,3],[4,4],  [5, 4],[5.5, 5],[6, 6],[6, 7],[5,6]. Here in this example the last two values are [6,7] and [5,6]. I want to add a condition i.e if y value is lesser than previous value then the datapoint should increment the y value by 1 unit. In my case the line from [6,7] to [5,6] should be replaced by a line from [6,7] to [5,8]. How to achieve this in the code ?</p>
  
  <pre><code> var line = d3.svg.line()
   .x(function(d){return x(d[0]);})
    .y(function(d){return y(d[1]);})
   .interpolate("linear");  
  
     g.append("path")
    .attr("d", function(d) { return line(data)})
    .attr("transform", "translate(0,0)")
     .style("stroke-width", 2)
          .style("stroke", "steelblue")
          .style("fill", "none");
     // end of drawing lines
  
         main.append("g")
     .attr("class", "grid")
     .attr("transform", "translate(0," + height + ")")
     .call(make_x_axis()
     .tickSize(-height, 0, 0)
     .tickFormat(""))
  
      main.append("g")
     .attr("class", "grid")
     .call(make_y_axis()
     .tickSize(-width, 0, 0)
     .tickFormat(""))
  
      function make_x_axis() {
      return d3.svg.axis()
      .scale(x)
      .orient("bottom")
       .ticks(30)
       }
  
      function make_y_axis() {
      return d3.svg.axis()
      .scale(y)
      .orient("left")
      .ticks(17)
      }
  </code></pre>