added $field to chart function