How to show graph while detecting pulse