How can I get Grafana Dashboard variables, such as the $__from variable, in the Echarts panel? When I use the following JavaScript code to get this variable, I can’t retrieve it. However, it can be displayed in the panel title.
the variable working in panel title
the variable NOT working in Javascript
Use the replaceVariables()
function to replace dashboard and global variables.
const from = replaceVariables("${__from}");
See documentation:
2 Likes
Thanks a lot. i have try use replaceVariables function before, but get exception as below: ECharts Execution Error replaceVariables is not defined
, i thought that maybe echart is not compitation with grafana
Thanks, i get it now, by use context.grafana.replaceVariables('${__from}')
1 Like