Change Legened of Query with a static value map

Hi all,

  • What Grafana version and what operating system are you using?
    Grafana v8.4.5 (4cafe613e1)

  • What are you trying to achieve?

    I would like to change the Legend of an Query (displaying currencies of an game) depending on label {{id}} (that from the query) with a static list / map / json / … but I did not find a solution.

    My panel looks like this at the moment:

    The real description / text of currencies are not in the prometheus-metrics - only the id’s are in the data. I don’t want to store the name in the prometheus-data because that are static data. The text of the currencies are in an static json that I would like store in grafana itself. It’s should look like:

    {
      "1" : "Coin",
      "2" : "Karma",
      "14": "Gem",
      "15": "xxxx",
      "19": "yyyyy",
      ...
    }
    
  • What happened?

    The Data from the variables are not mixed with the {{id}} from the query.

  • How are you trying to achieve it?

    I have tried different approches with variables (custom, query and constant) but I didn’t get the result that I would like to have.

    • [{"__value":"1","__text":"Coin"},{"__value":"2","__text":"Karma"}]
    • 1 : Coin,2 : Karma
    • {"1" : "Coin","2" : "Karma"}

    And tried to use this in the Legend field of the query like:

    • $currencies{{id}}
    • $currencies.{{id}}
    • $currencies\.{{id}}
    • and something other that I found n the web
      but I didn’t found anything that work’s
  • What did you expect to happen?

    Here a small picture what I would like to to achieve - I have manipulated the data via Browser Inspector for the first rows.

  • Did you follow any online instructions? If so, what is the URL?

    I looked for many post’s and guide’s in the web:

Can someone help me with this topic or is this not intended to do this with grafana?

Thank
Zero