refactor redundant default chart config code