Refactoring the google chart