grafana/scenes

Diagram Legend rename

korinekgergely opened this issue · 1 comments

Question: Is there a simple, clean way to dynamically rewrite the legends in the diagram? Like so that the metric name can be included? I don't want to use the (in our case) crazy default names.

Right now I am working on a solution that is probably not the cleanest. I wrote a behaviour for it that operates with subscribeToState. I'm using the following path to override in it:
parent.state.data.series[i].fields[1].config.displayNameFromDS = blabla
It works, but hey :)
Monosnap Monview App - Apps - Grafana 2024-02-12 21-01-22
Thank you in advance.

if it's a prometheus query the easiest way is to set the legendFormat on the query. you can use label expressions