I think that your binary file is not ok. Your read function sometimes returns an array of 7 waveforms and sometimes an empty array. When you send values to a chart, you must make sure that you allays send the same amount of channels, otherwise it will clean up all the pass data and begin with the new channel number.