refactor.
Refactoring: display chart logic (JS).