grafana / scenes

Build Grafana dashboards directly in your Grafana app plugins.
https://grafana.com/developers/scenes
Apache License 2.0
141 stars 21 forks source link

Diagram Legend rename #594

Closed korinekgergely closed 9 months ago

korinekgergely commented 9 months ago

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.

torkelo commented 9 months ago

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