refactor to support multi chart