Hello, I’m using Grafana 13.2.0 and a postgreSQL datasource.
Since I faced a issue with my post here and as it appears it is a known issue on Grafana I’m asking a more general question to get some ideas on how to do what I would like to have (or at least get the closer at possible).
When I’ll select a ship, then a system, and then an equipment, I’ll get a list of tag_name on the right panel (If I change system or equipment the list will change). Then, I would like to be able to click on the tag_name or alias so it appears on the timeserie panel on the right. This is easy using links. The tricky part is I would like to do mutliple selection from the right panel to show multiple tag_name on the timeseries. I was not able to find a solution using links to add/remove a value on a multi-value variable. Moreover, I’d like to be able to change the variable system and equipment without loosing the initial selection. For exemple I’d like to be able to select a tag_name in the equipment “propulsion” (like on the screenshot) AND in the equipment “engines” (a different tag_selection will appear)
If you have some idea to start with, or dashboard using similar functionnality your insight will be much appreciated.
The cleanest approach is to separate the available tags from the selected tags.
Use chained variables for ship → system → equipment, with the right side table showing the tags available for the current equipment. Grafana documents chained variables for dependent selections.
A multi value variable can handle selecting multiple tags.
However, Grafana’s documented variable and data link features don’t provide a native mechanism for the add/remove/toggle behavior you described while preserving the selection across changing dependent variables.
For the exact behavior, keep the selected tag state separately, for example through a small API/backend or custom panel/plugin. The table can trigger an action to add/remove a tag, while the time-series query uses the complete selected-tag list. Grafana actions support API calls and dashboard variables.
This would allow you to select tags from propulsion, switch to engines, select additional tags, and retain the previous selections.
Thanks for the clear explanation. I indeed already identified all the diffrerent piece of the solution (chain variable, multi-value variable and links) but I was missing the link between them all : the small API/backend or custom panel/plugin.
Unfortunately I do not have the skill and the knowledge to develop such things. I’ll have to keep using native Grafana solution, even that could be not that simple :). I’ll try to think of an alternative that could meet my need.
Following up with something you can actually build today, no backend required for the add half .
Grafana data links support a queryparam format specifier: ${selected_tags:queryparam} expands to the current selection of a variable as repeated var-selected_tags=... params.
Renavigates with the row’s tag appended to selected_tags a separate, flat multi-value variable that’s not part of your ship→system→equipment chain.
Point your timeseries query at $selected_tags instead of $tag_name, and picks from propulsion and engines will coexist in the same list since switching equipment never touches selected_tags.
For that last mile, drop a Business Variable panel (Minimize or Button mode) bound directly to selected_tags next to your timeseries it gives a normal multi-select UI to deselect individual tags.
Dashboard settings (gear icon) → Variables → + Add variable
Name: selected_tags, Type: Custom
Values: leave empty (if it won’t save empty, use a placeholder like none)
Multi-value: ON, Include All: OFF
Save the variable, then save the dashboard
Test whether it accepts values outside its list
Load your dashboard, copy its URL
Append &var-selected_tags=foo&var-selected_tags=bar to the end and load that URL
Open Variables settings → click selected_tags → check what it shows as selected
Does it show both foo and bar?
Thanks to Business Variable Panel I was able to make it more userfriendly for the selection. I have a panel for the selection and another one for the selected.
Another work around using Business Variable is to use the TreeView functunnality:
All the tags are listed but in a treeview panel, you can filter, show only the selected tags,… Very useful functionnality.
Now I’ll work on the favorite functionnality to save preset of tag selection. I’ll try to use a variable for selected_tags_list_name and store the favorite in a table where Grafana can read&write.