I’m wondering if we can update template variables from a panel.
My dashboard consists of graphs that visualize internal state of network applications. The data points are filtered by several template variables
Host name where applications are running
Process ID for an application
Some IP addresses that’s associated with an application
The problem is that process IDs and IP addresses are not very useful when choosing an application to display, because it’s hard to see if pid 8548 or 233.0.0.123 corresponds to the application in question.
In order to make this easier, I created two tables
A table pane that shows the mappings of process names and PIDs
A text pane that lists known IP addresses with their descriptions
so we can easily select a PID and an IP address. But I think it’d be even better if we were able to click a row in the table to select a PID, and click an item in the list to select an IP address.
I tried something like below in the markdown. It does update the URL in the browser but doesn[t update the variable in question.
Not currently. I wrote code in a custom plugin panel that could update template variables by hacking Grafana’s internals but Grafana does not support it yet - not for users and not for plugin developers.
I could not find an issue for exactly this. Urls like /dashboard/db/my-dashboard?var-ipaddr=233.0.0.123 work if coming from another page but your use case is when on the same page and just changing the query string parameter?
Hi,
I have exactly the same kind of problematic: I wish a panel to display data according to what I selected in another one. My first idea was to update a Template variable from a panel so it will affect other panels. I can only hope this will be feasible soon.
In the meantime, is there any other way(s) to make two panels communicate?
Thanks for the idea, that’s indeed something I could look into.
Yet, the panel that would need to be updated is a simple graph panel, and if I can avoid re-creating/writing it to just add a listener, I’d be pleased.
It is possible to update a template variable from a panel but then you will have to dig into the internals of Grafana and recreate some of the template variable code in your panel. This is something I have done myself when building a panel but not anything I can recommend as it relies on parts of Grafana that may change in the future.
I am not building a custom panel, but I would like existing panels to allow for that, and my understanding looking at your code example is that to allow for that, you will need to change each single panel. Correct? Or is there a place in common code that would provide support for that?
This code is not working.
I am using Grafana v6.2.5 (6082d19)
using custom variable and when I change the value it updates inside the model but the current value is not changing
hi! danielee ! i am facing the same problem! i am building my custom navigation plugin with react ! i wanna implement the same func as “template variables” do, what i want is, when i click a item in my custom plugin panel, then other panels’ data would change! i am looking into AdHocFiltersCtrl.ts to find some anwsers. but i found that would be difficult to hacking into this. any advices ? thanks!!!