the origin way is using a recursion, it's fine when there is only one data, when multiple data come in, recursion can cause performance problem.
change the function flot update
Could you explain how the existing code is recursive? The first call to update returns immediately after scheduling the second call via setTimeout.
Your change actually prevents the plot from drawing on page load, since the first call only happens after the interval expires. That is barely noticeable on account of the short default interval, but it still doesn't seem like an improvement.
Oh, I got what you mean. I used to put four groups of data in setData() at 30ms and feeling uncomfortable, actually it's much better at 1s or more. I used to treat setTimeout as a function calling it self, but it seems like an event: it triggers after sometime and return(or destroy?).
And my code make a gap between page load and plot draws, it's not friendly. I got it, thank you. I'll think twice before I made any suggestions, thanks again!