Start a chart on page load?

Hey All,
I’m using Epic with groov View and would like to know the best way to start a chart when a page loads and stop it when it unloads. I am currently doing this by tagging a view button to a control variable, then in control if that variable is set, I start the chart. The same button also links to the page so when the button is pressed, the chart starts and the page loads. The new page then has 1 or more exit buttons and each of them resets the variable to stop the chart and navigates away to a new page.

This method just seems a but clunky, so I’m wondering if there is a cleaner way to do this?

Until such time that we get the API to the groov View log or activate operator logging, the way you are doing it is about the only way I can think to get it working.