some refactoring in sample wavform drawing