Refactoring. More readable and chart is drawn only after HTTP request