Fix the subtle bugs about updating and appending;
Add the codes to draw average line;
TODO: bugs or API refactoring about average line;