Getting dashboard to refresh through code

I’m using apache echarts and I have the following code:"click");
echartsInstance.on("click", (params) => {
  console.log("Clicked column name is:",;
  $testing =
  console.log("The variable name is:", $testing)


After the last line, I want to be able to refresh the entire dashboard or even specific visualisations so that the new variable is applied to the chosen visualisations and filtered upon.


1 Like

@zyan It’s described in the documentation. When you update variables using locationService dashboard will refresh automatically. Nothing else is required.

1 Like

Thank you for your reply.
I have similar requirements.Preformatted text
Somehow I use locationService to set the variables dynimacally, it partly works and I can see the URL contains necessary GET parameters. However the dashboard does not refresh and so visualizations stay unchanged. I am using on click event, setting two variables that are otherwise are set by OpenSearch query.
here is th code:

echartsInstance.on("click", function (params) {
  line = params['name'];
  plant = replaceVariables("$Plant");
  locationService.partial({ "Plant": plant }, false);
  locationService.partial({ "Line": line }, false);
1 Like

@dmitrylesh If variables are changed, but panels don’t use variables in the query, then won’t be refreshed.

Also, have you tried to replace parameter to true? Add support for variables | Grafana Plugin Tools

Thank you @mikhailvolkov
Is there any way to force refresh instead of just reloading the whole page with the right values for variables?

1 Like

@dmitrylesh There is a way using Application Event Bus, which we recently added for the Data Manipulation panel.

We are wrapping up a new release of the Apache ECharts and we can include it: Add refresh function using Application Event Bus · Issue #246 · VolkovLabs/volkovlabs-echarts-panel · GitHub

1 Like

thanks a lot!

Hi, Just wanted to share a small update here.
It looks like to set variable and to reload the visualization we have to specify:
locationService.partial({ "var-Line": line }, true);
instead of
locationService.partial({ "Line": line }, true);


@dmitrylesh Good catch. That’s correct, var is required for the dashboard variables.