Create Link (HTML) to Dashboard with variable

I’m building 2 different dashboards. The first one will present information about classes, like:

Nr Users:
Computer | Phones | …

The second one, will present information specifically about Computers, for example.
So, my second dashboard, has an Variable, and each type will be: Computer, Phones, Tables, etc.

I have a query that returns each of the classes per order.
I want to create, for example an button, in which i click and i go to the second dashboard, for the class (of the variable) of the corresponding button.

For example:

I tried with an HTML button, by i have no idea how to link the variable between dashboards and query the title “computers” for the button. The link must be dynamic, based on the query result.

Hello,

What you are looking for are Data links. How to add a data link to a panel depends on the visualization you choose but here is a quick example I made on a Stats panel (also I’m on Grafana 7.1.4).

  1. Here is the Stat panel with 4 series for each datacenter I want to show a value for:

  2. Then, in Field > Data links, I add a data link with this configuration. I want the variable value to take the name of the serie (Africa, America, Asia or Europe in my case) but you can access different variables in your data link. You’ll find more information on this in the documentation. The URL is made like this /d/<dashboard_guid>/<dashboard_slug>?(orgId=1)&<variable_name>=<variable_value>.

  3. That’s it. Now, you should be able to click anywhere in your Stats panel and it shows you the data link title of the serie you click on.

I hope it helps! If you have trouble setting this up for your use case, feel free to ask more specific questions here.

Thanks! Another question.
In my 2nd dashboard, i have a global variable Computers selected.
Is there anyway i can print the word “Computers”, from the variable value, in an text panel?

Sure, if you use this syntax ${<variable_name>}, it prints the variable value(s). You can use this in panel title, text panel, queries…

2 Likes

You are the best! Thanks :slight_smile:
One more question. Is it possible to share my Grafana dashboard as an individual page (without all those Grafana’s menus/options), like an simple website?

In addition to above accepted answer one more thing which other may face:
You need to define one constant variable (or may be other type - I have tested with constant) on landing dashboard with same name which you are passing in URL.
Define a dummy variable on target (landing) of same name which you are passing in URL to access that variable in target dashboard.
This issue I am facing in grafana 8.1.2 and above worked for me.