Change diagram dynamically

Is there an option to change the diagram itself dynamically?

You’ll have to explain a bit more. There is a refresh option in the time picker that refreshes the graph every x seconds where 5 seconds is the minimum. Is that what you mean by changing the diagram dynamically?

Hi Daniel,

I want to change the diagram itself, what you set in the diagram tab

I still don’t understand. What do you mean by dynamically? With code? Through an integration? Is this a question about the Grafana API?

Currently, as I understand, you need to define the diagram itself in the diagram tab. I wanted to know if there is a way / API to change the diagram definition.
The thing that change dynamically are the metrics, I want to change the diagram structure.

E.g. define first:

graph TD;

and then with API / other way change it to:

graph TD;

You can update the JSON for a dashboard with the API:

Thx, this is what I thought, i was hopping there is a way to update only specific panel or sending the plug in directly …

It will be great if there will be a way to update specific panel and not all the dashboard.

Thx for the help.


I am using this technique to update the diagram. The issue I am facing is that if the current dashboard is the dashboard with the diagram, it doesn’t update. I need to switch to another dashboard and return back to see the changes.

Is it expected? any way to overcome this behavior?


You mean that you update the dashboard with the api and the dashboard is not automatically updated? No, that is not a use case that is covered by Grafana yet. In the future, we are going to use websockets to broadcast changes but we haven’t got that far as of yet.

So even the refresh button doesn’t update the dashboard, am I right (at least this is what I see)?

You have to refresh the page (browser refresh). The refresh button runs the queries and does not refresh the dashboard JSON. Your use case is not common (I can’t even find a feature request for this) and so there is no support for this workflow.