Variables
Use the replaceVariables()
function to replace dashboard and global variables.
const email = replaceVariables("${__user.email}");
You can get familiar with three types of variables in our Grafana Crash Course.
Replace Variables
In the following example, we replaced the series's name with a value from the variable.
Example
docs/volkovlabs-echarts-panel/js/replace.js
loading...
Update Variables
You can update dashboard variables with event handlers, where
name
is the name of the variable. Addvar-
to update the variable value in the URL.value
is the updated value.
echartsInstance.on("click", (params) => {
locationService.partial({ "var-name": value }, true);
});