logic for google charts