grafana-toolbox / panodata-map-panel

Map Panel for Grafana with improved convenience, robustness and features. Friendly fork of the original Grafana Worldmap Panel. Currently not maintained, but verified to work up to Grafana 9.

Home Page:https://community.panodata.org/t/grafana-map-panel/121

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coloring based on time, not number

MrBoggi opened this issue · comments

I would like to have the possibility to color my points based on time since last update rather than on a count.

Dear Morten,

thanks for writing in and sorry for the delay. A solution to your request would be a database query which translates the delta to the last update timestamp into the metric value, if that would be possible at all? Maybe @wetterfrosch has a quick idea how that could be achieved.

With kind regards,
Andreas.

A solution to your request would be a database query which translates the delta to the last update timestamp into the metric value, if that would be possible at all? Maybe @wetterfrosch has a quick idea how that could be achieved.

My first thought was not what we are looking for: Depending on the database one might get the time as a value-metric from there. (When querying *SQL one has to explicitly name the desired time-column as time, so one could just change that. Within InfluxDB one can use the duplicate() function.)

But the desired way would be to handle what-comes-as-time from the databases as a value. My only thought so far on this is: Maybe have a look in the stat panel of Grafana where one can select "time of last value" as a metrik to display.

Maybe have a look in the stat panel of Grafana where one can select "time of last value" as a metrik to display.

Oh, I see that this was a feature of the now deprecated singlestat panel and is not (yet?) implemented in its successor.

Looking at https://github.com/grafana/grafana/blob/master/public/app/plugins/panel/singlestat/module.ts I stumble upon:

{ value: 'last_time', text: 'Time of last point' },
and

      if ('last_time' === calc) {
        if (fieldInfo.frame.firstTimeField) {
          calcField = fieldInfo.frame.firstTimeField;
          calc = ReducerID.last;
        }
      }

Hello everyone,

sorry for bringing up an older issue, but I believe it's related: I'd like to "detach" the size and color by using field A for the former and field B for the latter.

Example: I have 40 warning alerts in a location, I'd like for instance a yellow circle with size: 40 on that location, while the 23 error alerts should be displayed in red with size: 23.

Is this already possible with the current implementation? If so, how?

I am currently using a PostgreSQL data source, if it can be relevant. So far I managed to display data with correct sizes, but I'm missing the color-coded step.

Thank you very much!

Hi Edoardo,

thanks for writing in. While I like the idea, I fear this is currently not possible. AFAIK, only one metric value will be able to control the size of the circle while the color can be selected based on respective thresholds applied to this value.

However, we will always be happy to accept patches in order to bring in such features and improvements.

With kind regards,
Andreas.

Hi Andreas,
Thanks for the clarification, I suspected it wasn't feasible yet (just making sure).
I am not a frontend developer, but I'm willing to give it a try, even just to fork and "monkey patch" for my use case. Could you just point me on possible sections of code where it could be easier to tackle this?

I guess this function could be a good starting point? Just need to understand the data flow from the UI to this.