Refactored chart control