How to change refresh-picker value from within my plugin?

For example: I want to make a button inside my panel, that changes the refresh-picker to ‘5s’.
I can see that RefreshPicker.tsx is extending PureComponent but I still don’t know how to use it…

Also: is it possible to change only one panel’s refresh rate?

If you’re referring to the refresh picker in the grafana/ui package, that’s only the UI control.

To update the refresh value itself, I think you could use the LocationSrv:

import { getLocationSrv } from '@grafana/runtime';
  query: {
    'refresh': '5s',
  partial: true,
  replace: true,

I’ve found this also in the docs recently but wasn’t 100% sure that this is the right way to do it.
It’s working fine.
Thank you :slight_smile:

1 Like


Can I know how to get the value of the same variable “refresh” value inside the plugin ?
I tried replaceVariables(’$refresh’) but it doesn’t work.

Thanks in advance.

You mean get the current refresh-rate value?
I dont know. I tried to look in @grafana/runtime | Grafana Labs
but haven’t found anything yet

Yes exactly.

I didn’t find anything about this also.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.