Getting useful information from $eventdata in UDChart onclick

#1

I have a Chart that shows the “decline” of employees based on expiration date. I really would like to be able to have an onclick that displays more information

The input data for the chart is structured like this:
PS C:\Users\reh> $Cache:Contractersdecline

Date       Consultants
----       -----------
2019-04-02         134
2019-05-02          75
2019-06-02          62
2019-07-02          34
2019-08-02          25
2019-09-02          13
2019-10-02           7
2019-11-02           3
2019-12-02           2
2020-01-02           1
2020-02-02           1
2020-03-02           1
2020-04-02           1

And the chart is setup like this:

New-UDChart -Title "Decline by expiration date" -OnClick {Show-UDToast -Message "$Eventdata"} -Type Line -AutoRefresh -RefreshInterval 5 -Endpoint {
                            $Cache:Contractersdecline | Out-UDChartData -DataProperty "Consultants" -LabelProperty "Date" -BackgroundColor $ChartDataColour -BorderColor $ChartBorderColour -HoverBackgroundColor $ChartHighlightColour -HoverBorderColor $ChartBorderColour
                        } -Options @{
                            legend = @{  
                                display = $false  
                            };
                            scales = @{  
                                xAxes = @(
                                    @{
                                        ticks = @{
                                            display = $false
                                        }
                                    }
                                )
                            }
                        }

Seems promising, but the $eventdata provides no useful information:

Can anyone spot a fault in the code?

0 Likes