Refactor to document/object
Refresh chart automatic after change settings