add real time plot function for histgram