Creating a now() - Time variable to colour points in world map panel


#1

Hi to all,
I’m pretty new to Grafana. I’m plotting data from the track of a moving vehicle in realtime on a worldmap panel. I have a lat/lon (geohash) point every second. I would like to display the last 10min of datapoints.
To improve the visuals, I would like to make the latest position blue, and then have the points become more and more transparent, until the point 10min ago is fully transparent.
I was thinking of using the world map Threshold feature, applied to a “minutes between now and datapoint’s timestamp” variable. Does anyone know how this could be done?
Thanks in advance!
CD


#2

I’ve made some progress. In my measurement “Gps” I added a field “Count” always equal to 1. Now I can do an InfluxDB query:

select cumulative_sum(count) AS CumulCount  FROM Gps ORDER BY time DESC  LIMIT 5
name: Gps
time                     CumulCount
----                     ----------
2019-01-10T08:50:13.212Z 1
2019-01-10T08:50:12.214Z 2
2019-01-10T08:50:11.205Z 3
2019-01-10T08:50:10.203Z 4
2019-01-10T08:50:09.193Z 5

This would work for what I want to do. Latest datapoint would have CumulCount value of 1 and point 5min ago (1Hz points) would have value 300. I can now use this to colour my World Panel datapoints with varying opacity. What I struggle with is how do I implement this in my Grafana World Map?
Thanks,
CD