Change name value based on value

In grafana8, I have a pie chart graph, it has labels showing the value name and the value.
e.g.
john Value: 5
peter Value: 3
Lincoln Value: 1

I would like to add an emoji to number 1 on the list (and it should work dynamically) - so whomever has the highest value will have a crown (:crown:) prepended (or appended) to his/her name…

Is it possible (maybe with transformation or field overrides) ?

Yes that should work I have done a similar thing to override a compass bearing value 0-360 to substitute the number ranges with North, South, East and West. Similarly some String Values I have replaced the BLOCK TEXT output from an appliance for some more friendly CamelCase.

Thanks @brew
How exactly did you achieve this?

Value Mappings in this instance

@brew Thanks… but I only need to change the display label for a single value name (the one with the highest value).

So in my example:

john Value: 5
peter Value: 3
Lincoln Value: 1

I want to display:

:crown: john Value: 5
peter Value: 3
Lincoln Value: 1

and if Lincoln all of a sudden has the highest value:

:crown: Lincoln Value: 7
john Value: 5
peter Value: 3

Ah sorry I think you are now into complex queiries which is beyond me.

You could add the :crown: after the name

Value Mappings
1 → :crown: 1

Thus you could get
John: 5
Peter: 3
Lincoln: :crown: 1

sure… but how do I determine which one is highest value? The “crown” should only be added to the user (or value) that has the highest value

Sorry I think this then needs to be a more complex query which is beyond me.

1 Like

What is your data source. In sql one can do the following

1 Like

I am using elasticsearch as src

could you please post a sample es doc? (obfuscating sensitive data but keeping “schema” intact)

Then with infinity, you can use jsonata and work out the details