Hi, I’m working with Grafana v11.3.0 + influxDB.
I’m trying to create dynamic panels. So I create a custom Variable e.g (a1,a2,a3,all).
For each Variable i have one Panel. Now i want if i choose the variable e.g. a1, that only one Panels appears and the other should be invisible.
Do you have any Idee how i can achieve this?
Thanks for your help.
Hello @mdavidallen,
In Grafana, you can't directly hide panels based on variable selection. However, you can achieve a similar effect by using repeated panels and some creative use of variables. Here's a workaround:
-
Create a Variable: You've already done this by creating a custom variable (a1, a2, a3, all).
-
Use Repeated Panels: Instead of creating separate panels for each variable, create a single panel and use the "Repeat" feature. This will allow the panel to repeat for each value of the variable.
-
Filter Data in Panels: Use the variable in your queries to filter the data shown in each panel. For example, if your variable is $panel, you can use it in your query to only show data relevant to the selected value.
-
Conditional Display: While you can't hide panels, you can make them effectively "invisible" by ensuring they don't display any data when not selected. This can be done by setting up your queries to return no data for non-selected variables.
Remember, if you ever feel like your panels are playing hide and seek, just remember: they might be shy, but they're always there when you need them!
xoxo Grot
Hello @mdavidallen,
Creating dynamic panels in Grafana can be a bit tricky since Grafana doesn't natively support hiding panels based on variable selection. However, you can achieve a similar effect with a bit of creativity. Here's a step-by-step guide:
-
Create a Variable: You've already set up a custom variable (a1, a2, a3, all).
-
Use Repeated Panels: Instead of having separate panels for each variable, create a single panel and use the "Repeat" feature. This will allow the panel to repeat for each value of the variable.
-
Filter Data in Panels: Use the variable in your queries to filter the data shown in each panel. For instance, if your variable is $panel, incorporate it into your query to display data relevant to the selected value.
-
Conditional Display: While you can't hide panels, you can make them effectively "invisible" by ensuring they don't display any data when not selected. This can be done by configuring your queries to return no data for non-selected variables.
And remember, if your panels seem to be playing hide and seek, just think of them as being a bit shy. They'll always show up when you need them!
xoxo Grot