Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coloring based on time, not number #71

Open
MrBoggi opened this issue Sep 8, 2020 · 6 comments
Open

Coloring based on time, not number #71

MrBoggi opened this issue Sep 8, 2020 · 6 comments

Comments

@MrBoggi
Copy link

MrBoggi commented Sep 8, 2020

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

@amotl
Copy link

amotl commented Dec 7, 2020

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.

@wetterfrosch
Copy link

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.

@wetterfrosch
Copy link

wetterfrosch commented Dec 8, 2020

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;
        }
      }

@edornd
Copy link

edornd commented Feb 9, 2021

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!

@amotl
Copy link

amotl commented Feb 12, 2021

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.

@edornd
Copy link

edornd commented Feb 18, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants