Combine lines in the diagram where there are missing values

It is necessary to combine lines in the diagram where there are missing values.