Code refactoring of Chart part