refactored chart code into two view extensions