Fix chart display bug, refactor to a independent controller.