title: d3 line disappears on data update
body: <p>I am building a graph where the data is changing on user update. There are 3 horizontal lines which marks thresholds moving along with the y scale. My code was running correctly, but now I noticed that one line just disappears. However it is only happening on the first data change. If I selected other data the 2 lines are not disappearing. I have no idea how this happened or where I changed anything with the line code...<br>
  I am using d3 v5.  </p>
  
  <p>This is my line data:</p>
  
  <pre><code>lineData = [
  { key: 'high',
    values: [
      {type: 'high', year: 1996, value: 1}, 
      {type: 'high', year: 2016, value: 1}
    ]},
  { key: 'medium',
    values: [
      {type: 'medium', year: 1996, value: 0.8}, 
      {type: 'medium', year: 2016, value: 0.8}
    ]},
  { key: 'low',
    values: [
      {type: 'low', year: 1996, value: 0.7}, 
      {type: 'low', year: 2016, value: 0.7}
  ]}
  ];
  </code></pre>
  
  <p>This is my code for plotting:  </p>
  
  <pre><code>BarBackChart = function(_parentElement, _risk) {
  this.parentElement = _parentElement;
  this.risk = _risk;
  
  this.initVis();
  };
  
  BarBackChart.prototype.initVis = function() {
  let vis = this;
  vis.margin = { left: 50, right: 20, top: 10, bottom: 50 };
  vis.height = 450 - vis.margin.top - vis.margin.bottom;
  vis.width = 625 - vis.margin.left - vis.margin.right;
  
  //Init svg to draw in
  vis.svg = d3.select(vis.parentElement)
    .append('svg')
    .attr('width', vis.width + vis.margin.left + vis.margin.right)
    .attr('height', vis.height + vis.margin.top + vis.margin.bottom)
    .attr('class', 'plot-area');
  vis.g = vis.svg.append('g')
    .attr('transform', `translate(${vis.margin.left}, ${vis.margin.top})`);
  
  vis.t = 1000;
  
  //Define plot titles
  vis.g.append('text')
    .attr('x', vis.width/2)
    .attr('y', 0)
    .attr('text-anchor', 'middle')
    .text(vis.risk);
  
  //Define scale types
  vis.x = d3.scaleBand()
    .range([0, vis.width])
    .padding(0.2);
  vis.xLine = d3.scaleOrdinal()
    .range([0, vis.width], .09);
  
  vis.y = d3.scaleLinear()
    .range([vis.height, 0]);
  
  //Define axis 
  vis.xAxisCall = d3.axisBottom(vis.x);
  vis.yAxisCall = d3.axisLeft(vis.y);
  
  vis.xAxis = vis.g.append('g')
    .attr('class', 'x-axis')
    .attr('transform', `translate(0, ${vis.height})`);
  
  vis.yAxis = vis.g.append('g')
    .attr('class', 'y-axis');
  
  //Define lines
  vis.line = d3.line()
    .x(d =&gt; vis.xLine(d.year))
    .y(d =&gt; vis.y(d.value));
  //Set line colors
  vis.lineColorScheme = ['#e79e27', '#044b87', '#04873f'];
  vis.lineColor = d3.scaleOrdinal()
    .range(vis.lineColorScheme)
    .domain(lineDataLong.map(d =&gt; d.key));
  
    vis.wrangleData();
  }
  
  BarBackChart.prototype.wrangleData = function() {
  //BACK DATA
  let vis = this;
  
  for(let i = 0; i &lt; nestedBackData.length; i++) {
    if(nestedBackData[i].key === vis.risk) {
      vis.datafiltered = nestedBackData[i].values;
    }
  };
  vis.minYear = Math.min(...([...new Set(vis.datafiltered.map(item =&gt; item.year))]));
  vis.maxYear = Math.max(...([...new Set(vis.datafiltered.map(item =&gt; item.year))]));
  
  vis.range = range(vis.minYear, vis.maxYear);
  vis.datafiltered = fillYears(vis.datafiltered, vis.range, 0);
  
  vis.updateVis();
  }
  
  BarBackChart.prototype.updateVis = function() {
  let vis = this;
  
  ///////////////// AXIS /////////////////
  //UPDATE SCALES
  vis.x.domain(vis.datafiltered.map(d =&gt; d.year));
  vis.y.domain([0, yMax]);
  
  //UPDATE AXIS
  vis.xAxis
    .transition().duration(vis.t)
    .call(vis.xAxisCall)
  .selectAll('text')  
    .style('text-anchor', 'end')
    .attr('dx', '-.2em')
    .attr('dy', '.55em')
    .attr('transform', 'rotate(-45)');
  
  vis.yTicks = vis.y.ticks();
  vis.yTicks.push(0.7);    
  
  vis.yAxis
    .transition().duration(vis.t)
    .call(vis.yAxisCall
      .tickValues(vis.yTicks))
      .attr('class', 'line');
  
  ///////////////// LINES /////////////////
    vis.lines = vis.g.selectAll('.line')
      .data(lineData)
    .attr('class', 'line');
  
  vis.lines.exit()
    .remove();
  
  vis.lines.enter()
    .append('path')
      .attr('class', 'line')
      .attr('d', d =&gt; vis.line(d.values))
      .style('stroke', d =&gt; vis.lineColor(d.key))
      .style('stroke-width', '3px')   
      .style('stroke-opacity', .65)
    .merge(vis.lines)
      .transition().duration(1250)
      .attr('d', d =&gt; vis.line(d.values));
  
  }
  </code></pre>