Chart refresh not working if AutoRefresh on New-UDPage is disabled

Hi guys,

I’m building a page with multiple tabs. What I want to do is to show the value of a $Cache variable on each tab. When the page is set to AutoRefresh, the selected tab is no longer in focus and the browser goes to the first tab when the page is refreshed, and the $Cache variable value is updated = not what I want.

If I enable AutoRefresh on the chart that displays $Cache, and disable AutoRefresh on New-UDPage, the value is simply not updated on the dashboard/chart.

I’m using New-UDGridLayout by the way. I suspect that using New-UDColumn will solve my problem but I really like the drag and drop JSON code, it’s much simpler to do the layout.

Any way around this?

Can you provide a code snippet?


$EndpointSchedule10Seconds = New-UDEndpointSchedule -Every 10 -Second
$Endpoint10Seconds = New-UDEndpoint -Schedule $EndpointSchedule10Seconds -Endpoint {
    $Cache:GetRandom = Get-Random -Minimum 99 -Maximum 100000
    $Cache:ChartData = Get-Stuff

$PageTest = New-UDPage -Name 'Test' -Icon windows -Endpoint {
    New-UDTabContainer -Tabs {
        New-UDTab -Text 'TestTab' -Content {
            New-UDCounter -AutoRefresh -RefreshInterval 10 -Endpoint {
                $Cache:GetRandom # THIS WORKS
            $Layout = '{"lg":[{"w":6,"h":15,"x":0,"y":0,"i":"grid-element-Doughnut","moved":false,"static":true}]}'
            New-UDGridLayout -Layout $Layout -Content {

                New-UDChart -Type Doughnut -Id Doughnut -AutoRefresh -RefreshInterval 10 -Endpoint {
                    $Cache:ChartData |
                    Out-UDChartData -DataProperty MyDataProperty -LabelProperty MyLabelProperty -BackgroundColor @($ColorSuccess, $ColorFailed) -HoverBackgroundColor @($ColorSuccessHover, $ColorFailedHover)
                } -Title "$Cache:GetRandom" # THIS DOESN'T WORK

A simple test shows the New-UDCounter properly updates by using $Cache:GetRandom, but New-UDChart does not. If I set the whole page to AutoRefresh, both are working, but I don’t want to refresh the entire page unless doing that can also keep the currently selected tab in focus.