So we’ve been experimenting a bit with React plugins for grafana and
I would like to fire some code in my plugin whenever the user changes the dashboard timerange.
In the PanelProps interface interface I found the method onChangeTimeRange which I implemented. (https://github.com/wouterdt/grafana-react-testpanel/blob/f20fe0bb92b85a75ecb105ca80ea2ee06156f0ef/src/module.tsx#L16)
However the event never seems to fire. Does anyone know of any example where such a behaviour is implemented.
Any help would be appreciated, as the existing examples I could find are rather limited to just show some text.
Thank you, so this function is not usable in for this.
Now i’ve been trying to figure out how to get the timerange.
But it would seem that on my panel the render method only gets called upon adding or modifying the options in the panel. I was hoping that this would be triggerd at each refresh of the page (as with angular plugins?)
I was unable to find much info in the documentation, I’ll admit that my knowledge of React is also limited
But it’s all rather basic, what’s in there i’ve gotten to work but i’d like to do some more complex things.
So i’ve got these questions:
When does the render function get called?
How should we then get the timerange?
Is there some example code somewhere that does something similar?