Graph formatter now receives a query as input