Create class Chart. Refactor all code. Increase flexibility the settings.