anchor.diff:        max_gr = max_gr == 0 || max_gr == null || max_gr < point.glrat ? point.glrat : max_gr;
       }
   
  -    if (isLast && elev_data.length > 0) {
  +    if (end_found && elev_data.length > 0) {
         if (current_point.elevation <= min_val && charts_data.hasOwnProperty(index - 1)) {
   
           point = clone(current_point);
  
positive.code: 
          }
        }
  
        isLast = false;
  
        dist += point.distance;
        elev += point.elevation_diff;
  
negative.code:   set_chart_data();
    updateRangeSelector();
    updateUnits();
  }
  