I am trying to get the most out of the links from New-UDChart
.
Ideally, I would like to be able to click each bar and be taken to the respective pages.
I have added the New-UDLink
at the bottom of the Chart, but I was wondering if there was a way to extend the -links
functionality (instead of just adding link buttons).
I am looking through the ChatJs documentation to see if I can find anything about links but no luck so far.
Anyone else tried anything like this?
I have copied in my code and screen-shot for review at the bottom of this post.
New-UDChart -Type HorizontalBar -Labels 'Labels' -Links @(
(New-UDLink -Text "Today Entries" -Url "$($Pages[$i].name)"),
(New-UDLink -Text "7 Days Entries" -Url "$($Pages[$i].name)"),
(New-UDLink -Text "Total Entries" -Url "$($Pages[$i].name)")) -Endpoint {
@(
[PSCustomObject]@{
'ID' = 'Simple History'
'Today' = (Invoke-SqliteQuery -Query ($sh_data_object[$i].Query + " where date(date) = (SELECT DATE('now','localtime'))") -DataSource ( $sh_data_object[$i].Location + '\' + $sh_data_object[$i].Database )).Count
'Last 7 Days' = (Invoke-SqliteQuery -Query ($sh_data_object[$i].Query + " where date(date) > (SELECT DATETIME('now','localtime','-7 day'))") -DataSource ( $sh_data_object[$i].Location + '\' + $sh_data_object[$i].Database )).Count
'Total' = (Invoke-SqliteQuery -Query ($sh_data_object[$i].Query) -DataSource ( $sh_data_object[$i].Location + '\' + $sh_data_object[$i].Database )).Count }
) | Out-UDChartData -LabelProperty ID -Dataset @(
New-UdChartDataset -Label "Today" -DataProperty "Today" -BackgroundColor "#8014558C" -HoverBackgroundColor "#8014558C" -
New-UdChartDataset -Label "Last 7 Days" -DataProperty "Last 7 Days" -BackgroundColor "#8000008C" -HoverBackgroundColor "#8014558C"
New-UdChartDataset -Label "Total" -DataProperty "Total"
)
}
Cheers Maylife