Correct method for drawing waveforms
Remember that the signal is not the samples; the signal passes through the samples and exists between them, too.  So the maximum value of one chunk cannot be less than the minimum value of the next; they can only be equal, as the signal passes from a lower sample in one chunk to a higher sample in the next chunk.

Plotting a solid line from the min of a chunk to the max sample value of a chunk is not a very accurate representation of the signal anyway (because of intersample peaks and not showing the density of the wave).  If that's good enough of a representation for you, I'd just approximate it by drawing to the midpoint in this case:

find max of chunk 1
find min of chunk 2
if max(chunk 1) &lt; min(chunk 2):
    in column 1: draw line from min of chunk 1 to average(max(chunk 1), min(chunk 2))
    in column 2: draw line from average(max(chunk 1), min(chunk 2)) to max(chunk 2)


If you want to get fancier, you could upsample the signal to get a better idea of the intersample peaks, and then do the same thing based on those.

And the best is to use brightness to show the density of the wave at different amplitudes, but that's significantly more complicated: https://flic.kr/p/7S8oHA