Ordering of elements for stacked line graph

I have an issue with graphing a dataset. The datasource is InfluxDB, the data is a series of traceroutes with multiple values I am attempting to use in a stacked line graph. Everything is working well except that the values are ordered by the IP address of each hop rather than the hop number, so the question is how can I use a different value in the set to order the output.

The query is

SELECT “rtt” FROM “path” WHERE (“sensu_entity_name” =~ /^agent/) AND $timeFilter GROUP BY “addr”, “hop”

with format as time series and alias by set to hop $tag_hop ($tag_addr)