grolegor
grolegor

Reputation: 1320

How to hide panel by specific condition in grafana

I want to hide some panel by specific condition in graphana. For instance, I have some variable in my dashboard and I want to change visibility of some graph if my variable is equal to some specific value. Is there any way to do this?

UPD: Using repeat panel option is not solution in my case, because this option just dynamically creates new panels. But I want to hide some panel by specific value of my variable, if variable is not equal to this value then the panel should not be hidden.

Upvotes: 5

Views: 12127

Answers (2)

samjewell
samjewell

Reputation: 1168

There's a Github Issue where many people are after the same thing - see https://github.com/grafana/grafana/issues/4470

There's no direct fix yet unfortunately, but there is something of a workaround/alternative, which I have described here: https://github.com/grafana/grafana/issues/4470#issuecomment-2273061234

I'd suggest starting from HiddenWhenNoDataBehaviour(), and updating it from a "no data" case to the case you are concerned with. I realise many people won't want to or feel equipped to develop a React app, and deploy it into their Grafana instance however - sorry if this isn't for you.

Upvotes: 0

Akhil Pasha
Akhil Pasha

Reputation: 411

I dont see an option to hide/show a panel with template variable, but instead you can create two dashboards and use dashboard links.

For example:

First Dashboard (Type A) Second Dashboard (Type B)

Create a Dashboard link "Type B" in First Dashboard pointing to second Dashboard. Similarly Create a Dashboard link "Type A" in Second Dashboard and point it to First dashboard.

Settings -> Link -> New Link -> Choose "Include time range" & "Include template variable value"

New Dashboard Link

I have actually used this option because mine was just two variables so it was duplicating the dashboard to two and linking eachother.

enter image description here

If it is multiple values to show/hide, i recommend to achieve it via repeat options some how linking that variable in your query.

Upvotes: 3

Related Questions